diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2010-01-01 02:28:21 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-03-01 18:40:48 -0500 |
commit | f69a6548c9d5dd29ecaed1c714b41487c458ce8b (patch) | |
tree | c01e4a354508f9004c0784bee93078ea882bf049 /arch/arm/mach-pxa/tosa.c | |
parent | 96f6a13a6d8a6370fb9a8c828d549f3ddea8d0c5 (diff) |
[ARM] pxa/tosa: make use of the matrix keypad driver
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 117 |
1 files changed, 98 insertions, 19 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index c854c168a451..ad552791c4ce 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/pda_power.h> | 33 | #include <linux/pda_power.h> |
34 | #include <linux/spi/spi.h> | 34 | #include <linux/spi/spi.h> |
35 | #include <linux/input/matrix_keypad.h> | ||
35 | 36 | ||
36 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
37 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
@@ -131,24 +132,24 @@ static unsigned long tosa_pin_config[] = { | |||
131 | GPIO45_BTUART_RTS, | 132 | GPIO45_BTUART_RTS, |
132 | 133 | ||
133 | /* Keybd */ | 134 | /* Keybd */ |
134 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, | 135 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, /* Column 0 */ |
135 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, | 136 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, /* Column 1 */ |
136 | GPIO60_GPIO | MFP_LPM_DRIVE_LOW, | 137 | GPIO60_GPIO | MFP_LPM_DRIVE_LOW, /* Column 2 */ |
137 | GPIO61_GPIO | MFP_LPM_DRIVE_LOW, | 138 | GPIO61_GPIO | MFP_LPM_DRIVE_LOW, /* Column 3 */ |
138 | GPIO62_GPIO | MFP_LPM_DRIVE_LOW, | 139 | GPIO62_GPIO | MFP_LPM_DRIVE_LOW, /* Column 4 */ |
139 | GPIO63_GPIO | MFP_LPM_DRIVE_LOW, | 140 | GPIO63_GPIO | MFP_LPM_DRIVE_LOW, /* Column 5 */ |
140 | GPIO64_GPIO | MFP_LPM_DRIVE_LOW, | 141 | GPIO64_GPIO | MFP_LPM_DRIVE_LOW, /* Column 6 */ |
141 | GPIO65_GPIO | MFP_LPM_DRIVE_LOW, | 142 | GPIO65_GPIO | MFP_LPM_DRIVE_LOW, /* Column 7 */ |
142 | GPIO66_GPIO | MFP_LPM_DRIVE_LOW, | 143 | GPIO66_GPIO | MFP_LPM_DRIVE_LOW, /* Column 8 */ |
143 | GPIO67_GPIO | MFP_LPM_DRIVE_LOW, | 144 | GPIO67_GPIO | MFP_LPM_DRIVE_LOW, /* Column 9 */ |
144 | GPIO68_GPIO | MFP_LPM_DRIVE_LOW, | 145 | GPIO68_GPIO | MFP_LPM_DRIVE_LOW, /* Column 10 */ |
145 | GPIO69_GPIO | MFP_LPM_DRIVE_LOW, | 146 | GPIO69_GPIO | MFP_LPM_DRIVE_LOW, /* Row 0 */ |
146 | GPIO70_GPIO | MFP_LPM_DRIVE_LOW, | 147 | GPIO70_GPIO | MFP_LPM_DRIVE_LOW, /* Row 1 */ |
147 | GPIO71_GPIO | MFP_LPM_DRIVE_LOW, | 148 | GPIO71_GPIO | MFP_LPM_DRIVE_LOW, /* Row 2 */ |
148 | GPIO72_GPIO | MFP_LPM_DRIVE_LOW, | 149 | GPIO72_GPIO | MFP_LPM_DRIVE_LOW, /* Row 3 */ |
149 | GPIO73_GPIO | MFP_LPM_DRIVE_LOW, | 150 | GPIO73_GPIO | MFP_LPM_DRIVE_LOW, /* Row 4 */ |
150 | GPIO74_GPIO | MFP_LPM_DRIVE_LOW, | 151 | GPIO74_GPIO | MFP_LPM_DRIVE_LOW, /* Row 5 */ |
151 | GPIO75_GPIO | MFP_LPM_DRIVE_LOW, | 152 | GPIO75_GPIO | MFP_LPM_DRIVE_LOW, /* Row 6 */ |
152 | 153 | ||
153 | /* SPI */ | 154 | /* SPI */ |
154 | GPIO81_SSP2_CLK_OUT, | 155 | GPIO81_SSP2_CLK_OUT, |
@@ -411,9 +412,87 @@ static struct platform_device tosa_power_device = { | |||
411 | /* | 412 | /* |
412 | * Tosa Keyboard | 413 | * Tosa Keyboard |
413 | */ | 414 | */ |
415 | static const uint32_t tosakbd_keymap[] = { | ||
416 | KEY(0, 2, KEY_W), | ||
417 | KEY(0, 6, KEY_K), | ||
418 | KEY(0, 7, KEY_BACKSPACE), | ||
419 | KEY(0, 8, KEY_P), | ||
420 | KEY(1, 1, KEY_Q), | ||
421 | KEY(1, 2, KEY_E), | ||
422 | KEY(1, 3, KEY_T), | ||
423 | KEY(1, 4, KEY_Y), | ||
424 | KEY(1, 6, KEY_O), | ||
425 | KEY(1, 7, KEY_I), | ||
426 | KEY(1, 8, KEY_COMMA), | ||
427 | KEY(2, 1, KEY_A), | ||
428 | KEY(2, 2, KEY_D), | ||
429 | KEY(2, 3, KEY_G), | ||
430 | KEY(2, 4, KEY_U), | ||
431 | KEY(2, 6, KEY_L), | ||
432 | KEY(2, 7, KEY_ENTER), | ||
433 | KEY(2, 8, KEY_DOT), | ||
434 | KEY(3, 1, KEY_Z), | ||
435 | KEY(3, 2, KEY_C), | ||
436 | KEY(3, 3, KEY_V), | ||
437 | KEY(3, 4, KEY_J), | ||
438 | KEY(3, 5, TOSA_KEY_ADDRESSBOOK), | ||
439 | KEY(3, 6, TOSA_KEY_CANCEL), | ||
440 | KEY(3, 7, TOSA_KEY_CENTER), | ||
441 | KEY(3, 8, TOSA_KEY_OK), | ||
442 | KEY(3, 9, KEY_LEFTSHIFT), | ||
443 | KEY(4, 1, KEY_S), | ||
444 | KEY(4, 2, KEY_R), | ||
445 | KEY(4, 3, KEY_B), | ||
446 | KEY(4, 4, KEY_N), | ||
447 | KEY(4, 5, TOSA_KEY_CALENDAR), | ||
448 | KEY(4, 6, TOSA_KEY_HOMEPAGE), | ||
449 | KEY(4, 7, KEY_LEFTCTRL), | ||
450 | KEY(4, 8, TOSA_KEY_LIGHT), | ||
451 | KEY(4, 10, KEY_RIGHTSHIFT), | ||
452 | KEY(5, 1, KEY_TAB), | ||
453 | KEY(5, 2, KEY_SLASH), | ||
454 | KEY(5, 3, KEY_H), | ||
455 | KEY(5, 4, KEY_M), | ||
456 | KEY(5, 5, TOSA_KEY_MENU), | ||
457 | KEY(5, 7, KEY_UP), | ||
458 | KEY(5, 11, TOSA_KEY_FN), | ||
459 | KEY(6, 1, KEY_X), | ||
460 | KEY(6, 2, KEY_F), | ||
461 | KEY(6, 3, KEY_SPACE), | ||
462 | KEY(6, 4, KEY_APOSTROPHE), | ||
463 | KEY(6, 5, TOSA_KEY_MAIL), | ||
464 | KEY(6, 6, KEY_LEFT), | ||
465 | KEY(6, 7, KEY_DOWN), | ||
466 | KEY(6, 8, KEY_RIGHT), | ||
467 | }; | ||
468 | |||
469 | static struct matrix_keymap_data tosakbd_keymap_data = { | ||
470 | .keymap = tosakbd_keymap, | ||
471 | .keymap_size = ARRAY_SIZE(tosakbd_keymap), | ||
472 | }; | ||
473 | |||
474 | static const int tosakbd_col_gpios[] = | ||
475 | { 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68 }; | ||
476 | static const int tosakbd_row_gpios[] = | ||
477 | { 69, 70, 71, 72, 73, 74, 75 }; | ||
478 | |||
479 | static struct matrix_keypad_platform_data tosakbd_pdata = { | ||
480 | .keymap_data = &tosakbd_keymap_data, | ||
481 | .row_gpios = tosakbd_row_gpios, | ||
482 | .col_gpios = tosakbd_col_gpios, | ||
483 | .num_row_gpios = ARRAY_SIZE(tosakbd_row_gpios), | ||
484 | .num_col_gpios = ARRAY_SIZE(tosakbd_col_gpios), | ||
485 | .col_scan_delay_us = 10, | ||
486 | .debounce_ms = 10, | ||
487 | .wakeup = 1, | ||
488 | }; | ||
489 | |||
414 | static struct platform_device tosakbd_device = { | 490 | static struct platform_device tosakbd_device = { |
415 | .name = "tosa-keyboard", | 491 | .name = "matrix-keypad", |
416 | .id = -1, | 492 | .id = -1, |
493 | .dev = { | ||
494 | .platform_data = &tosakbd_pdata, | ||
495 | }, | ||
417 | }; | 496 | }; |
418 | 497 | ||
419 | static struct gpio_keys_button tosa_gpio_keys[] = { | 498 | static struct gpio_keys_button tosa_gpio_keys[] = { |