From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Jingoo Han <jingoohan1@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
Thierry Reding <thierry.reding@gmail.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org
Cc: "Lothar Waßmann" <LW@KARO-electronics.de>
Subject: [PATCH] backlight: pwm_bl: disable PWM when 'duty_cycle' is zero
Date: Mon, 6 Jun 2016 12:44:56 +0200 [thread overview]
Message-ID: <1465209896-10319-1-git-send-email-LW@KARO-electronics.de> (raw)
'brightness' is usually an index into a table of duty_cycle values,
where the value at index 0 may well be non-zero
(tegra30-apalis-eval.dts and tegra30-colibri-eval-v3.dts are real-life
examples).
Thus brightness == 0 does not necessarily mean that the PWM output
will be inactive.
Check for 'duty_cycle == 0' rather than 'brightness == 0' to decide
whether to disable the PWM.
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
drivers/video/backlight/pwm_bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b2b366b..80b2b52 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -103,8 +103,8 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
if (pb->notify)
brightness = pb->notify(pb->dev, brightness);
- if (brightness > 0) {
- duty_cycle = compute_duty_cycle(pb, brightness);
+ duty_cycle = compute_duty_cycle(pb, brightness);
+ if (duty_cycle > 0) {
pwm_config(pb->pwm, duty_cycle, pb->period);
pwm_backlight_power_on(pb, brightness);
} else
--
2.1.4
next reply other threads:[~2016-06-06 10:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 10:44 Lothar Waßmann [this message]
2016-06-06 12:02 ` Tomi Valkeinen
2016-06-07 6:49 ` Lothar Waßmann
2016-06-07 8:02 ` Tomi Valkeinen
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=1465209896-10319-1-git-send-email-LW@KARO-electronics.de \
--to=lw@karo-electronics.de \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=thierry.reding@gmail.com \
--cc=tomi.valkeinen@ti.com \
/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
all inboxes | Powered by JetHome®