aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2009-06-24 12:13:47 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-06-27 06:03:29 -0400
commit226ddb9833a3c2f1087bfac70659d8e318d3c31f (patch)
tree31f12041baa3a596155790884b2e181e2d5bb665 /arch/arm/mach-at91
parent28d0325ce6e0a52f53d8af687e6427fee59004d3 (diff)
[ARM] 5564/1: at91: add gpio button and leds support for at91sam9rlek
This adds input keyboard gpio support on at91sam9rlek board. It adds button 1 and 2 (left and right click). It also adds gpio leds ds1, ds2 and ds3. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 35e12a49d1a6..9120d5d3a6fc 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -15,6 +15,8 @@
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/input.h>
19#include <linux/gpio_keys.h>
18 20
19#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
20 22
@@ -206,6 +208,79 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data;
206#endif 208#endif
207 209
208 210
211/*
212 * LEDs
213 */
214static struct gpio_led ek_leds[] = {
215 { /* "bottom" led, green, userled1 to be defined */
216 .name = "ds1",
217 .gpio = AT91_PIN_PD15,
218 .active_low = 1,
219 .default_trigger = "none",
220 },
221 { /* "bottom" led, green, userled2 to be defined */
222 .name = "ds2",
223 .gpio = AT91_PIN_PD16,
224 .active_low = 1,
225 .default_trigger = "none",
226 },
227 { /* "power" led, yellow */
228 .name = "ds3",
229 .gpio = AT91_PIN_PD14,
230 .default_trigger = "heartbeat",
231 }
232};
233
234
235/*
236 * GPIO Buttons
237 */
238#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
239static struct gpio_keys_button ek_buttons[] = {
240 {
241 .gpio = AT91_PIN_PB0,
242 .code = BTN_2,
243 .desc = "Right Click",
244 .active_low = 1,
245 .wakeup = 1,
246 },
247 {
248 .gpio = AT91_PIN_PB1,
249 .code = BTN_1,
250 .desc = "Left Click",
251 .active_low = 1,
252 .wakeup = 1,
253 }
254};
255
256static struct gpio_keys_platform_data ek_button_data = {
257 .buttons = ek_buttons,
258 .nbuttons = ARRAY_SIZE(ek_buttons),
259};
260
261static struct platform_device ek_button_device = {
262 .name = "gpio-keys",
263 .id = -1,
264 .num_resources = 0,
265 .dev = {
266 .platform_data = &ek_button_data,
267 }
268};
269
270static void __init ek_add_device_buttons(void)
271{
272 at91_set_gpio_input(AT91_PIN_PB1, 1); /* btn1 */
273 at91_set_deglitch(AT91_PIN_PB1, 1);
274 at91_set_gpio_input(AT91_PIN_PB0, 1); /* btn2 */
275 at91_set_deglitch(AT91_PIN_PB0, 1);
276
277 platform_device_register(&ek_button_device);
278}
279#else
280static void __init ek_add_device_buttons(void) {}
281#endif
282
283
209static void __init ek_board_init(void) 284static void __init ek_board_init(void)
210{ 285{
211 /* Serial */ 286 /* Serial */
@@ -224,6 +299,10 @@ static void __init ek_board_init(void)
224 at91_add_device_lcdc(&ek_lcdc_data); 299 at91_add_device_lcdc(&ek_lcdc_data);
225 /* Touch Screen Controller */ 300 /* Touch Screen Controller */
226 at91_add_device_tsadcc(); 301 at91_add_device_tsadcc();
302 /* LEDs */
303 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
304 /* Push Buttons */
305 ek_add_device_buttons();
227} 306}
228 307
229MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") 308MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")