summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJun Yan <juyan@nvidia.com>2013-07-25 13:35:27 -0700
committerHarshada Kale <hkale@nvidia.com>2013-09-04 02:18:21 -0700
commitc7ae816952a99ed37baf4e893814c610d69ae8bf (patch)
tree23efb8a3dc1c5460c1046c9c5487f1f0b3b82b1a /drivers
parent4a2de8168cfcdd8e615e4b46962838eac46c0999 (diff)
driver: led: Avoid calling pwm_disable and pwm_enable
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: Tao Xie <txie@nvidia.com> Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com> (cherry picked from commit 65c8a35800bcd61ee5287a4c723380cae7a1d105) Reviewed-on: http://git-master/r/269659
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-pwm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 2733ddbf4dda..f1cf21e5e1d7 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -10,6 +10,8 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/module.h>
@@ -41,14 +43,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 +120,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: