diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2014-05-19 16:42:42 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2014-05-21 05:19:45 -0400 |
commit | 16fc3352ea58b481f879f8d965b98208ccc279c2 (patch) | |
tree | 59c61a8dfd8b83b2f0cdc7831633ec2db0f285d6 | |
parent | 81225bed32739752df61b5821bbf3f9be70e434d (diff) |
pwm-backlight: retrieve configured PWM period
The PWM core is now able to initialize the PWM period from a lookup
table defined by board files. Use it if available and fallback to the
value supplied in pwm_period_ns.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index cc49347bbcc0..38ca88bc5c3e 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -296,12 +296,15 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
296 | /* | 296 | /* |
297 | * The DT case will set the pwm_period_ns field to 0 and store the | 297 | * The DT case will set the pwm_period_ns field to 0 and store the |
298 | * period, parsed from the DT, in the PWM device. For the non-DT case, | 298 | * period, parsed from the DT, in the PWM device. For the non-DT case, |
299 | * set the period from platform data. | 299 | * set the period from platform data if it has not already been set |
300 | * via the PWM lookup table. | ||
300 | */ | 301 | */ |
301 | if (data->pwm_period_ns > 0) | 302 | pb->period = pwm_get_period(pb->pwm); |
303 | if (!pb->period && (data->pwm_period_ns > 0)) { | ||
304 | pb->period = data->pwm_period_ns; | ||
302 | pwm_set_period(pb->pwm, data->pwm_period_ns); | 305 | pwm_set_period(pb->pwm, data->pwm_period_ns); |
306 | } | ||
303 | 307 | ||
304 | pb->period = pwm_get_period(pb->pwm); | ||
305 | pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale); | 308 | pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale); |
306 | 309 | ||
307 | memset(&props, 0, sizeof(struct backlight_properties)); | 310 | memset(&props, 0, sizeof(struct backlight_properties)); |