diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 12:45:14 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 12:45:14 -0500 |
| commit | 3d50337f62a61027f40ad4ceddefa3c91e5d479e (patch) | |
| tree | c89bed784ab0fc402e9f4155f500170c9a335949 /drivers/leds/ledtrig-timer.c | |
| parent | 5b808a593588b2e6235c59fcd278791c53667787 (diff) | |
| parent | d39a7a63eb3971b1b3cc5c181ed526bf437b1c72 (diff) | |
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
leds: Add HP Jornada 6xx driver
leds: Remove the now uneeded ixp4xx driver
leds: Add power LED to the wrap driver
leds: Fix led-gpio active_low default brightness
leds: hw acceleration for Clevo mail LED driver
leds: Add support for hardware accelerated LED flashing
leds: Standardise LED naming scheme
leds: Add clevo notebook LED driver
Diffstat (limited to 'drivers/leds/ledtrig-timer.c')
| -rw-r--r-- | drivers/leds/ledtrig-timer.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index ed9ff02c77ea..82c55d6e4902 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c | |||
| @@ -77,8 +77,21 @@ static ssize_t led_delay_on_store(struct device *dev, | |||
| 77 | count++; | 77 | count++; |
| 78 | 78 | ||
| 79 | if (count == size) { | 79 | if (count == size) { |
| 80 | timer_data->delay_on = state; | 80 | if (timer_data->delay_on != state) { |
| 81 | mod_timer(&timer_data->timer, jiffies + 1); | 81 | /* the new value differs from the previous */ |
| 82 | timer_data->delay_on = state; | ||
| 83 | |||
| 84 | /* deactivate previous settings */ | ||
| 85 | del_timer_sync(&timer_data->timer); | ||
| 86 | |||
| 87 | /* try to activate hardware acceleration, if any */ | ||
| 88 | if (!led_cdev->blink_set || | ||
| 89 | led_cdev->blink_set(led_cdev, | ||
| 90 | &timer_data->delay_on, &timer_data->delay_off)) { | ||
| 91 | /* no hardware acceleration, blink via timer */ | ||
| 92 | mod_timer(&timer_data->timer, jiffies + 1); | ||
| 93 | } | ||
| 94 | } | ||
| 82 | ret = count; | 95 | ret = count; |
| 83 | } | 96 | } |
| 84 | 97 | ||
| @@ -110,8 +123,21 @@ static ssize_t led_delay_off_store(struct device *dev, | |||
| 110 | count++; | 123 | count++; |
| 111 | 124 | ||
| 112 | if (count == size) { | 125 | if (count == size) { |
| 113 | timer_data->delay_off = state; | 126 | if (timer_data->delay_off != state) { |
| 114 | mod_timer(&timer_data->timer, jiffies + 1); | 127 | /* the new value differs from the previous */ |
| 128 | timer_data->delay_off = state; | ||
| 129 | |||
| 130 | /* deactivate previous settings */ | ||
| 131 | del_timer_sync(&timer_data->timer); | ||
| 132 | |||
| 133 | /* try to activate hardware acceleration, if any */ | ||
| 134 | if (!led_cdev->blink_set || | ||
| 135 | led_cdev->blink_set(led_cdev, | ||
| 136 | &timer_data->delay_on, &timer_data->delay_off)) { | ||
| 137 | /* no hardware acceleration, blink via timer */ | ||
| 138 | mod_timer(&timer_data->timer, jiffies + 1); | ||
| 139 | } | ||
| 140 | } | ||
| 115 | ret = count; | 141 | ret = count; |
| 116 | } | 142 | } |
| 117 | 143 | ||
| @@ -143,6 +169,13 @@ static void timer_trig_activate(struct led_classdev *led_cdev) | |||
| 143 | if (rc) | 169 | if (rc) |
| 144 | goto err_out_delayon; | 170 | goto err_out_delayon; |
| 145 | 171 | ||
| 172 | /* If there is hardware support for blinking, start one | ||
| 173 | * user friendly blink rate chosen by the driver. | ||
| 174 | */ | ||
| 175 | if (led_cdev->blink_set) | ||
| 176 | led_cdev->blink_set(led_cdev, | ||
| 177 | &timer_data->delay_on, &timer_data->delay_off); | ||
| 178 | |||
| 146 | return; | 179 | return; |
| 147 | 180 | ||
| 148 | err_out_delayon: | 181 | err_out_delayon: |
