aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c25
-rw-r--r--arch/arm/plat-orion/gpio.c23
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h2
3 files changed, 27 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
258static 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
277static struct gpio_led dns323ab_leds[] = { 256static 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[] = {
312static struct gpio_led_platform_data dns323ab_led_data = { 291static 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
318static struct gpio_led_platform_data dns323c_led_data = { 297static 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
324static struct platform_device dns323_gpio_leds = { 303static struct platform_device dns323_gpio_leds = {
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}
296EXPORT_SYMBOL(orion_gpio_set_blink); 297EXPORT_SYMBOL(orion_gpio_set_blink);
297 298
299#define ORION_BLINK_HALF_PERIOD 100 /* ms */
300
301int 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}
319EXPORT_SYMBOL_GPL(orion_gpio_led_blink_set);
320
298 321
299/***************************************************************************** 322/*****************************************************************************
300 * Orion GPIO IRQ 323 * Orion GPIO IRQ
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 3abf30428bee..bec0c98ce41f 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -19,6 +19,8 @@
19 */ 19 */
20void orion_gpio_set_unused(unsigned pin); 20void orion_gpio_set_unused(unsigned pin);
21void orion_gpio_set_blink(unsigned pin, int blink); 21void orion_gpio_set_blink(unsigned pin, int blink);
22int orion_gpio_led_blink_set(unsigned gpio, int state,
23 unsigned long *delay_on, unsigned long *delay_off);
22 24
23#define GPIO_INPUT_OK (1 << 0) 25#define GPIO_INPUT_OK (1 << 0)
24#define GPIO_OUTPUT_OK (1 << 1) 26#define GPIO_OUTPUT_OK (1 << 1)