mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* pwm-sun4i: PWM backlight is not turned off on shutdown
@ 2020-08-27 19:55 Andrey Lebedev
  2020-09-02  9:54 ` Daniel Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Andrey Lebedev @ 2020-08-27 19:55 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Maxime Ripard,
	Chen-Yu Tsai, Philipp Zabel, open list:PWM SUBSYSTEM,
	moderated list:ARM/Allwinner sunXi SoC support, open list

Hello,

I think I'm experiencing problem with pwm-sun4i module. I'll describe
the symptoms first.

I have a device, based on Allwinner A20 (Cubieboard 2) with LVDS display
that has a PWM-based backlight. The problem is: when linux shuts down,
the backlight stays on. I expect it to be turned off. This used to work
as expected on kernel 5.2-rc2, but after upgrade to 5.8 the backlight
does not turn off anymore (most of the times, see below).

The backlight is configured in the device tree [1]. The brightness can
be changed by writing to "brightness" file on sysfs. So, linux can
control the PWM line. Backlight sysfs directory also has a "bl_power"
file, which can accept "0" to power on or "4" to power off the backlight
(according to [2]).

Now, writing "4" to bl_power sometimes turns the backlight off and
sometimes not. I've found that the probability of backlight turning off
pretty much correlates with the current screen brightness: on 100%
brightness it will never turn off, on 50% brightness it will turn off on
about half of the times. When backlight does not turn off, it goes on
full brightness. It feels like the line, controlled by pwm stays in
whatever state it was the moment backlight was powered down - either
full 1 or 0.

The pwm backlight device driver (pwm_bl) requests to set the duty cycle
to 0 and disable the pwm with the same request [3], but I suspect the
implementation driver (pwm-sun4i) does not actually set the duty cycle
to 0 before disabling the pulse width modulation.

Is there anything that can be done to fix this?


[1]
https://github.com/Openvario/meta-openvario/blob/warrior/recipes-kernel/linux/linux-mainline/openvario-common.dts#L21-L27


[2]
https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-backlight

[3]
https://github.com/torvalds/linux/blob/master/drivers/video/backlight/pwm_bl.c#L81-L83

-- 
Andrey Lebedev aka -.- . -.. -.. . .-.
Software engineer
Homepage: http://lebedev.lt/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-03 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 19:55 pwm-sun4i: PWM backlight is not turned off on shutdown Andrey Lebedev
2020-09-02  9:54 ` Daniel Thompson
2020-09-02 19:05   ` Andrey Lebedev
2020-09-02 19:42     ` Pascal Roeleven
2020-09-03 11:18       ` Daniel Thompson

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®