aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2007-07-08 06:49:53 -0400
committerRichard Purdie <rpurdie@rpsys.net>2007-07-15 20:15:51 -0400
commitf9f451d9cac24b9bd49947d1c6971f3d689381fa (patch)
treea6bcb371f5d9df816860083eecb06050d5e9dff8 /arch/avr32
parente3986f6380558b84fef1e7ce7a29fed5bb090721 (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')
-rw-r--r--arch/avr32/boards/atngw100/setup.c31
-rw-r--r--arch/avr32/configs/atngw100_defconfig16
2 files changed, 46 insertions, 1 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 6c4dc0a00e9f..2edcecdea8bd 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. */
26struct tag *bootloader_tags __initdata; 28struct 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
105static 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
113static const struct gpio_led_platform_data ngw_led_data = {
114 .num_leds = ARRAY_SIZE(ngw_leds),
115 .leds = (void *) ngw_leds,
116};
117
118static 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
103static int __init atngw100_init(void) 126static 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}
121postcore_initcall(atngw100_init); 152postcore_initcall(atngw100_init);
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index 49493ad3b5a9..b799a68ffd97 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_defconfig
@@ -712,7 +712,21 @@ CONFIG_SPI_ATMEL=y
712# 712#
713# LED devices 713# LED devices
714# 714#
715# CONFIG_NEW_LEDS is not set 715CONFIG_NEW_LEDS=y
716CONFIG_LEDS_CLASS=y
717
718#
719# LED drivers
720#
721CONFIG_LEDS_GPIO=y
722
723#
724# LED Triggers
725#
726CONFIG_LEDS_TRIGGERS=y
727CONFIG_LEDS_TRIGGER_TIMER=y
728CONFIG_LEDS_TRIGGER_HEARTBEAT=y
729
716 730
717# 731#
718# LED drivers 732# LED drivers