mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
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 <[email protected]> CC: Kyungmin Park <[email protected]> CC: [email protected] CC: [email protected] Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Stas Sergeev <[email protected]> Signed-off-by: Bryan Wu <[email protected]>
This commit is contained in:
1 parent
7ff6b23251
commit
76931edd54
2 files changed
+8
-2
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user