diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2007-07-08 06:49:53 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-07-15 20:15:51 -0400 |
commit | f9f451d9cac24b9bd49947d1c6971f3d689381fa (patch) | |
tree | a6bcb371f5d9df816860083eecb06050d5e9dff8 /arch/avr32/boards | |
parent | e3986f6380558b84fef1e7ce7a29fed5bb090721 (diff) |
leds: leds-gpio for ngw100
Add GPIO leds to the NGW100 platform and its defconfig.
Access through /sys/class/leds/{a,b,sys}/* files; one
defaults to a heartbeat.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 6c4dc0a00e9..2edcecdea8b 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/linkage.h> | 13 | #include <linux/linkage.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/leds.h> | ||
16 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
17 | 18 | ||
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
@@ -21,6 +22,7 @@ | |||
21 | #include <asm/arch/at32ap7000.h> | 22 | #include <asm/arch/at32ap7000.h> |
22 | #include <asm/arch/board.h> | 23 | #include <asm/arch/board.h> |
23 | #include <asm/arch/init.h> | 24 | #include <asm/arch/init.h> |
25 | #include <asm/arch/portmux.h> | ||
24 | 26 | ||
25 | /* Initialized by bootloader-specific startup code. */ | 27 | /* Initialized by bootloader-specific startup code. */ |
26 | struct tag *bootloader_tags __initdata; | 28 | struct tag *bootloader_tags __initdata; |
@@ -100,8 +102,31 @@ void __init setup_board(void) | |||
100 | at32_setup_serial_console(0); | 102 | at32_setup_serial_console(0); |
101 | } | 103 | } |
102 | 104 | ||
105 | static const struct gpio_led ngw_leds[] = { | ||
106 | { .name = "sys", .gpio = GPIO_PIN_PA(16), .active_low = 1, | ||
107 | .default_trigger = "heartbeat", | ||
108 | }, | ||
109 | { .name = "a", .gpio = GPIO_PIN_PA(19), .active_low = 1, }, | ||
110 | { .name = "b", .gpio = GPIO_PIN_PE(19), .active_low = 1, }, | ||
111 | }; | ||
112 | |||
113 | static const struct gpio_led_platform_data ngw_led_data = { | ||
114 | .num_leds = ARRAY_SIZE(ngw_leds), | ||
115 | .leds = (void *) ngw_leds, | ||
116 | }; | ||
117 | |||
118 | static struct platform_device ngw_gpio_leds = { | ||
119 | .name = "leds-gpio", | ||
120 | .id = -1, | ||
121 | .dev = { | ||
122 | .platform_data = (void *) &ngw_led_data, | ||
123 | } | ||
124 | }; | ||
125 | |||
103 | static int __init atngw100_init(void) | 126 | static int __init atngw100_init(void) |
104 | { | 127 | { |
128 | unsigned i; | ||
129 | |||
105 | /* | 130 | /* |
106 | * ATNGW100 uses 16-bit SDRAM interface, so we don't need to | 131 | * ATNGW100 uses 16-bit SDRAM interface, so we don't need to |
107 | * reserve any pins for it. | 132 | * reserve any pins for it. |
@@ -116,6 +141,12 @@ static int __init atngw100_init(void) | |||
116 | 141 | ||
117 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | 142 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); |
118 | 143 | ||
144 | for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { | ||
145 | at32_select_gpio(ngw_leds[i].gpio, | ||
146 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
147 | } | ||
148 | platform_device_register(&ngw_gpio_leds); | ||
149 | |||
119 | return 0; | 150 | return 0; |
120 | } | 151 | } |
121 | postcore_initcall(atngw100_init); | 152 | postcore_initcall(atngw100_init); |