]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-apollon-keys.c
ARM: OMAP: Add apollon gpio keys using gpio-keys input
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-apollon-keys.c
1 /*
2  * linux/arch/arm/mach-omap2/board-apollon-keys.c
3  *
4  * Copyright (C) 2007 Samsung Electronics
5  * Author: Kyungmin Park <kyungmin.park@samsung.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/input.h>
16 #include <linux/gpio_keys.h>
17
18 #include <asm/arch/gpio.h>
19 #include <asm/arch/mux.h>
20
21 #define SW_ENTER_GPIO16         16
22 #define SW_UP_GPIO17            17
23 #define SW_DOWN_GPIO58          58
24
25 static struct gpio_keys_button apollon_gpio_keys_buttons[] = {
26         [0] = {
27                 .keycode        = KEY_ENTER,
28                 .gpio           = SW_ENTER_GPIO16,
29                 .desc           = "enter sw",
30         },
31         [1] = {
32                 .keycode        = KEY_UP,
33                 .gpio           = SW_UP_GPIO17,
34                 .desc           = "up sw",
35         },
36         [2] = {
37                 .keycode        = KEY_DOWN,
38                 .gpio           = SW_DOWN_GPIO58,
39                 .desc           = "down sw",
40         },
41 };
42
43 static struct gpio_keys_platform_data apollon_gpio_keys = {
44         .buttons                = apollon_gpio_keys_buttons,
45         .nbuttons               = ARRAY_SIZE(apollon_gpio_keys_buttons),
46 };
47
48 static struct platform_device apollon_gpio_keys_device = {
49         .name                   = "gpio-keys",
50         .id                     = -1,
51         .dev                    = {
52                 .platform_data  = &apollon_gpio_keys,
53         },
54 };
55
56 static void __init apollon_sw_init(void)
57 {
58         /* Enter SW - Y11 */
59         omap_cfg_reg(Y11_242X_GPIO16);
60         omap_request_gpio(SW_ENTER_GPIO16);
61         omap_set_gpio_direction(SW_ENTER_GPIO16, 1);
62         /* Up SW - AA12 */
63         omap_cfg_reg(AA12_242X_GPIO17);
64         omap_request_gpio(SW_UP_GPIO17);
65         omap_set_gpio_direction(SW_UP_GPIO17, 1);
66         /* Down SW - AA8 */
67         omap_cfg_reg(AA8_242X_GPIO58);
68         omap_request_gpio(SW_DOWN_GPIO58);
69         omap_set_gpio_direction(SW_DOWN_GPIO58, 1);
70 }
71
72 static int __init omap_apollon_keys_init(void)
73 {
74         apollon_sw_init();
75
76         return platform_device_register(&apollon_gpio_keys_device);
77 }
78
79 arch_initcall(omap_apollon_keys_init);