aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/omap-keypad.c41
-rw-r--r--drivers/input/serio/Kconfig1
2 files changed, 19 insertions, 23 deletions
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index a72e61ddca91..0e2a19cb43d8 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -65,7 +65,6 @@ struct omap_kp {
65 65
66static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); 66static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
67 67
68static int *keymap;
69static unsigned int *row_gpios; 68static unsigned int *row_gpios;
70static unsigned int *col_gpios; 69static unsigned int *col_gpios;
71 70
@@ -162,20 +161,11 @@ static void omap_kp_scan_keypad(struct omap_kp *omap_kp, unsigned char *state)
162 } 161 }
163} 162}
164 163
165static inline int omap_kp_find_key(int col, int row)
166{
167 int i, key;
168
169 key = KEY(col, row, 0);
170 for (i = 0; keymap[i] != 0; i++)
171 if ((keymap[i] & 0xff000000) == key)
172 return keymap[i] & 0x00ffffff;
173 return -1;
174}
175
176static void omap_kp_tasklet(unsigned long data) 164static void omap_kp_tasklet(unsigned long data)
177{ 165{
178 struct omap_kp *omap_kp_data = (struct omap_kp *) data; 166 struct omap_kp *omap_kp_data = (struct omap_kp *) data;
167 unsigned short *keycodes = omap_kp_data->input->keycode;
168 unsigned int row_shift = get_count_order(omap_kp_data->cols);
179 unsigned char new_state[8], changed, key_down = 0; 169 unsigned char new_state[8], changed, key_down = 0;
180 int col, row; 170 int col, row;
181 int spurious = 0; 171 int spurious = 0;
@@ -199,7 +189,7 @@ static void omap_kp_tasklet(unsigned long data)
199 row, (new_state[col] & (1 << row)) ? 189 row, (new_state[col] & (1 << row)) ?
200 "pressed" : "released"); 190 "pressed" : "released");
201#else 191#else
202 key = omap_kp_find_key(col, row); 192 key = keycodes[MATRIX_SCAN_CODE(row, col, row_shift)];
203 if (key < 0) { 193 if (key < 0) {
204 printk(KERN_WARNING 194 printk(KERN_WARNING
205 "omap-keypad: Spurious key event %d-%d\n", 195 "omap-keypad: Spurious key event %d-%d\n",
@@ -298,13 +288,18 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
298 struct input_dev *input_dev; 288 struct input_dev *input_dev;
299 struct omap_kp_platform_data *pdata = pdev->dev.platform_data; 289 struct omap_kp_platform_data *pdata = pdev->dev.platform_data;
300 int i, col_idx, row_idx, irq_idx, ret; 290 int i, col_idx, row_idx, irq_idx, ret;
291 unsigned int row_shift, keycodemax;
301 292
302 if (!pdata->rows || !pdata->cols || !pdata->keymap) { 293 if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
303 printk(KERN_ERR "No rows, cols or keymap from pdata\n"); 294 printk(KERN_ERR "No rows, cols or keymap_data from pdata\n");
304 return -EINVAL; 295 return -EINVAL;
305 } 296 }
306 297
307 omap_kp = kzalloc(sizeof(struct omap_kp), GFP_KERNEL); 298 row_shift = get_count_order(pdata->cols);
299 keycodemax = pdata->rows << row_shift;
300
301 omap_kp = kzalloc(sizeof(struct omap_kp) +
302 keycodemax * sizeof(unsigned short), GFP_KERNEL);
308 input_dev = input_allocate_device(); 303 input_dev = input_allocate_device();
309 if (!omap_kp || !input_dev) { 304 if (!omap_kp || !input_dev) {
310 kfree(omap_kp); 305 kfree(omap_kp);
@@ -320,7 +315,9 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
320 if (!cpu_is_omap24xx()) 315 if (!cpu_is_omap24xx())
321 omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); 316 omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
322 317
323 keymap = pdata->keymap; 318 input_dev->keycode = &omap_kp[1];
319 input_dev->keycodesize = sizeof(unsigned short);
320 input_dev->keycodemax = keycodemax;
324 321
325 if (pdata->rep) 322 if (pdata->rep)
326 __set_bit(EV_REP, input_dev->evbit); 323 __set_bit(EV_REP, input_dev->evbit);
@@ -374,8 +371,8 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
374 371
375 /* setup input device */ 372 /* setup input device */
376 __set_bit(EV_KEY, input_dev->evbit); 373 __set_bit(EV_KEY, input_dev->evbit);
377 for (i = 0; keymap[i] != 0; i++) 374 matrix_keypad_build_keymap(pdata->keymap_data, row_shift,
378 __set_bit(keymap[i] & KEY_MAX, input_dev->keybit); 375 input_dev->keycode, input_dev->keybit);
379 input_dev->name = "omap-keypad"; 376 input_dev->name = "omap-keypad";
380 input_dev->phys = "omap-keypad/input0"; 377 input_dev->phys = "omap-keypad/input0";
381 input_dev->dev.parent = &pdev->dev; 378 input_dev->dev.parent = &pdev->dev;
@@ -416,7 +413,7 @@ static int __devinit omap_kp_probe(struct platform_device *pdev)
416 return 0; 413 return 0;
417err5: 414err5:
418 for (i = irq_idx - 1; i >=0; i--) 415 for (i = irq_idx - 1; i >=0; i--)
419 free_irq(row_gpios[i], 0); 416 free_irq(row_gpios[i], NULL);
420err4: 417err4:
421 input_unregister_device(omap_kp->input); 418 input_unregister_device(omap_kp->input);
422 input_dev = NULL; 419 input_dev = NULL;
@@ -447,11 +444,11 @@ static int __devexit omap_kp_remove(struct platform_device *pdev)
447 gpio_free(col_gpios[i]); 444 gpio_free(col_gpios[i]);
448 for (i = 0; i < omap_kp->rows; i++) { 445 for (i = 0; i < omap_kp->rows; i++) {
449 gpio_free(row_gpios[i]); 446 gpio_free(row_gpios[i]);
450 free_irq(gpio_to_irq(row_gpios[i]), 0); 447 free_irq(gpio_to_irq(row_gpios[i]), NULL);
451 } 448 }
452 } else { 449 } else {
453 omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); 450 omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
454 free_irq(omap_kp->irq, 0); 451 free_irq(omap_kp->irq, NULL);
455 } 452 }
456 453
457 del_timer_sync(&omap_kp->timer); 454 del_timer_sync(&omap_kp->timer);
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 6256233d2bfb..bcb1fdedb595 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -214,7 +214,6 @@ config SERIO_AMS_DELTA
214 tristate "Amstrad Delta (E3) mailboard support" 214 tristate "Amstrad Delta (E3) mailboard support"
215 depends on MACH_AMS_DELTA 215 depends on MACH_AMS_DELTA
216 default y 216 default y
217 select AMS_DELTA_FIQ
218 ---help--- 217 ---help---
219 Say Y here if you have an E3 and want to use its mailboard, 218 Say Y here if you have an E3 and want to use its mailboard,
220 or any standard AT keyboard connected to the mailboard port. 219 or any standard AT keyboard connected to the mailboard port.