summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 11:22:01 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 11:22:01 -0700
commitd7f5e3df3574c6e38b99f5fe22f15540b2b9811d (patch)
tree75fc060628490d4bc78dd3b92635b8437b6e4290 /arch
parent2fe83b3ad12d43799af5f3156886eca443a88bac (diff)
parentf8a7c6fe14f556ca8eeddce258cb21392d0c3a2f (diff)
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds: leds: Convert from struct class_device to struct device leds: leds-gpio for ngw100 leds: Add warning printks in error paths leds: Fix trigger unregister_simple if register_simple fails leds: Use menuconfig objects II - LED leds: Teach leds-gpio to handle timer-unsafe GPIOs leds: Add generic GPIO LED driver
Diffstat (limited to 'arch')
-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 6c4dc0a00e9..2edcecdea8b 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -13,6 +13,7 @@
#include <linux/linkage.h>
#include <linux/platform_device.h>
#include <linux/types.h>
+#include <linux/leds.h>
#include <linux/spi/spi.h>
#include <asm/io.h>
@@ -21,6 +22,7 @@
#include <asm/arch/at32ap7000.h>
#include <asm/arch/board.h>
#include <asm/arch/init.h>
+#include <asm/arch/portmux.h>
/* Initialized by bootloader-specific startup code. */
struct tag *bootloader_tags __initdata;
@@ -100,8 +102,31 @@ void __init setup_board(void)
at32_setup_serial_console(0);
}
+static const struct gpio_led ngw_leds[] = {
+ { .name = "sys", .gpio = GPIO_PIN_PA(16), .active_low = 1,
+ .default_trigger = "heartbeat",
+ },
+ { .name = "a", .gpio = GPIO_PIN_PA(19), .active_low = 1, },
+ { .name = "b", .gpio = GPIO_PIN_PE(19), .active_low = 1, },
+};
+
+static const struct gpio_led_platform_data ngw_led_data = {
+ .num_leds = ARRAY_SIZE(ngw_leds),
+ .leds = (void *) ngw_leds,
+};
+
+static struct platform_device ngw_gpio_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = (void *) &ngw_led_data,
+ }
+};
+
static int __init atngw100_init(void)
{
+ unsigned i;
+
/*
* ATNGW100 uses 16-bit SDRAM interface, so we don't need to
* reserve any pins for it.
@@ -116,6 +141,12 @@ static int __init atngw100_init(void)
at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
+ for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) {
+ at32_select_gpio(ngw_leds[i].gpio,
+ AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
+ }
+ platform_device_register(&ngw_gpio_leds);
+
return 0;
}
postcore_initcall(atngw100_init);
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index 49493ad3b5a..b799a68ffd9 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_defconfig
@@ -712,7 +712,21 @@ CONFIG_SPI_ATMEL=y
#
# LED devices
#
-# CONFIG_NEW_LEDS is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+CONFIG_LEDS_GPIO=y
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+
#
# LED drivers