lkml.org 
[lkml]   [2021]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] leds: led-core: The value of delay_on and delay_off remains when led off
Date
From: "quanah.li_cp" <liqinghua@yulong.com>

The LED connect to pmic gpio, and the LED can blinking during
AP goto sleep.

When the LED is turned off and the hardware blinking will be disabled,
but the value of delay_on and delay_off still remains.

Signed-off-by: quanah.li_cp <liqinghua@yulong.com>
---
drivers/leds/led-core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 8eb8054..5db251d 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -262,6 +262,19 @@ void led_set_brightness(struct led_classdev *led_cdev, unsigned int brightness)
}

led_set_brightness_nosleep(led_cdev, brightness);
+
+ /* When the LED is off and the hardware blinking will be disabled,
+ * but the value of delay_on and delay_off still remains.
+ */
+ if ((led_cdev->blink_delay_off > 0) &&
+ (led_cdev->blink_delay_on > 0) &&
+ (brightness == LED_OFF)) {
+ if (!test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags) &&
+ led_cdev->blink_set) {
+ led_cdev->blink_delay_on = 0;
+ led_cdev->blink_delay_off = 0;
+ }
+ }
}
EXPORT_SYMBOL_GPL(led_set_brightness);

--
1.9.1

\
 
 \ /
  Last update: 2021-04-29 14:59    [W:0.036 / U:4.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site