From 686517f616a0416f1e8f13f995c652194c219886 Mon Sep 17 00:00:00 2001 From: Juha Yrjola Date: Mon, 13 Feb 2006 19:57:40 +0200 Subject: [PATCH] ARM: OMAP: Fix a bug related to key grouping in keypad driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The key group bits were left set in the key that we report to the input layer. Signed-off-by: Juha Yrjölä --- drivers/input/keyboard/omap-keypad.c | 30 ++++++---------------------- include/asm-arm/arch-omap/keypad.h | 8 ++++---- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 1ad96b706cb..c7cbd855efd 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c @@ -62,21 +62,6 @@ struct omap_kp { DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); -#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val)) - -static int test_keymap[] = { - KEY(0, 0, KEY_F4), - KEY(1, 0, KEY_LEFT), - KEY(2, 0, KEY_F1), - KEY(0, 1, KEY_DOWN), - KEY(1, 1, KEY_ENTER), - KEY(2, 1, KEY_UP), - KEY(0, 2, KEY_F3), - KEY(1, 2, KEY_RIGHT), - KEY(2, 2, KEY_F2), - 0 -}; - static int *keymap; static unsigned int *row_gpios; static unsigned int *col_gpios; @@ -221,8 +206,8 @@ static void omap_kp_tasklet(unsigned long data) continue; kp_cur_group = key & GROUP_MASK; - input_report_key(omap_kp_data->input, key, - new_state[col] & (1 << row)); + input_report_key(omap_kp_data->input, key & ~GROUP_MASK, + !!(new_state[col] & (1 << row))); #endif } } @@ -306,8 +291,8 @@ static int __init omap_kp_probe(struct platform_device *pdev) struct omap_kp_platform_data *pdata = pdev->dev.platform_data; int i; - if (!pdata->rows || !pdata->cols) { - printk(KERN_ERR "No rows and cols from pdata\n"); + if (!pdata->rows || !pdata->cols || !pdata->keymap) { + printk(KERN_ERR "No rows, cols or keymap from pdata\n"); return -EINVAL; } @@ -327,10 +312,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) if (!cpu_is_omap24xx()) omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); - if (!pdata->keymap) - keymap = test_keymap; - else - keymap = pdata->keymap; + keymap = pdata->keymap; if (pdata->rep) set_bit(EV_REP, input_dev->evbit); @@ -386,7 +368,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) /* setup input device */ set_bit(EV_KEY, input_dev->evbit); for (i = 0; keymap[i] != 0; i++) - set_bit(keymap[i] & 0x00ffffff, input_dev->keybit); + set_bit(keymap[i] & KEY_MAX, input_dev->keybit); input_dev->name = "omap-keypad"; input_dev->cdev.dev = &pdev->dev; input_dev->private = omap_kp; diff --git a/include/asm-arm/arch-omap/keypad.h b/include/asm-arm/arch-omap/keypad.h index 548515d503e..8a023a984ac 100644 --- a/include/asm-arm/arch-omap/keypad.h +++ b/include/asm-arm/arch-omap/keypad.h @@ -24,10 +24,10 @@ struct omap_kp_platform_data { * keys pressed in the same group are considered as pressed. This is * in order to workaround certain crappy HW designs that produce ghost * keypresses. */ -#define GROUP_0 (0 << 10) -#define GROUP_1 (1 << 10) -#define GROUP_2 (2 << 10) -#define GROUP_3 (3 << 10) +#define GROUP_0 (0 << 16) +#define GROUP_1 (1 << 16) +#define GROUP_2 (2 << 16) +#define GROUP_3 (3 << 16) #define GROUP_MASK GROUP_3 #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val)) -- 2.41.1