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