summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2014-05-19 22:42:41 +0200
committerThierry Reding <thierry.reding@gmail.com>2014-05-21 11:19:45 +0200
commit81225bed32739752df61b5821bbf3f9be70e434d (patch)
tree77683ae1cde1fd6c7508290f7683017c74f6440d /drivers/leds
parent9becf5001130bcd24f57584e48467050e85eee03 (diff)
downloadlinux-81225bed32739752df61b5821bbf3f9be70e434d.tar.bz2
leds: leds-pwm: 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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-pwm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 7d0aaed1e23a..aa770ec1e892 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -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;
@@ -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;