summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-pwm.c
diff options
context:
space:
mode:
authorMarkus Hofstaetter <markus.hofstaetter@ait.ac.at>2015-11-11 11:40:29 (GMT)
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-01-04 08:57:36 (GMT)
commitf16703360da7731a057df2ffa902306819c22398 (patch)
treebad958970dbfa9c83d2f079304efd8822ffed893 /drivers/leds/leds-pwm.c
parentfb65ee94ee3ae8fde4922262f73dddea2172e3ef (diff)
downloadlinux-f16703360da7731a057df2ffa902306819c22398.tar.xz
leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF
Some PWMs are disabled by default or the default pin setting does not match the LED_OFF state (e.g., active-low leds). Hence, the driver may end up reporting 0 brightness, but the leds are actually on using full brightness, because it never enforces its default configuration. So enforce it by calling led_pwm_set() after successfully registering the device. Tested on a Phytec phyFLEX i.MX6Q board based on kernel v3.19.5. Signed-off-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at> Tested-by: Markus Hofstaetter <markus.hofstaetter@ait.ac.at> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-pwm.c')
-rw-r--r--drivers/leds/leds-pwm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index bc50193..410ff04 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -124,6 +124,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
ret = led_classdev_register(dev, &led_data->cdev);
if (ret == 0) {
priv->num_leds++;
+ led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
} else {
dev_err(dev, "failed to register PWM led for %s: %d\n",
led->name, ret);