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/mach-orion5x | |
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/mach-orion5x')
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index c3ed15b8ea25..13d2bece1bae 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -253,27 +253,6 @@ error_fail: | |||
253 | * GPIO LEDs (simple - doesn't use hardware blinking support) | 253 | * GPIO LEDs (simple - doesn't use hardware blinking support) |
254 | */ | 254 | */ |
255 | 255 | ||
256 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ | ||
257 | |||
258 | static int dns323_gpio_blink_set(unsigned gpio, int state, | ||
259 | unsigned long *delay_on, unsigned long *delay_off) | ||
260 | { | ||
261 | |||
262 | if (delay_on && delay_off && !*delay_on && !*delay_off) | ||
263 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; | ||
264 | |||
265 | switch(state) { | ||
266 | case GPIO_LED_NO_BLINK_LOW: | ||
267 | case GPIO_LED_NO_BLINK_HIGH: | ||
268 | orion_gpio_set_blink(gpio, 0); | ||
269 | gpio_set_value(gpio, state); | ||
270 | break; | ||
271 | case GPIO_LED_BLINK: | ||
272 | orion_gpio_set_blink(gpio, 1); | ||
273 | } | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static struct gpio_led dns323ab_leds[] = { | 256 | static struct gpio_led dns323ab_leds[] = { |
278 | { | 257 | { |
279 | .name = "power:blue", | 258 | .name = "power:blue", |
@@ -312,13 +291,13 @@ static struct gpio_led dns323c_leds[] = { | |||
312 | static struct gpio_led_platform_data dns323ab_led_data = { | 291 | static struct gpio_led_platform_data dns323ab_led_data = { |
313 | .num_leds = ARRAY_SIZE(dns323ab_leds), | 292 | .num_leds = ARRAY_SIZE(dns323ab_leds), |
314 | .leds = dns323ab_leds, | 293 | .leds = dns323ab_leds, |
315 | .gpio_blink_set = dns323_gpio_blink_set, | 294 | .gpio_blink_set = orion_gpio_led_blink_set, |
316 | }; | 295 | }; |
317 | 296 | ||
318 | static struct gpio_led_platform_data dns323c_led_data = { | 297 | static struct gpio_led_platform_data dns323c_led_data = { |
319 | .num_leds = ARRAY_SIZE(dns323c_leds), | 298 | .num_leds = ARRAY_SIZE(dns323c_leds), |
320 | .leds = dns323c_leds, | 299 | .leds = dns323c_leds, |
321 | .gpio_blink_set = dns323_gpio_blink_set, | 300 | .gpio_blink_set = orion_gpio_led_blink_set, |
322 | }; | 301 | }; |
323 | 302 | ||
324 | static struct platform_device dns323_gpio_leds = { | 303 | static struct platform_device dns323_gpio_leds = { |