lkml.org 
[lkml]   [2011]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] leds: Support automatic start of blinking with ledtrig-timer
Date
From: Esben Haabendal <eha@doredevelopment.dk>

By setting initial values blink_delay_on and blink_delay_off in a
led_classdev struct, this change starts the blinking when the led
is initialized.

Signed-off-by: Esben Haabendal <eha@doredevelopment.dk>
---
drivers/leds/led-class.c | 3 ++-
drivers/leds/ledtrig-timer.c | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index d5a4ade..d7bdef8 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -131,7 +131,8 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
if (!led_cdev->blink_brightness)
led_cdev->blink_brightness = led_cdev->max_brightness;

- if (delay_on == led_cdev->blink_delay_on &&
+ if (led_cdev->trigger_data &&
+ delay_on == led_cdev->blink_delay_on &&
delay_off == led_cdev->blink_delay_off)
return;

diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index b09bcbe..d87c9d0 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -91,6 +91,9 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
if (rc)
goto err_out_delayon;

+ led_blink_set(led_cdev, &led_cdev->blink_delay_on,
+ &led_cdev->blink_delay_off);
+
led_cdev->trigger_data = (void *)1;

return;
--
1.7.1


\
 
 \ /
  Last update: 2011-03-18 12:05    [W:0.031 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site