From: Thierry Reding <thierry.reding@avionic-design.de>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCHv3] pwm_backlight: pass correct brightness to callback
Date: Mon, 9 Jul 2012 08:30:06 +0200 [thread overview]
Message-ID: <20120709063006.GC10484@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <1341813863-18822-1-git-send-email-acourbot@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]
On Mon, Jul 09, 2012 at 03:04:23PM +0900, Alexandre Courbot wrote:
> pwm_backlight_update_status calls the notify() and notify_after()
> callbacks before and after applying the new PWM settings. However, if
> brightness levels are used, the brightness value will be changed from
> the index into the levels array to the PWM duty cycle length before
> being passed to notify_after(), which results in inconsistent behavior.
>
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> drivers/video/backlight/pwm_bl.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
Applied, with a minor stylistic fixup adding a blank line after the
duty_cycle variable declaration. Thanks.
Thierry
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 057389d..be48517 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -54,14 +54,17 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
> pwm_config(pb->pwm, 0, pb->period);
> pwm_disable(pb->pwm);
> } else {
> + int duty_cycle;
> if (pb->levels) {
> - brightness = pb->levels[brightness];
> + duty_cycle = pb->levels[brightness];
> max = pb->levels[max];
> + } else {
> + duty_cycle = brightness;
> }
>
> - brightness = pb->lth_brightness +
> - (brightness * (pb->period - pb->lth_brightness) / max);
> - pwm_config(pb->pwm, brightness, pb->period);
> + duty_cycle = pb->lth_brightness +
> + (duty_cycle * (pb->period - pb->lth_brightness) / max);
> + pwm_config(pb->pwm, duty_cycle, pb->period);
> pwm_enable(pb->pwm);
> }
>
> --
> 1.7.11.1
>
>
>
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-07-09 6:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 4:21 [PATCH] pwm_backlight: pass correct brightness to callback Alexandre Courbot
2012-07-09 5:10 ` Thierry Reding
2012-07-09 5:27 ` Alex Courbot
2012-07-09 5:36 ` [PATCHv2] " Alexandre Courbot
2012-07-09 6:04 ` [PATCHv3] " Alexandre Courbot
2012-07-09 6:30 ` Thierry Reding [this message]
2012-07-09 5:11 ` [PATCH] " Jingoo Han
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=20120709063006.GC10484@avionic-0098.mockup.avionic-design.de \
--to=thierry.reding@avionic-design.de \
--cc=acourbot@nvidia.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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