diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2009-06-29 07:11:50 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-06-29 06:19:27 -0400 |
commit | 59c5fe6d848cae8fd51498d17532f5aad3866f98 (patch) | |
tree | f9975ae202432a8699a86773180b17fbfab73df8 /arch | |
parent | 9a24ee03aebc55cec00cc388b6727bff24ed433f (diff) |
[ARM] 5562/2: at91: add gpio button support for at91sam9g20ek
This adds input keyboard gpio support on at91sam9g20ek board.
It adds button 3 and 4.
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')
-rw-r--r-- | arch/arm/mach-at91/board-sam9g20ek.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index cc270beadd5d..a55398ed1211 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
26 | #include <linux/spi/at73c213.h> | 26 | #include <linux/spi/at73c213.h> |
27 | #include <linux/gpio_keys.h> | ||
28 | #include <linux/input.h> | ||
27 | #include <linux/clk.h> | 29 | #include <linux/clk.h> |
28 | 30 | ||
29 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
@@ -218,6 +220,56 @@ static struct gpio_led ek_leds[] = { | |||
218 | } | 220 | } |
219 | }; | 221 | }; |
220 | 222 | ||
223 | |||
224 | /* | ||
225 | * GPIO Buttons | ||
226 | */ | ||
227 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
228 | static struct gpio_keys_button ek_buttons[] = { | ||
229 | { | ||
230 | .gpio = AT91_PIN_PA30, | ||
231 | .code = BTN_3, | ||
232 | .desc = "Button 3", | ||
233 | .active_low = 1, | ||
234 | .wakeup = 1, | ||
235 | }, | ||
236 | { | ||
237 | .gpio = AT91_PIN_PA31, | ||
238 | .code = BTN_4, | ||
239 | .desc = "Button 4", | ||
240 | .active_low = 1, | ||
241 | .wakeup = 1, | ||
242 | } | ||
243 | }; | ||
244 | |||
245 | static struct gpio_keys_platform_data ek_button_data = { | ||
246 | .buttons = ek_buttons, | ||
247 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
248 | }; | ||
249 | |||
250 | static struct platform_device ek_button_device = { | ||
251 | .name = "gpio-keys", | ||
252 | .id = -1, | ||
253 | .num_resources = 0, | ||
254 | .dev = { | ||
255 | .platform_data = &ek_button_data, | ||
256 | } | ||
257 | }; | ||
258 | |||
259 | static void __init ek_add_device_buttons(void) | ||
260 | { | ||
261 | at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */ | ||
262 | at91_set_deglitch(AT91_PIN_PA30, 1); | ||
263 | at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */ | ||
264 | at91_set_deglitch(AT91_PIN_PA31, 1); | ||
265 | |||
266 | platform_device_register(&ek_button_device); | ||
267 | } | ||
268 | #else | ||
269 | static void __init ek_add_device_buttons(void) {} | ||
270 | #endif | ||
271 | |||
272 | |||
221 | static struct i2c_board_info __initdata ek_i2c_devices[] = { | 273 | static struct i2c_board_info __initdata ek_i2c_devices[] = { |
222 | { | 274 | { |
223 | I2C_BOARD_INFO("24c512", 0x50), | 275 | I2C_BOARD_INFO("24c512", 0x50), |
@@ -245,6 +297,8 @@ static void __init ek_board_init(void) | |||
245 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); | 297 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); |
246 | /* LEDs */ | 298 | /* LEDs */ |
247 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 299 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); |
300 | /* Push Buttons */ | ||
301 | ek_add_device_buttons(); | ||
248 | /* PCK0 provides MCLK to the WM8731 */ | 302 | /* PCK0 provides MCLK to the WM8731 */ |
249 | at91_set_B_periph(AT91_PIN_PC1, 0); | 303 | at91_set_B_periph(AT91_PIN_PC1, 0); |
250 | /* SSC (for WM8731) */ | 304 | /* SSC (for WM8731) */ |