linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yisheng Xie <ysxie@foxmail.com>
To: jacek.anaszewski@gmail.com, pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yisheng Xie <ysxie@foxmail.com>
Subject: [PATCH] leds: pwm: fix max_brightness works abnormal when active_low
Date: Sun, 10 Feb 2019 20:37:09 +0800	[thread overview]
Message-ID: <1549802229-31170-1-git-send-email-ysxie@foxmail.com> (raw)

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

             reply	other threads:[~2019-02-10 12:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-10 12:37 Yisheng Xie [this message]
2019-02-10 16:39 ` [PATCH] leds: pwm: fix max_brightness works abnormal when active_low Pavel Machek

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=1549802229-31170-1-git-send-email-ysxie@foxmail.com \
    --to=ysxie@foxmail.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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;
as well as URLs for NNTP newsgroup(s).