summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJun Yan <juyan@nvidia.com>2013-07-25 13:35:27 -0700
committerRiham Haidar <rhaidar@nvidia.com>2013-07-25 20:26:47 -0700
commit65c8a35800bcd61ee5287a4c723380cae7a1d105 (patch)
treed6b0de567b8453946b67c33b3c645135ea078c3a /drivers
parent55d5b8542b102976b2b81bb67374827fa73fa48a (diff)
driver: led: Avoid calling pwm_disable and pwm_enabledaily-2013.07.31.1_rel-roth-ota-1-partner
These two routines use semaphore to protect pwm resource. However they can be called via led timer ISR, thus causing linux BUG. Remove the call to these two functions and use pwm_config instead Bug 1333079 Change-Id: I6db788218f74c030956272ee0fcb9c7ec8a0652f Signed-off-by: Jun Yan <juyan@nvidia.com> Reviewed-on: http://git-master/r/253619 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Tao Xie <txie@nvidia.com> Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-pwm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 2733ddbf4dda..c2cd410debf9 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -41,14 +41,7 @@ static void led_pwm_set(struct led_classdev *led_cdev,
container_of(led_cdev, struct led_pwm_data, cdev);
unsigned int max = led_dat->cdev.max_brightness;
unsigned int period = led_dat->period;
-
- if (brightness == 0) {
- pwm_config(led_dat->pwm, 0, period);
- pwm_disable(led_dat->pwm);
- } else {
- pwm_config(led_dat->pwm, brightness * period / max, period);
- pwm_enable(led_dat->pwm);
- }
+ pwm_config(led_dat->pwm, brightness * period / max, period);
}
static void led_pwm_enable(struct led_classdev *led_cdev,
@@ -125,6 +118,8 @@ static int led_pwm_probe(struct platform_device *pdev)
ret = gpio_direction_output(pdata->OE_gpio, 1);
if (ret)
pr_err("OE gpio set output failed: %d", ret);
+ pwm_enable(led_dat->pwm);
+
return 0;
err: