mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pascal Roeleven <dev@pascalroeleven.nl>
To: Andrey Lebedev <andrey@lebedev.lt>
Cc: "Daniel Thompson" <daniel.thompson@linaro.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"open list:PWM SUBSYSTEM" <linux-pwm@vger.kernel.org>,
	"moderated list:ARM/Allwinner sunXi SoC support"
	<linux-arm-kernel@lists.infradead.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Emil Lenngren" <emil.lenngren@gmail.com>
Subject: Re: pwm-sun4i: PWM backlight is not turned off on shutdown
Date: Wed, 02 Sep 2020 21:42:49 +0200	[thread overview]
Message-ID: <5302741318a28e39239db08a1f05ecb7@pascalroeleven.nl> (raw)
In-Reply-To: <913a5324-a7d2-f1d5-701e-1c28359286f2@lebedev.lt>

Thank you for adding me. Emil (also added now) and I spent a while on 
trying to figure out how to solve this. The Allwinner PWM controller has 
some quirks.

Unfortunately I never got around to perform some more tests and fix it 
indefinitely. It's still on my todo list..

> On 9/2/20 12:54 PM, Daniel Thompson wrote:
>> There's some rather odd logic in sun4i_pwm_apply() that results in the
>> PWM being disabled twice... once when it applies the initial config
>> and again after waiting for a duty_cycle.

That's true. To properly turn off the controller you have to turn the 
controller off first and keep the gate on for at least two full clock 
cycles. Then the gate must be turned off. Otherwise it might get stuck. 
That's probably what is trying to be done here.

On 2020-09-02 21:05, Andrey Lebedev wrote:
> Indeed, this fixes the issue for me. The display goes dark reliably on
> writing 4 to "/sys/.../bl_power" as well as when system is halted. I 
> did
> not notice any negative side effects so far.

Problems start to arise when combining bl_power and brightness setting 
in a particular order or at the same time (with for example a backlight 
driver which sets both bl_power and brightness). I can't recall exactly 
what caused problems and when, but one thing I was sure of is that 
timing was of the essence. Once I added some delays here and there it 
started to work.

If this patch works for you then that's great, but unfortunately it 
isn't a complete solution.

Regards,
Pascal


  reply	other threads:[~2020-09-02 19:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 19:55 Andrey Lebedev
2020-09-02  9:54 ` Daniel Thompson
2020-09-02 19:05   ` Andrey Lebedev
2020-09-02 19:42     ` Pascal Roeleven [this message]
2020-09-03 11:18       ` Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5302741318a28e39239db08a1f05ecb7@pascalroeleven.nl \
    --to=dev@pascalroeleven.nl \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrey@lebedev.lt \
    --cc=daniel.thompson@linaro.org \
    --cc=emil.lenngren@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®