linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: pwm-multicolor: fix multicolor PWM LED lights up without any setting
@ 2024-08-16 10:26 FUKAUMI Naoki
  2024-08-21 16:11 ` Lee Jones
  0 siblings, 1 reply; 11+ messages in thread
From: FUKAUMI Naoki @ 2024-08-16 10:26 UTC (permalink / raw)
  To: linux-leds; +Cc: pavel, lee, FUKAUMI Naoki

from drivers/leds/leds-pwm.c:led_pwm_set(),

/*
 * 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.
 */

do the same in led_pwm_mc_set().

this fixes LEDs light up without any setting (i.e. brightness is 0) on
Radxa E25.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
---
 drivers/leds/rgb/leds-pwm-multicolor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c
index e1a81e0109e8..7155339c075e 100644
--- a/drivers/leds/rgb/leds-pwm-multicolor.c
+++ b/drivers/leds/rgb/leds-pwm-multicolor.c
@@ -50,7 +50,7 @@ static int led_pwm_mc_set(struct led_classdev *cdev,
 			duty = priv->leds[i].state.period - duty;
 
 		priv->leds[i].state.duty_cycle = duty;
-		priv->leds[i].state.enabled = duty > 0;
+		priv->leds[i].state.enabled = !(cdev->flags & LED_SUSPENDED);
 		ret = pwm_apply_might_sleep(priv->leds[i].pwm,
 					    &priv->leds[i].state);
 		if (ret)
-- 
2.43.0


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

end of thread, other threads:[~2024-12-16  9:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 10:26 [PATCH] leds: pwm-multicolor: fix multicolor PWM LED lights up without any setting FUKAUMI Naoki
2024-08-21 16:11 ` Lee Jones
2024-08-21 21:26   ` FUKAUMI Naoki
2024-08-22  7:22     ` FUKAUMI Naoki
2024-08-22  8:24       ` Lee Jones
2024-12-10  7:36       ` FUKAUMI Naoki
2024-12-12 19:04         ` Lee Jones
2024-12-12 21:19           ` FUKAUMI Naoki
2024-12-13 16:35             ` Lee Jones
2024-12-13 21:11               ` FUKAUMI Naoki
2024-12-16  9:51                 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).