diff options
Diffstat (limited to 'arch/arm/mach-at91/leds.c')
| -rw-r--r-- | arch/arm/mach-at91/leds.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index 0d5144973988..9cdcda500fe8 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
| @@ -14,11 +14,62 @@ | |||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | 15 | ||
| 16 | #include <asm/mach-types.h> | 16 | #include <asm/mach-types.h> |
| 17 | #include <asm/leds.h> | ||
| 18 | #include <asm/arch/board.h> | 17 | #include <asm/arch/board.h> |
| 19 | #include <asm/arch/gpio.h> | 18 | #include <asm/arch/gpio.h> |
| 20 | 19 | ||
| 21 | 20 | ||
| 21 | /* ------------------------------------------------------------------------- */ | ||
| 22 | |||
| 23 | #if defined(CONFIG_NEW_LEDS) | ||
| 24 | |||
| 25 | #include <linux/platform_device.h> | ||
| 26 | |||
| 27 | /* | ||
| 28 | * New cross-platform LED support. | ||
| 29 | */ | ||
| 30 | |||
| 31 | static struct gpio_led_platform_data led_data; | ||
| 32 | |||
| 33 | static struct platform_device at91_leds = { | ||
| 34 | .name = "leds-gpio", | ||
| 35 | .id = -1, | ||
| 36 | .dev.platform_data = &led_data, | ||
| 37 | }; | ||
| 38 | |||
| 39 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) | ||
| 40 | { | ||
| 41 | int i; | ||
| 42 | |||
| 43 | if (!nr) | ||
| 44 | return; | ||
| 45 | |||
| 46 | for (i = 0; i < nr; i++) | ||
| 47 | at91_set_gpio_output(leds[i].gpio, leds[i].active_low); | ||
| 48 | |||
| 49 | led_data.leds = leds; | ||
| 50 | led_data.num_leds = nr; | ||
| 51 | platform_device_register(&at91_leds); | ||
| 52 | } | ||
| 53 | |||
| 54 | #else | ||
| 55 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} | ||
| 56 | #endif | ||
| 57 | |||
| 58 | |||
| 59 | /* ------------------------------------------------------------------------- */ | ||
| 60 | |||
| 61 | #if defined(CONFIG_LEDS) | ||
| 62 | |||
| 63 | #include <asm/leds.h> | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Old ARM-specific LED framework; not fully functional when generic time is | ||
| 67 | * in use. | ||
| 68 | */ | ||
| 69 | |||
| 70 | static u8 at91_leds_cpu; | ||
| 71 | static u8 at91_leds_timer; | ||
| 72 | |||
| 22 | static inline void at91_led_on(unsigned int led) | 73 | static inline void at91_led_on(unsigned int led) |
| 23 | { | 74 | { |
| 24 | at91_set_gpio_value(led, 0); | 75 | at91_set_gpio_value(led, 0); |
| @@ -93,3 +144,18 @@ static int __init leds_init(void) | |||
| 93 | } | 144 | } |
| 94 | 145 | ||
| 95 | __initcall(leds_init); | 146 | __initcall(leds_init); |
| 147 | |||
| 148 | |||
| 149 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
| 150 | { | ||
| 151 | /* Enable GPIO to access the LEDs */ | ||
| 152 | at91_set_gpio_output(cpu_led, 1); | ||
| 153 | at91_set_gpio_output(timer_led, 1); | ||
| 154 | |||
| 155 | at91_leds_cpu = cpu_led; | ||
| 156 | at91_leds_timer = timer_led; | ||
| 157 | } | ||
| 158 | |||
| 159 | #else | ||
| 160 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
| 161 | #endif | ||
