[PATCH] leds: led-core: The value of delay_on and delay_off remains when led off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "quanah.li_cp" <liqinghua@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux