All of lore.kernel.org
 help / color / mirror / Atom feed
From: lqhua06@163.com
To: pavel@ucw.cz
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	"quanah.li_cp" <liqinghua@yulong.com>
Subject: [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off
Date: Thu, 29 Apr 2021 20:59:08 +0800	[thread overview]
Message-ID: <20210429125908.8308-1-lqhua06@163.com> (raw)

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



             reply	other threads:[~2021-04-29 12:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 12:59 lqhua06 [this message]
2021-08-04 16:13 ` [PATCH] leds: led-core: The value of delay_on and delay_off remains when led off Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210429125908.8308-1-lqhua06@163.com \
    --to=lqhua06@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=liqinghua@yulong.com \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.