All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH stable v4.4+ 1/3] leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF
@ 2018-12-06  9:47 Krzysztof Kozlowski
  2018-12-06  9:47 ` [PATCH stable v4.4+ 2/3] leds: turn off the LED and wait for completion on unregistering LED class device Krzysztof Kozlowski
  2018-12-06  9:47 ` [PATCH stable v4.4+ 3/3] leds: leds-gpio: Fix return value check in create_gpio_led() Krzysztof Kozlowski
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2018-12-06  9:47 UTC (permalink / raw)
  To: stable; +Cc: Markus Hofstaetter, Jacek Anaszewski, Krzysztof Kozlowski

From: Markus Hofstaetter <markus.hofstaetter@ait.ac.at>

commit f16703360da7731a057df2ffa902306819c22398 upstream.

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>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/leds/leds-pwm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 1d07e3e83d29..3149dbece146 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -132,6 +132,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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-06 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06  9:47 [PATCH stable v4.4+ 1/3] leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF Krzysztof Kozlowski
2018-12-06  9:47 ` [PATCH stable v4.4+ 2/3] leds: turn off the LED and wait for completion on unregistering LED class device Krzysztof Kozlowski
2018-12-06  9:47 ` [PATCH stable v4.4+ 3/3] leds: leds-gpio: Fix return value check in create_gpio_led() Krzysztof Kozlowski
2018-12-06 10:04   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.