[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5554BE12.7050209@list.ru>
Date: Thu, 14 May 2015 18:24:02 +0300
From: Stas Sergeev <stsp@...t.ru>
To: linux-leds@...r.kernel.org
CC: Linux kernel <linux-kernel@...r.kernel.org>,
Bryan Wu <cooloney@...il.com>,
Richard Purdie <rpurdie@...ys.net>,
Jacek Anaszewski <j.anaszewski@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Stas Sergeev <stsp@...rs.sourceforge.net>
Subject: [PATCH v2] 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: Bryan Wu <cooloney@...il.com>
CC: Richard Purdie <rpurdie@...ys.net>
CC: Jacek Anaszewski <j.anaszewski@...sung.com>
CC: Kyungmin Park <kyungmin.park@...sung.com>
CC: linux-leds@...r.kernel.org
CC: linux-kernel@...r.kernel.org
Signed-off-by: Stas Sergeev <stsp@...rs.sourceforge.net>
---
drivers/leds/led-class.c | 5 +++++
drivers/leds/led-core.c | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 795ec99..65c2c80 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 356e851..a90dd26 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;
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists