diff options
author | Albert Aribaud <albert.aribaud@free.fr> | 2008-09-19 15:06:25 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2008-09-25 16:27:22 -0400 |
commit | 3d014b01e54ce08d15a598f0bfb3ce597f14ca03 (patch) | |
tree | c9a4bf7ad9693d92d9d2ee0599633b877f9d9dc3 /arch/arm/mach-orion5x | |
parent | 2d0c9e735ab8413d3cf29576ab14e07f7aa8eab9 (diff) |
[ARM] EDMINIV2: add support for LED and power button
This patch provides standard GPIO LED control
for the ED Mini V2, with software blinking only
(CPLD hardware blinking capability is not used).
This patch also provides status of the power
button as a standard GPIO input event.
Signed-off-by: Albert Aribaud <albert.aribaud@free.fr>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r-- | arch/arm/mach-orion5x/edmini_v2-setup.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/edmini_v2-setup.c b/arch/arm/mach-orion5x/edmini_v2-setup.c index 2d67591dbce6..b24ee0c2cd61 100644 --- a/arch/arm/mach-orion5x/edmini_v2-setup.c +++ b/arch/arm/mach-orion5x/edmini_v2-setup.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/mtd/physmap.h> | 26 | #include <linux/mtd/physmap.h> |
27 | #include <linux/mv643xx_eth.h> | 27 | #include <linux/mv643xx_eth.h> |
28 | #include <linux/leds.h> | ||
29 | #include <linux/gpio_keys.h> | ||
30 | #include <linux/input.h> | ||
28 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
29 | #include <linux/ata_platform.h> | 32 | #include <linux/ata_platform.h> |
30 | #include <linux/gpio.h> | 33 | #include <linux/gpio.h> |
@@ -120,6 +123,61 @@ static struct mv_sata_platform_data edmini_v2_sata_data = { | |||
120 | }; | 123 | }; |
121 | 124 | ||
122 | /***************************************************************************** | 125 | /***************************************************************************** |
126 | * GPIO LED (simple - doesn't use hardware blinking support) | ||
127 | ****************************************************************************/ | ||
128 | |||
129 | #define EDMINI_V2_GPIO_LED_POWER 16 | ||
130 | |||
131 | static struct gpio_led edmini_v2_leds[] = { | ||
132 | { | ||
133 | .name = "power:blue", | ||
134 | .gpio = EDMINI_V2_GPIO_LED_POWER, | ||
135 | .active_low = 1, | ||
136 | }, | ||
137 | }; | ||
138 | |||
139 | static struct gpio_led_platform_data edmini_v2_led_data = { | ||
140 | .num_leds = ARRAY_SIZE(edmini_v2_leds), | ||
141 | .leds = edmini_v2_leds, | ||
142 | }; | ||
143 | |||
144 | static struct platform_device edmini_v2_gpio_leds = { | ||
145 | .name = "leds-gpio", | ||
146 | .id = -1, | ||
147 | .dev = { | ||
148 | .platform_data = &edmini_v2_led_data, | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | /**************************************************************************** | ||
153 | * GPIO key | ||
154 | ****************************************************************************/ | ||
155 | |||
156 | #define EDMINI_V2_GPIO_KEY_POWER 18 | ||
157 | |||
158 | static struct gpio_keys_button edmini_v2_buttons[] = { | ||
159 | { | ||
160 | .code = KEY_POWER, | ||
161 | .gpio = EDMINI_V2_GPIO_KEY_POWER, | ||
162 | .desc = "Power Button", | ||
163 | .active_low = 0, | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | static struct gpio_keys_platform_data edmini_v2_button_data = { | ||
168 | .buttons = edmini_v2_buttons, | ||
169 | .nbuttons = ARRAY_SIZE(edmini_v2_buttons), | ||
170 | }; | ||
171 | |||
172 | static struct platform_device edmini_v2_gpio_buttons = { | ||
173 | .name = "gpio-keys", | ||
174 | .id = -1, | ||
175 | .dev = { | ||
176 | .platform_data = &edmini_v2_button_data, | ||
177 | }, | ||
178 | }; | ||
179 | |||
180 | /***************************************************************************** | ||
123 | * General Setup | 181 | * General Setup |
124 | ****************************************************************************/ | 182 | ****************************************************************************/ |
125 | static struct orion5x_mpp_mode edminiv2_mpp_modes[] __initdata = { | 183 | static struct orion5x_mpp_mode edminiv2_mpp_modes[] __initdata = { |
@@ -170,6 +228,8 @@ static void __init edmini_v2_init(void) | |||
170 | orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE, | 228 | orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE, |
171 | EDMINI_V2_NOR_BOOT_SIZE); | 229 | EDMINI_V2_NOR_BOOT_SIZE); |
172 | platform_device_register(&edmini_v2_nor_flash); | 230 | platform_device_register(&edmini_v2_nor_flash); |
231 | platform_device_register(&edmini_v2_gpio_leds); | ||
232 | platform_device_register(&edmini_v2_gpio_buttons); | ||
173 | 233 | ||
174 | pr_notice("edmini_v2: USB device port, flash write and power-off " | 234 | pr_notice("edmini_v2: USB device port, flash write and power-off " |
175 | "are not yet supported.\n"); | 235 | "are not yet supported.\n"); |