diff options
author | Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> | 2012-04-18 17:16:40 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2012-05-14 23:12:14 -0400 |
commit | ff3e660b5a881b401b2b6735aa5334f433237dcb (patch) | |
tree | 275ddcb9365d4cc6ac7320b18a29b5d57fe2ada4 /arch/arm/plat-orion/gpio.c | |
parent | 92a486eabefadca1169fbf15d737feeaf2bda844 (diff) |
orion/kirkwood: create a generic function for gpio led blinking
dns323 and (at least) iconnect platforms are using hw led blinking, so,
instead of having 2 identicals .gpio_blink_set gpio-led hooks, move
dns323 code into gpio.c
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Tested-By: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/plat-orion/gpio.c')
-rw-r--r-- | arch/arm/plat-orion/gpio.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index d3401e77ff3d..af95af257301 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/bitops.h> | 16 | #include <linux/bitops.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/leds.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * GPIO unit register offsets. | 22 | * GPIO unit register offsets. |
@@ -295,6 +296,28 @@ void orion_gpio_set_blink(unsigned pin, int blink) | |||
295 | } | 296 | } |
296 | EXPORT_SYMBOL(orion_gpio_set_blink); | 297 | EXPORT_SYMBOL(orion_gpio_set_blink); |
297 | 298 | ||
299 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ | ||
300 | |||
301 | int orion_gpio_led_blink_set(unsigned gpio, int state, | ||
302 | unsigned long *delay_on, unsigned long *delay_off) | ||
303 | { | ||
304 | |||
305 | if (delay_on && delay_off && !*delay_on && !*delay_off) | ||
306 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; | ||
307 | |||
308 | switch (state) { | ||
309 | case GPIO_LED_NO_BLINK_LOW: | ||
310 | case GPIO_LED_NO_BLINK_HIGH: | ||
311 | orion_gpio_set_blink(gpio, 0); | ||
312 | gpio_set_value(gpio, state); | ||
313 | break; | ||
314 | case GPIO_LED_BLINK: | ||
315 | orion_gpio_set_blink(gpio, 1); | ||
316 | } | ||
317 | return 0; | ||
318 | } | ||
319 | EXPORT_SYMBOL_GPL(orion_gpio_led_blink_set); | ||
320 | |||
298 | 321 | ||
299 | /***************************************************************************** | 322 | /***************************************************************************** |
300 | * Orion GPIO IRQ | 323 | * Orion GPIO IRQ |