diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 22:13:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 22:13:58 -0500 |
commit | 01539ba2a706ab7d35fc0667dff919ade7f87d63 (patch) | |
tree | 5a4bd0cf78007d06690fe4ac06bbd49a5a70bc47 /drivers/input/keyboard | |
parent | 9e9bc9736756f25d6c47b4eba0ebf25b20a6f153 (diff) | |
parent | dc69d1af9e8d9cbbabff88bb35a6782187a22229 (diff) |
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (243 commits)
omap2: Make OMAP2PLUS select OMAP_DM_TIMER
OMAP4: hwmod data: Fix alignment and end of line in structurefields
OMAP4: hwmod data: Move the DMA structures
OMAP4: hwmod data: Move the smartreflex structures
OMAP4: hwmod data: Fix missing SIDLE_SMART_WKUP in smartreflexsysc
arm: omap: tusb6010: add name for MUSB IRQ
arm: omap: craneboard: Add USB EHCI support
omap2+: Initialize serial port for dynamic remuxing for n8x0
omap2+: Add struct omap_board_data and use it for platform level serial init
omap2+: Allow hwmod state changes to mux pads based on the state changes
omap2+: Add support for hwmod specific muxing of devices
omap2+: Add omap_mux_get_by_name
OMAP2: PM: fix compile error when !CONFIG_SUSPEND
MAINTAINERS: OMAP: hwmod: update hwmod code, data maintainership
OMAP4: Smartreflex framework extensions
OMAP4: hwmod: Add inital data for smartreflex modules.
OMAP4: PM: Program correct init voltages for scalable VDDs
OMAP4: Adding voltage driver support
OMAP4: Register voltage PMIC parameters with the voltage layer
OMAP3: PM: Program correct init voltages for VDD1 and VDD2
...
Fix up trivial conflict in arch/arm/plat-omap/Kconfig
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/omap-keypad.c | 41 |
1 files changed, 19 insertions, 22 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 | ||
66 | static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); | 66 | static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); |
67 | 67 | ||
68 | static int *keymap; | ||
69 | static unsigned int *row_gpios; | 68 | static unsigned int *row_gpios; |
70 | static unsigned int *col_gpios; | 69 | static 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 | ||
165 | static 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 | |||
176 | static void omap_kp_tasklet(unsigned long data) | 164 | static 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; |
417 | err5: | 414 | err5: |
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); |
420 | err4: | 417 | err4: |
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); |