From d34f089710cda2f0cdfd18b09b1451c0601c685f Mon Sep 17 00:00:00 2001 From: Martin Fouts Date: Thu, 18 Aug 2005 01:47:05 -0700 Subject: [PATCH] [PATCH] ARM: OMAP: Enable Keypad input on P2 This patch allows the P2 keypad to operate if selected --- drivers/input/keyboard/Kconfig | 2 +- drivers/input/keyboard/omap-keypad.c | 44 ++++++++++++++++++++++++++-- include/linux/input.h | 20 ++++++++++--- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 2c8413337de..2f8419d6e62 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -186,7 +186,7 @@ endif config KEYBOARD_OMAP tristate "TI OMAP keypad support" - depends on (ARCH_OMAP1510 || ARCH_OMAP16XX) && INPUT && INPUT_KEYBOARD + depends on (ARCH_OMAP730 || ARCH_OMAP1510 || ARCH_OMAP16XX) && INPUT && INPUT_KEYBOARD help Say Y here if you want to use the OMAP keypad. diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index d9bc34f45ae..34f7dab92f9 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c @@ -46,6 +46,7 @@ static void omap_kp_timer(unsigned long); static struct input_dev omap_kp_dev; static unsigned char keypad_state[8]; +static unsigned int keypad_irq = INT_KEYBOARD; static struct timer_list kp_timer; DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); @@ -130,6 +131,40 @@ static int osk_keymap[] = { 0 }; +static int p2_keymap[] = { + KEY(0,0,KEY_UP), + KEY(0,1,KEY_RIGHT), + KEY(0,2,KEY_LEFT), + KEY(0,3,KEY_DOWN), + KEY(0,4,KEY_CENTER), + KEY(0,5,KEY_0_5), + KEY(1,0,KEY_SOFT2), + KEY(1,1,KEY_SEND), + KEY(1,2,KEY_END), + KEY(1,3,KEY_VOLUMEDOWN), + KEY(1,4,KEY_VOLUMEUP), + KEY(1,5,KEY_RECORD), + KEY(2,0,KEY_SOFT1), + KEY(2,1,KEY_3), + KEY(2,2,KEY_6), + KEY(2,3,KEY_9), + KEY(2,4,KEY_SHARP), + KEY(2,5,KEY_2_5), + KEY(3,0,KEY_BACK), + KEY(3,1,KEY_2), + KEY(3,2,KEY_5), + KEY(3,3,KEY_8), + KEY(3,4,KEY_0), + KEY(3,5,KEY_HEADSETHOOK), + KEY(4,0,KEY_HOME), + KEY(4,1,KEY_1), + KEY(4,2,KEY_4), + KEY(4,3,KEY_7), + KEY(4,4,KEY_STAR), + KEY(4,5,KEY_POWER), + 0 +}; + static int *keymap; static irqreturn_t omap_kp_interrupt(int irq, void *dev_id, @@ -159,7 +194,7 @@ static void omap_kp_scan_keypad(unsigned char *state) if (machine_is_omap_osk() || machine_is_omap_h2() || machine_is_omap_h3()) { udelay(9); } else { - udelay(2); + udelay(4); } state[col] = ~omap_readw(OMAP_MPUIO_BASE + OMAP_MPUIO_KBR_LATCH) & 0xff; @@ -247,6 +282,9 @@ static int __init omap_kp_init(void) keymap = innovator_keymap; } else if (machine_is_omap_osk()) { keymap = osk_keymap; + } else if (machine_is_omap_perseus2()) { + keymap = p2_keymap; + keypad_irq = INT_730_MPUIO_KEYPAD; } else { keymap = test_keymap; } @@ -256,7 +294,7 @@ static int __init omap_kp_init(void) /* get the irq and init timer*/ tasklet_enable(&kp_tasklet); - if (request_irq(INT_KEYBOARD, omap_kp_interrupt, 0, + if (request_irq(keypad_irq, omap_kp_interrupt, 0, "omap-keypad", 0) < 0) return -EINVAL; @@ -297,7 +335,7 @@ static void __exit omap_kp_exit(void) tasklet_disable(&kp_tasklet); omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); - free_irq(INT_KEYBOARD, 0); + free_irq(keypad_irq, 0); del_timer_sync(&kp_timer); /* unregister everything */ diff --git a/include/linux/input.h b/include/linux/input.h index bdc53c6cc96..595649e995f 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -328,10 +328,22 @@ struct input_absinfo { #define KEY_BRIGHTNESSUP 225 #define KEY_MEDIA 226 -#define KEY_SWITCHVIDEOMODE 227 -#define KEY_KBDILLUMTOGGLE 228 -#define KEY_KBDILLUMDOWN 229 -#define KEY_KBDILLUMUP 230 + +/*Zeus: these keys are defined for OMAP730 Perseus2*/ +#define KEY_STAR 227 +#define KEY_SHARP 228 +#define KEY_SOFT1 229 +#define KEY_SOFT2 230 +#define KEY_SEND 231 +#define KEY_CENTER 232 +#define KEY_HEADSETHOOK 233 +#define KEY_0_5 234 +#define KEY_2_5 235 + +#define KEY_SWITCHVIDEOMODE 236 +#define KEY_KBDILLUMTOGGLE 237 +#define KEY_KBDILLUMDOWN 238 +#define KEY_KBDILLUMUP 239 #define KEY_UNKNOWN 240 -- 2.41.1