mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
leds: pwm: Disable PWM when going to suspend
[ Upstream commit974afccd37
] On stm32mp1xx based machines (and others) a PWM consumer has to disable the PWM because an enabled PWM refuses to suspend. So check the LED_SUSPENDED flag and depending on that set the .enabled property. Link: https://bugzilla.kernel.org/show_bug.cgi?id=218559 Fixes:76fe464c8e
("leds: pwm: Don't disable the PWM when the LED should be off") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20240417153846.271751-2-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a10c3d5ff9
commit
034968dbd8
1 changed files with 7 additions and 1 deletions
|
@ -53,7 +53,13 @@ static int led_pwm_set(struct led_classdev *led_cdev,
|
||||||
duty = led_dat->pwmstate.period - duty;
|
duty = led_dat->pwmstate.period - duty;
|
||||||
|
|
||||||
led_dat->pwmstate.duty_cycle = duty;
|
led_dat->pwmstate.duty_cycle = duty;
|
||||||
led_dat->pwmstate.enabled = true;
|
/*
|
||||||
|
* Disabling a PWM doesn't guarantee that it emits the inactive level.
|
||||||
|
* So keep it on. Only for suspending the PWM should be disabled because
|
||||||
|
* otherwise it refuses to suspend. The possible downside is that the
|
||||||
|
* LED might stay (or even go) on.
|
||||||
|
*/
|
||||||
|
led_dat->pwmstate.enabled = !(led_cdev->flags & LED_SUSPENDED);
|
||||||
return pwm_apply_might_sleep(led_dat->pwm, &led_dat->pwmstate);
|
return pwm_apply_might_sleep(led_dat->pwm, &led_dat->pwmstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue