summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorStas Sergeev <stsp@list.ru>2015-05-14 08:24:02 -0700
committerBryan Wu <cooloney@gmail.com>2015-05-25 13:26:47 -0700
commit76931edd54f87d1e49536cd068df4783fae24d45 (patch)
treeb9156a89d62a210dccc24f958a9b34be0891cd47 /drivers/leds
parent7ff6b23251955dc1cf108eb4619b4a2eeac75bca (diff)
downloadlinux-76931edd54f87d1e49536cd068df4783fae24d45.tar.bz2
leds: fix brightness changing when software blinking is active
The following sequence: echo timer >/sys/class/leds/<name>/trigger echo 1 >/sys/class/leds/<name>/brightness should change the ON brightness for blinking. The function led_set_brightness() was mistakenly initiating the delayed blink stop procedure, which resulted in no blinking with the timer trigger still active. This patch fixes the problem by changing led_set_brightness() to not initiate the delayed blink stop when brightness is not 0. CC: Richard Purdie <rpurdie@rpsys.net> CC: Kyungmin Park <kyungmin.park@samsung.com> CC: linux-leds@vger.kernel.org CC: linux-kernel@vger.kernel.org Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/led-class.c5
-rw-r--r--drivers/leds/led-core.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 728681debdbe..adc38d14576b 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -121,6 +121,11 @@ static void led_timer_function(unsigned long data)
brightness = led_get_brightness(led_cdev);
if (!brightness) {
/* Time to switch the LED on. */
+ if (led_cdev->delayed_set_value) {
+ led_cdev->blink_brightness =
+ led_cdev->delayed_set_value;
+ led_cdev->delayed_set_value = 0;
+ }
brightness = led_cdev->blink_brightness;
delay = led_cdev->blink_delay_on;
} else {
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 9886dace5ad2..549de7e24cfd 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -119,10 +119,11 @@ void led_set_brightness(struct led_classdev *led_cdev,
{
int ret = 0;
- /* delay brightness setting if need to stop soft-blink timer */
+ /* delay brightness if soft-blink is active */
if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) {
led_cdev->delayed_set_value = brightness;
- schedule_work(&led_cdev->set_brightness_work);
+ if (brightness == LED_OFF)
+ schedule_work(&led_cdev->set_brightness_work);
return;
}