Skip to content

Commit

Permalink
pwm-backlight: retrieve configured PWM period
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexandre Belloni authored and Thierry Reding committed May 21, 2014
1 parent 81225be commit 16fc335
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
/*
* The DT case will set the pwm_period_ns field to 0 and store the
* period, parsed from the DT, in the PWM device. For the non-DT case,
* set the period from platform data.
* set the period from platform data if it has not already been set
* via the PWM lookup table.
*/
if (data->pwm_period_ns > 0)
pb->period = pwm_get_period(pb->pwm);
if (!pb->period && (data->pwm_period_ns > 0)) {
pb->period = data->pwm_period_ns;
pwm_set_period(pb->pwm, data->pwm_period_ns);
}

pb->period = pwm_get_period(pb->pwm);
pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);

memset(&props, 0, sizeof(struct backlight_properties));
Expand Down

0 comments on commit 16fc335

Please sign in to comment.