]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-apollon-keys.c
e3f74e62a78873bddf286762e9d8df138683ab01
[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 <mach/gpio.h>
19 #include <mach/mux.h>
20
21 #define SW_ENTER_GPIO16         16
22 #define SW_UP_GPIO17            17
23 #define SW_DOWN_GPIO58          58
24 #define SW_LEFT_GPIO95          95
25 #define SW_RIGHT_GPIO96         96
26 #define SW_ESC_GPIO97           97
27
28 static struct gpio_keys_button apollon_gpio_keys_buttons[] = {
29         [0] = {
30                 .code           = KEY_ENTER,
31                 .gpio           = SW_ENTER_GPIO16,
32                 .desc           = "enter sw",
33         },
34         [1] = {
35                 .code           = KEY_UP,
36                 .gpio           = SW_UP_GPIO17,
37                 .desc           = "up sw",
38         },
39         [2] = {
40                 .code           = KEY_DOWN,
41                 .gpio           = SW_DOWN_GPIO58,
42                 .desc           = "down sw",
43         },
44         [3] = {
45                 .code           = KEY_LEFT,
46                 .gpio           = SW_LEFT_GPIO95,
47                 .desc           = "left sw",
48         },
49         [4] = {
50                 .code           = KEY_RIGHT,
51                 .gpio           = SW_RIGHT_GPIO96,
52                 .desc           = "right sw",
53         },
54         [5] = {
55                 .code           = KEY_ESC,
56                 .gpio           = SW_ESC_GPIO97,
57                 .desc           = "esc sw",
58         },
59 };
60
61 static struct gpio_keys_platform_data apollon_gpio_keys = {
62         .buttons                = apollon_gpio_keys_buttons,
63         .nbuttons               = ARRAY_SIZE(apollon_gpio_keys_buttons),
64 };
65
66 static struct platform_device apollon_gpio_keys_device = {
67         .name                   = "gpio-keys",
68         .id                     = -1,
69         .dev                    = {
70                 .platform_data  = &apollon_gpio_keys,
71         },
72 };
73
74 static void __init apollon_sw_init(void)
75 {
76         /* Enter SW - Y11 */
77         omap_cfg_reg(Y11_242X_GPIO16);
78         /* Up SW - AA12 */
79         omap_cfg_reg(AA12_242X_GPIO17);
80         /* Down SW - AA8 */
81         omap_cfg_reg(AA8_242X_GPIO58);
82
83         if (apollon_plus()) {
84                 /* Left SW - P18 */
85                 omap_cfg_reg(P18_24XX_GPIO95);
86                 /* Right SW - M18 */
87                 omap_cfg_reg(M18_24XX_GPIO96);
88                 /* Esc SW - L14 */
89                 omap_cfg_reg(L14_24XX_GPIO97);
90         } else
91                 apollon_gpio_keys.nbuttons = 3;
92 }
93
94 static int __init omap_apollon_keys_init(void)
95 {
96         apollon_sw_init();
97
98         return platform_device_register(&apollon_gpio_keys_device);
99 }
100
101 arch_initcall(omap_apollon_keys_init);