LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off
@ 2021-04-29 12:59 lqhua06
  2021-08-04 16:13 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: lqhua06 @ 2021-04-29 12:59 UTC (permalink / raw)
  To: pavel; +Cc: linux-leds, linux-kernel, quanah.li_cp

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off
  2021-04-29 12:59 [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off lqhua06
@ 2021-08-04 16:13 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2021-08-04 16:13 UTC (permalink / raw)
  To: lqhua06; +Cc: linux-leds, linux-kernel, quanah.li_cp

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

On Thu 2021-04-29 20:59:08, lqhua06@163.com wrote:
> 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.

Is that a problem?

It seems this is a feature, not a bug.

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-04 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 12:59 [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off lqhua06
2021-08-04 16:13 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).