Skip to content

Commit

Permalink
leds: leds-pwm: 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 9becf50 commit 81225be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/leds/leds-pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ static int led_pwm_probe(struct platform_device *pdev)
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->active_low = cur_led->active_low;
led_dat->period = cur_led->pwm_period_ns;
led_dat->cdev.brightness_set = led_pwm_set;
led_dat->cdev.brightness = LED_OFF;
led_dat->cdev.max_brightness = cur_led->max_brightness;
Expand All @@ -191,6 +190,10 @@ static int led_pwm_probe(struct platform_device *pdev)
if (led_dat->can_sleep)
INIT_WORK(&led_dat->work, led_pwm_work);

led_dat->period = pwm_get_period(led_dat->pwm);
if (!led_dat->period && (cur_led->pwm_period_ns > 0))
led_dat->period = cur_led->pwm_period_ns;

ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
if (ret < 0)
goto err;
Expand Down

0 comments on commit 81225be

Please sign in to comment.