linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: pwm: fix max_brightness works abnormal when active_low
@ 2019-02-10 12:37 Yisheng Xie
  2019-02-10 16:39 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Yisheng Xie @ 2019-02-10 12:37 UTC (permalink / raw)
  To: jacek.anaszewski, pavel; +Cc: linux-leds, linux-kernel, Yisheng Xie

When leds-pwm is active_low, smaller number of  duty kept in led_dat
means less brighness, so we should disable pwm when led_dat->duty is
equal to period instead of zero, which means max_brightness.

Signed-off-by: Yisheng Xie <ysxie@foxmail.com>
---
 drivers/leds/leds-pwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index df80c89..07fb772 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -41,7 +41,7 @@ static void __led_pwm_set(struct led_pwm_data *led_dat)
 
 	pwm_config(led_dat->pwm, new_duty, led_dat->period);
 
-	if (new_duty == 0)
+	if (led_dat->active_low ? new_duty == led_dat->period : new_duty == 0)
 		pwm_disable(led_dat->pwm);
 	else
 		pwm_enable(led_dat->pwm);
-- 
1.9.1

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

end of thread, other threads:[~2019-02-10 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-10 12:37 [PATCH] leds: pwm: fix max_brightness works abnormal when active_low Yisheng Xie
2019-02-10 16:39 ` Pavel Machek

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).