diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2009-07-27 04:58:50 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-09-10 06:49:37 -0400 |
commit | a90c4fb89a870dede5d69a7eb5cb320158e21aab (patch) | |
tree | 6b6d6c8ae25495d605119122157eb422ccf09144 | |
parent | e2c509c7e63ffdeef21f292441c3d4ce73db9250 (diff) |
[ARM] pxa/corgi: make use of GPIO based matrix keypad driver
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 131 |
1 files changed, 130 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 39a94585f97b..0ff5ed80936f 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/spi/ads7846.h> | 29 | #include <linux/spi/ads7846.h> |
30 | #include <linux/spi/corgi_lcd.h> | 30 | #include <linux/spi/corgi_lcd.h> |
31 | #include <linux/mtd/sharpsl.h> | 31 | #include <linux/mtd/sharpsl.h> |
32 | #include <linux/input/matrix_keypad.h> | ||
32 | #include <video/w100fb.h> | 33 | #include <video/w100fb.h> |
33 | 34 | ||
34 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
@@ -104,6 +105,28 @@ static unsigned long corgi_pin_config[] __initdata = { | |||
104 | GPIO6_MMC_CLK, | 105 | GPIO6_MMC_CLK, |
105 | GPIO8_MMC_CS0, | 106 | GPIO8_MMC_CS0, |
106 | 107 | ||
108 | /* GPIO Matrix Keypad */ | ||
109 | GPIO66_GPIO, /* column 0 */ | ||
110 | GPIO67_GPIO, /* column 1 */ | ||
111 | GPIO68_GPIO, /* column 2 */ | ||
112 | GPIO69_GPIO, /* column 3 */ | ||
113 | GPIO70_GPIO, /* column 4 */ | ||
114 | GPIO71_GPIO, /* column 5 */ | ||
115 | GPIO72_GPIO, /* column 6 */ | ||
116 | GPIO73_GPIO, /* column 7 */ | ||
117 | GPIO74_GPIO, /* column 8 */ | ||
118 | GPIO75_GPIO, /* column 9 */ | ||
119 | GPIO76_GPIO, /* column 10 */ | ||
120 | GPIO77_GPIO, /* column 11 */ | ||
121 | GPIO58_GPIO, /* row 0 */ | ||
122 | GPIO59_GPIO, /* row 1 */ | ||
123 | GPIO60_GPIO, /* row 2 */ | ||
124 | GPIO61_GPIO, /* row 3 */ | ||
125 | GPIO62_GPIO, /* row 4 */ | ||
126 | GPIO63_GPIO, /* row 5 */ | ||
127 | GPIO64_GPIO, /* row 6 */ | ||
128 | GPIO65_GPIO, /* row 7 */ | ||
129 | |||
107 | /* GPIO */ | 130 | /* GPIO */ |
108 | GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ | 131 | GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ |
109 | GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ | 132 | GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ |
@@ -267,9 +290,115 @@ static struct platform_device corgifb_device = { | |||
267 | /* | 290 | /* |
268 | * Corgi Keyboard Device | 291 | * Corgi Keyboard Device |
269 | */ | 292 | */ |
293 | #define CORGI_KEY_CALENDER KEY_F1 | ||
294 | #define CORGI_KEY_ADDRESS KEY_F2 | ||
295 | #define CORGI_KEY_FN KEY_F3 | ||
296 | #define CORGI_KEY_CANCEL KEY_F4 | ||
297 | #define CORGI_KEY_OFF KEY_SUSPEND | ||
298 | #define CORGI_KEY_EXOK KEY_F5 | ||
299 | #define CORGI_KEY_EXCANCEL KEY_F6 | ||
300 | #define CORGI_KEY_EXJOGDOWN KEY_F7 | ||
301 | #define CORGI_KEY_EXJOGUP KEY_F8 | ||
302 | #define CORGI_KEY_JAP1 KEY_LEFTCTRL | ||
303 | #define CORGI_KEY_JAP2 KEY_LEFTALT | ||
304 | #define CORGI_KEY_MAIL KEY_F10 | ||
305 | #define CORGI_KEY_OK KEY_F11 | ||
306 | #define CORGI_KEY_MENU KEY_F12 | ||
307 | |||
308 | static const uint32_t corgikbd_keymap[] = { | ||
309 | KEY(0, 1, KEY_1), | ||
310 | KEY(0, 2, KEY_3), | ||
311 | KEY(0, 3, KEY_5), | ||
312 | KEY(0, 4, KEY_6), | ||
313 | KEY(0, 5, KEY_7), | ||
314 | KEY(0, 6, KEY_9), | ||
315 | KEY(0, 7, KEY_0), | ||
316 | KEY(0, 8, KEY_BACKSPACE), | ||
317 | KEY(1, 1, KEY_2), | ||
318 | KEY(1, 2, KEY_4), | ||
319 | KEY(1, 3, KEY_R), | ||
320 | KEY(1, 4, KEY_Y), | ||
321 | KEY(1, 5, KEY_8), | ||
322 | KEY(1, 6, KEY_I), | ||
323 | KEY(1, 7, KEY_O), | ||
324 | KEY(1, 8, KEY_P), | ||
325 | KEY(2, 0, KEY_TAB), | ||
326 | KEY(2, 1, KEY_Q), | ||
327 | KEY(2, 2, KEY_E), | ||
328 | KEY(2, 3, KEY_T), | ||
329 | KEY(2, 4, KEY_G), | ||
330 | KEY(2, 5, KEY_U), | ||
331 | KEY(2, 6, KEY_J), | ||
332 | KEY(2, 7, KEY_K), | ||
333 | KEY(3, 0, CORGI_KEY_CALENDER), | ||
334 | KEY(3, 1, KEY_W), | ||
335 | KEY(3, 2, KEY_S), | ||
336 | KEY(3, 3, KEY_F), | ||
337 | KEY(3, 4, KEY_V), | ||
338 | KEY(3, 5, KEY_H), | ||
339 | KEY(3, 6, KEY_M), | ||
340 | KEY(3, 7, KEY_L), | ||
341 | KEY(3, 9, KEY_RIGHTSHIFT), | ||
342 | KEY(4, 0, CORGI_KEY_ADDRESS), | ||
343 | KEY(4, 1, KEY_A), | ||
344 | KEY(4, 2, KEY_D), | ||
345 | KEY(4, 3, KEY_C), | ||
346 | KEY(4, 4, KEY_B), | ||
347 | KEY(4, 5, KEY_N), | ||
348 | KEY(4, 6, KEY_DOT), | ||
349 | KEY(4, 8, KEY_ENTER), | ||
350 | KEY(4, 10, KEY_LEFTSHIFT), | ||
351 | KEY(5, 0, CORGI_KEY_MAIL), | ||
352 | KEY(5, 1, KEY_Z), | ||
353 | KEY(5, 2, KEY_X), | ||
354 | KEY(5, 3, KEY_MINUS), | ||
355 | KEY(5, 4, KEY_SPACE), | ||
356 | KEY(5, 5, KEY_COMMA), | ||
357 | KEY(5, 7, KEY_UP), | ||
358 | KEY(5, 11, CORGI_KEY_FN), | ||
359 | KEY(6, 0, KEY_SYSRQ), | ||
360 | KEY(6, 1, CORGI_KEY_JAP1), | ||
361 | KEY(6, 2, CORGI_KEY_JAP2), | ||
362 | KEY(6, 3, CORGI_KEY_CANCEL), | ||
363 | KEY(6, 4, CORGI_KEY_OK), | ||
364 | KEY(6, 5, CORGI_KEY_MENU), | ||
365 | KEY(6, 6, KEY_LEFT), | ||
366 | KEY(6, 7, KEY_DOWN), | ||
367 | KEY(6, 8, KEY_RIGHT), | ||
368 | KEY(7, 0, CORGI_KEY_OFF), | ||
369 | KEY(7, 1, CORGI_KEY_EXOK), | ||
370 | KEY(7, 2, CORGI_KEY_EXCANCEL), | ||
371 | KEY(7, 3, CORGI_KEY_EXJOGDOWN), | ||
372 | KEY(7, 4, CORGI_KEY_EXJOGUP), | ||
373 | }; | ||
374 | |||
375 | static struct matrix_keymap_data corgikbd_keymap_data = { | ||
376 | .keymap = corgikbd_keymap, | ||
377 | .keymap_size = ARRAY_SIZE(corgikbd_keymap), | ||
378 | }; | ||
379 | |||
380 | static const int corgikbd_row_gpios[] = | ||
381 | { 58, 59, 60, 61, 62, 63, 64, 65 }; | ||
382 | static const int corgikbd_col_gpios[] = | ||
383 | { 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77 }; | ||
384 | |||
385 | static struct matrix_keypad_platform_data corgikbd_pdata = { | ||
386 | .keymap_data = &corgikbd_keymap_data, | ||
387 | .row_gpios = corgikbd_row_gpios, | ||
388 | .col_gpios = corgikbd_col_gpios, | ||
389 | .num_row_gpios = ARRAY_SIZE(corgikbd_row_gpios), | ||
390 | .num_col_gpios = ARRAY_SIZE(corgikbd_col_gpios), | ||
391 | .col_scan_delay_us = 10, | ||
392 | .debounce_ms = 10, | ||
393 | .wakeup = 1, | ||
394 | }; | ||
395 | |||
270 | static struct platform_device corgikbd_device = { | 396 | static struct platform_device corgikbd_device = { |
271 | .name = "corgi-keyboard", | 397 | .name = "matrix-keypad", |
272 | .id = -1, | 398 | .id = -1, |
399 | .dev = { | ||
400 | .platform_data = &corgikbd_pdata, | ||
401 | }, | ||
273 | }; | 402 | }; |
274 | 403 | ||
275 | /* | 404 | /* |