[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210429125908.8308-1-lqhua06@163.com>
Date: Thu, 29 Apr 2021 20:59:08 +0800
From: lqhua06@....com
To: pavel@....cz
Cc: linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
"quanah.li_cp" <liqinghua@...ong.com>
Subject: [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off
From: "quanah.li_cp" <liqinghua@...ong.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@...ong.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
Powered by blists - more mailing lists