2 * board-omap3pandora-input.c
4 * Input mapping for Pandora handheld console
5 * Author: Grazvydas Ignotas <notasas@gmail.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 #include <linux/platform_device.h>
24 #include <linux/input.h>
25 #include <linux/gpio_keys.h>
27 #include <mach/hardware.h>
28 #include <mach/keypad.h>
29 #include <mach/gpio.h>
31 /* hardware debounce, (value + 1) * 31us */
32 #define GPIO_DEBOUNCE_TIME 0x7f
34 static int omap3pandora_keymap[] = {
38 KEY(0, 2, KEY_BACKSPACE),
67 KEY(3, 7, KEY_LEFTSHIFT),
82 struct twl4030_keypad_data omap3pandora_kp_data = {
85 .keymap = omap3pandora_keymap,
86 .keymapsize = ARRAY_SIZE(omap3pandora_keymap),
88 .irq = TWL4030_MODIRQ_KEYPAD,
91 static struct gpio_keys_button gpio_buttons[] = {
111 .desc = "dpad right",
136 .desc = "shoulder l",
141 .desc = "shoulder l2",
146 .desc = "shoulder r",
151 .desc = "shoulder r2",
158 .code = KEY_LEFTCTRL,
177 .desc = "lid switch",
181 static struct gpio_keys_platform_data gpio_key_info = {
182 .buttons = gpio_buttons,
183 .nbuttons = ARRAY_SIZE(gpio_buttons),
186 static struct platform_device omap3pandora_keys_gpio = {
190 .platform_data = &gpio_key_info,
194 void __init omap3pandora_input_init(void)
198 for (i = 0; i < ARRAY_SIZE(gpio_buttons); i++)
199 omap_set_gpio_debounce(gpio_buttons[i].gpio, 1);
201 /* set debounce time for banks 4 and 6 */
202 omap_set_gpio_debounce_time(32 * 3, GPIO_DEBOUNCE_TIME);
203 omap_set_gpio_debounce_time(32 * 5, GPIO_DEBOUNCE_TIME);
205 ret = platform_device_register(&omap3pandora_keys_gpio);
207 printk(KERN_ERR "Failed to register gpio-keys\n");