aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2012-07-09 15:04:23 +0900
committerThierry Reding <thierry.reding@avionic-design.de>2012-07-23 13:24:04 +0200
commit9fb978b12f9cc2b4df428764273d96877d0a262d (patch)
tree337e292cda3387595b10b90356333ede3448e963 /drivers/video/backlight
parent2437b0d95c609365ce88039b96a1c020af71c6dc (diff)
downloadlinux-stericsson-9fb978b12f9cc2b4df428764273d96877d0a262d.tar.gz
pwm_backlight: pass correct brightness to callback
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> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/pwm_bl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 057389d69a51..995f0164c9b0 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -54,14 +54,18 @@ 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);
}