diff options
author | Chao Xie <chao.xie@marvell.com> | 2013-05-05 23:24:58 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-06-19 01:56:51 -0400 |
commit | 0a085a9482fa51efb58c9d351ea98e83c5df93fc (patch) | |
tree | 411592ae841ea8b18dce07a7e4bce3fce30fcadc | |
parent | 483180281f0ac60d1138710eb21f4b9961901294 (diff) |
Input: pxa27x-keypad - use matrix_keymap for matrix keys
pxa27x-keypad includes matrix keys. Make use of matrix_keymap
for the matrix keys.
Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | arch/arm/mach-mmp/aspenite.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-mmp/teton_bga.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-pxa/em-x270.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-pxa/ezx.c | 60 | ||||
-rw-r--r-- | arch/arm/mach-pxa/littleton.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mioa701.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmld.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtreo.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtx.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmz72.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/tavorevb.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/z2.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite.c | 10 | ||||
-rw-r--r-- | drivers/input/keyboard/Kconfig | 1 | ||||
-rw-r--r-- | drivers/input/keyboard/pxa27x_keypad.c | 35 | ||||
-rw-r--r-- | include/linux/platform_data/keypad-pxa27x.h | 3 |
18 files changed, 180 insertions, 81 deletions
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c index 9f64d5632e07..1e233467fffa 100644 --- a/arch/arm/mach-mmp/aspenite.c +++ b/arch/arm/mach-mmp/aspenite.c | |||
@@ -205,7 +205,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = { | |||
205 | .invert_pixclock = 0, | 205 | .invert_pixclock = 0, |
206 | }; | 206 | }; |
207 | 207 | ||
208 | static unsigned int aspenite_matrix_key_map[] = { | 208 | static const unsigned int aspenite_matrix_key_map[] = { |
209 | KEY(0, 6, KEY_UP), /* SW 4 */ | 209 | KEY(0, 6, KEY_UP), /* SW 4 */ |
210 | KEY(0, 7, KEY_DOWN), /* SW 5 */ | 210 | KEY(0, 7, KEY_DOWN), /* SW 5 */ |
211 | KEY(1, 6, KEY_LEFT), /* SW 6 */ | 211 | KEY(1, 6, KEY_LEFT), /* SW 6 */ |
@@ -214,11 +214,15 @@ static unsigned int aspenite_matrix_key_map[] = { | |||
214 | KEY(4, 7, KEY_ESC), /* SW 9 */ | 214 | KEY(4, 7, KEY_ESC), /* SW 9 */ |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static struct matrix_keymap_data aspenite_matrix_keymap_data = { | ||
218 | .keymap = aspenite_matrix_key_map, | ||
219 | .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map), | ||
220 | }; | ||
221 | |||
217 | static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { | 222 | static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { |
218 | .matrix_key_rows = 5, | 223 | .matrix_key_rows = 5, |
219 | .matrix_key_cols = 8, | 224 | .matrix_key_cols = 8, |
220 | .matrix_key_map = aspenite_matrix_key_map, | 225 | .matrix_keymap_data = &aspenite_matrix_keymap_data, |
221 | .matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map), | ||
222 | .debounce_interval = 30, | 226 | .debounce_interval = 30, |
223 | }; | 227 | }; |
224 | 228 | ||
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c index 8609967975ed..d8967fa48374 100644 --- a/arch/arm/mach-mmp/teton_bga.c +++ b/arch/arm/mach-mmp/teton_bga.c | |||
@@ -56,11 +56,15 @@ static unsigned int teton_bga_matrix_key_map[] = { | |||
56 | KEY(1, 7, KEY_RIGHT), | 56 | KEY(1, 7, KEY_RIGHT), |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static struct matrix_keymap_data teton_bga_matrix_keymap_data = { | ||
60 | .keymap = teton_bga_matrix_key_map, | ||
61 | .keymap_size = ARRAY_SIZE(teton_bga_matrix_key_map), | ||
62 | }; | ||
63 | |||
59 | static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = { | 64 | static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = { |
60 | .matrix_key_rows = 2, | 65 | .matrix_key_rows = 2, |
61 | .matrix_key_cols = 8, | 66 | .matrix_key_cols = 8, |
62 | .matrix_key_map = teton_bga_matrix_key_map, | 67 | .matrix_keymap_data = &teton_bga_matrix_keymap_data, |
63 | .matrix_key_map_size = ARRAY_SIZE(teton_bga_matrix_key_map), | ||
64 | .debounce_interval = 30, | 68 | .debounce_interval = 30, |
65 | }; | 69 | }; |
66 | 70 | ||
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 446563a7d1ad..f6726bb4eb95 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -833,21 +833,25 @@ static inline void em_x270_init_ac97(void) {} | |||
833 | #endif | 833 | #endif |
834 | 834 | ||
835 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 835 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
836 | static unsigned int em_x270_module_matrix_keys[] = { | 836 | static const unsigned int em_x270_module_matrix_keys[] = { |
837 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), | 837 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), |
838 | KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), | 838 | KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), |
839 | KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), | 839 | KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), |
840 | }; | 840 | }; |
841 | 841 | ||
842 | static struct matrix_keymap_data em_x270_matrix_keymap_data = { | ||
843 | .keymap = em_x270_module_matrix_keys, | ||
844 | .keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys), | ||
845 | }; | ||
846 | |||
842 | struct pxa27x_keypad_platform_data em_x270_module_keypad_info = { | 847 | struct pxa27x_keypad_platform_data em_x270_module_keypad_info = { |
843 | /* code map for the matrix keys */ | 848 | /* code map for the matrix keys */ |
844 | .matrix_key_rows = 3, | 849 | .matrix_key_rows = 3, |
845 | .matrix_key_cols = 3, | 850 | .matrix_key_cols = 3, |
846 | .matrix_key_map = em_x270_module_matrix_keys, | 851 | .matrix_keymap_data = &em_x270_matrix_keymap_data, |
847 | .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys), | ||
848 | }; | 852 | }; |
849 | 853 | ||
850 | static unsigned int em_x270_exeda_matrix_keys[] = { | 854 | static const unsigned int em_x270_exeda_matrix_keys[] = { |
851 | KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL), | 855 | KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL), |
852 | KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE), | 856 | KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE), |
853 | KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL), | 857 | KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL), |
@@ -889,12 +893,16 @@ static unsigned int em_x270_exeda_matrix_keys[] = { | |||
889 | KEY(7, 6, 0), KEY(7, 7, 0), | 893 | KEY(7, 6, 0), KEY(7, 7, 0), |
890 | }; | 894 | }; |
891 | 895 | ||
896 | static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = { | ||
897 | .keymap = em_x270_exeda_matrix_keys, | ||
898 | .keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys), | ||
899 | }; | ||
900 | |||
892 | struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = { | 901 | struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = { |
893 | /* code map for the matrix keys */ | 902 | /* code map for the matrix keys */ |
894 | .matrix_key_rows = 8, | 903 | .matrix_key_rows = 8, |
895 | .matrix_key_cols = 8, | 904 | .matrix_key_cols = 8, |
896 | .matrix_key_map = em_x270_exeda_matrix_keys, | 905 | .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data, |
897 | .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys), | ||
898 | }; | 906 | }; |
899 | 907 | ||
900 | static void __init em_x270_init_keypad(void) | 908 | static void __init em_x270_init_keypad(void) |
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index dca10709be8f..fe2eb8394dff 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -392,7 +392,7 @@ static unsigned long e6_pin_config[] __initdata = { | |||
392 | 392 | ||
393 | /* KEYPAD */ | 393 | /* KEYPAD */ |
394 | #ifdef CONFIG_MACH_EZX_A780 | 394 | #ifdef CONFIG_MACH_EZX_A780 |
395 | static unsigned int a780_key_map[] = { | 395 | static const unsigned int a780_key_map[] = { |
396 | KEY(0, 0, KEY_SEND), | 396 | KEY(0, 0, KEY_SEND), |
397 | KEY(0, 1, KEY_BACK), | 397 | KEY(0, 1, KEY_BACK), |
398 | KEY(0, 2, KEY_END), | 398 | KEY(0, 2, KEY_END), |
@@ -424,11 +424,15 @@ static unsigned int a780_key_map[] = { | |||
424 | KEY(4, 4, KEY_DOWN), | 424 | KEY(4, 4, KEY_DOWN), |
425 | }; | 425 | }; |
426 | 426 | ||
427 | static struct matrix_keymap_data a780_matrix_keymap_data = { | ||
428 | .keymap = a780_key_map, | ||
429 | .keymap_size = ARRAY_SIZE(a780_key_map), | ||
430 | }; | ||
431 | |||
427 | static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { | 432 | static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { |
428 | .matrix_key_rows = 5, | 433 | .matrix_key_rows = 5, |
429 | .matrix_key_cols = 5, | 434 | .matrix_key_cols = 5, |
430 | .matrix_key_map = a780_key_map, | 435 | .matrix_keymap_data = &a780_matrix_keymap_data, |
431 | .matrix_key_map_size = ARRAY_SIZE(a780_key_map), | ||
432 | 436 | ||
433 | .direct_key_map = { KEY_CAMERA }, | 437 | .direct_key_map = { KEY_CAMERA }, |
434 | .direct_key_num = 1, | 438 | .direct_key_num = 1, |
@@ -438,7 +442,7 @@ static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { | |||
438 | #endif /* CONFIG_MACH_EZX_A780 */ | 442 | #endif /* CONFIG_MACH_EZX_A780 */ |
439 | 443 | ||
440 | #ifdef CONFIG_MACH_EZX_E680 | 444 | #ifdef CONFIG_MACH_EZX_E680 |
441 | static unsigned int e680_key_map[] = { | 445 | static const unsigned int e680_key_map[] = { |
442 | KEY(0, 0, KEY_UP), | 446 | KEY(0, 0, KEY_UP), |
443 | KEY(0, 1, KEY_RIGHT), | 447 | KEY(0, 1, KEY_RIGHT), |
444 | KEY(0, 2, KEY_RESERVED), | 448 | KEY(0, 2, KEY_RESERVED), |
@@ -455,11 +459,15 @@ static unsigned int e680_key_map[] = { | |||
455 | KEY(2, 3, KEY_KPENTER), | 459 | KEY(2, 3, KEY_KPENTER), |
456 | }; | 460 | }; |
457 | 461 | ||
462 | static struct matrix_keymap_data e680_matrix_keymap_data = { | ||
463 | .keymap = e680_key_map, | ||
464 | .keymap_size = ARRAY_SIZE(e680_key_map), | ||
465 | }; | ||
466 | |||
458 | static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { | 467 | static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { |
459 | .matrix_key_rows = 3, | 468 | .matrix_key_rows = 3, |
460 | .matrix_key_cols = 4, | 469 | .matrix_key_cols = 4, |
461 | .matrix_key_map = e680_key_map, | 470 | .matrix_keymap_data = &e680_matrix_keymap_data, |
462 | .matrix_key_map_size = ARRAY_SIZE(e680_key_map), | ||
463 | 471 | ||
464 | .direct_key_map = { | 472 | .direct_key_map = { |
465 | KEY_CAMERA, | 473 | KEY_CAMERA, |
@@ -476,7 +484,7 @@ static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { | |||
476 | #endif /* CONFIG_MACH_EZX_E680 */ | 484 | #endif /* CONFIG_MACH_EZX_E680 */ |
477 | 485 | ||
478 | #ifdef CONFIG_MACH_EZX_A1200 | 486 | #ifdef CONFIG_MACH_EZX_A1200 |
479 | static unsigned int a1200_key_map[] = { | 487 | static const unsigned int a1200_key_map[] = { |
480 | KEY(0, 0, KEY_RESERVED), | 488 | KEY(0, 0, KEY_RESERVED), |
481 | KEY(0, 1, KEY_RIGHT), | 489 | KEY(0, 1, KEY_RIGHT), |
482 | KEY(0, 2, KEY_PAGEDOWN), | 490 | KEY(0, 2, KEY_PAGEDOWN), |
@@ -513,18 +521,22 @@ static unsigned int a1200_key_map[] = { | |||
513 | KEY(4, 5, KEY_RESERVED), | 521 | KEY(4, 5, KEY_RESERVED), |
514 | }; | 522 | }; |
515 | 523 | ||
524 | static struct matrix_keymap_data a1200_matrix_keymap_data = { | ||
525 | .keymap = a1200_key_map, | ||
526 | .keymap_size = ARRAY_SIZE(a1200_key_map), | ||
527 | }; | ||
528 | |||
516 | static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { | 529 | static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { |
517 | .matrix_key_rows = 5, | 530 | .matrix_key_rows = 5, |
518 | .matrix_key_cols = 6, | 531 | .matrix_key_cols = 6, |
519 | .matrix_key_map = a1200_key_map, | 532 | .matrix_keymap_data = &a1200_matrix_keymap_data, |
520 | .matrix_key_map_size = ARRAY_SIZE(a1200_key_map), | ||
521 | 533 | ||
522 | .debounce_interval = 30, | 534 | .debounce_interval = 30, |
523 | }; | 535 | }; |
524 | #endif /* CONFIG_MACH_EZX_A1200 */ | 536 | #endif /* CONFIG_MACH_EZX_A1200 */ |
525 | 537 | ||
526 | #ifdef CONFIG_MACH_EZX_E6 | 538 | #ifdef CONFIG_MACH_EZX_E6 |
527 | static unsigned int e6_key_map[] = { | 539 | static const unsigned int e6_key_map[] = { |
528 | KEY(0, 0, KEY_RESERVED), | 540 | KEY(0, 0, KEY_RESERVED), |
529 | KEY(0, 1, KEY_RIGHT), | 541 | KEY(0, 1, KEY_RIGHT), |
530 | KEY(0, 2, KEY_PAGEDOWN), | 542 | KEY(0, 2, KEY_PAGEDOWN), |
@@ -561,18 +573,22 @@ static unsigned int e6_key_map[] = { | |||
561 | KEY(4, 5, KEY_PREVIOUSSONG), | 573 | KEY(4, 5, KEY_PREVIOUSSONG), |
562 | }; | 574 | }; |
563 | 575 | ||
576 | static struct matrix_keymap_data e6_keymap_data = { | ||
577 | .keymap = e6_key_map, | ||
578 | .keymap_size = ARRAY_SIZE(e6_key_map), | ||
579 | }; | ||
580 | |||
564 | static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { | 581 | static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { |
565 | .matrix_key_rows = 5, | 582 | .matrix_key_rows = 5, |
566 | .matrix_key_cols = 6, | 583 | .matrix_key_cols = 6, |
567 | .matrix_key_map = e6_key_map, | 584 | .matrix_keymap_data = &e6_keymap_data, |
568 | .matrix_key_map_size = ARRAY_SIZE(e6_key_map), | ||
569 | 585 | ||
570 | .debounce_interval = 30, | 586 | .debounce_interval = 30, |
571 | }; | 587 | }; |
572 | #endif /* CONFIG_MACH_EZX_E6 */ | 588 | #endif /* CONFIG_MACH_EZX_E6 */ |
573 | 589 | ||
574 | #ifdef CONFIG_MACH_EZX_A910 | 590 | #ifdef CONFIG_MACH_EZX_A910 |
575 | static unsigned int a910_key_map[] = { | 591 | static const unsigned int a910_key_map[] = { |
576 | KEY(0, 0, KEY_NUMERIC_6), | 592 | KEY(0, 0, KEY_NUMERIC_6), |
577 | KEY(0, 1, KEY_RIGHT), | 593 | KEY(0, 1, KEY_RIGHT), |
578 | KEY(0, 2, KEY_PAGEDOWN), | 594 | KEY(0, 2, KEY_PAGEDOWN), |
@@ -609,18 +625,22 @@ static unsigned int a910_key_map[] = { | |||
609 | KEY(4, 5, KEY_RESERVED), | 625 | KEY(4, 5, KEY_RESERVED), |
610 | }; | 626 | }; |
611 | 627 | ||
628 | static struct matrix_keymap_data a910_matrix_keymap_data = { | ||
629 | .keymap = a910_key_map, | ||
630 | .keymap_size = ARRAY_SIZE(a910_key_map), | ||
631 | }; | ||
632 | |||
612 | static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { | 633 | static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { |
613 | .matrix_key_rows = 5, | 634 | .matrix_key_rows = 5, |
614 | .matrix_key_cols = 6, | 635 | .matrix_key_cols = 6, |
615 | .matrix_key_map = a910_key_map, | 636 | .matrix_keymap_data = &a910_matrix_keymap_data, |
616 | .matrix_key_map_size = ARRAY_SIZE(a910_key_map), | ||
617 | 637 | ||
618 | .debounce_interval = 30, | 638 | .debounce_interval = 30, |
619 | }; | 639 | }; |
620 | #endif /* CONFIG_MACH_EZX_A910 */ | 640 | #endif /* CONFIG_MACH_EZX_A910 */ |
621 | 641 | ||
622 | #ifdef CONFIG_MACH_EZX_E2 | 642 | #ifdef CONFIG_MACH_EZX_E2 |
623 | static unsigned int e2_key_map[] = { | 643 | static const unsigned int e2_key_map[] = { |
624 | KEY(0, 0, KEY_NUMERIC_6), | 644 | KEY(0, 0, KEY_NUMERIC_6), |
625 | KEY(0, 1, KEY_RIGHT), | 645 | KEY(0, 1, KEY_RIGHT), |
626 | KEY(0, 2, KEY_NUMERIC_9), | 646 | KEY(0, 2, KEY_NUMERIC_9), |
@@ -657,11 +677,15 @@ static unsigned int e2_key_map[] = { | |||
657 | KEY(4, 5, KEY_RESERVED), | 677 | KEY(4, 5, KEY_RESERVED), |
658 | }; | 678 | }; |
659 | 679 | ||
680 | static struct matrix_keymap_data e2_matrix_keymap_data = { | ||
681 | .keymap = e2_key_map, | ||
682 | .keymap_size = ARRAY_SIZE(e2_key_map), | ||
683 | }; | ||
684 | |||
660 | static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | 685 | static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { |
661 | .matrix_key_rows = 5, | 686 | .matrix_key_rows = 5, |
662 | .matrix_key_cols = 6, | 687 | .matrix_key_cols = 6, |
663 | .matrix_key_map = e2_key_map, | 688 | .matrix_keymap_data = &e2_matrix_keymap_data, |
664 | .matrix_key_map_size = ARRAY_SIZE(e2_key_map), | ||
665 | 689 | ||
666 | .debounce_interval = 30, | 690 | .debounce_interval = 30, |
667 | }; | 691 | }; |
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index e848c4607baf..5d665588c7eb 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -222,7 +222,7 @@ static inline void littleton_init_spi(void) {} | |||
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 224 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
225 | static unsigned int littleton_matrix_key_map[] = { | 225 | static const unsigned int littleton_matrix_key_map[] = { |
226 | /* KEY(row, col, key_code) */ | 226 | /* KEY(row, col, key_code) */ |
227 | KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), | 227 | KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), |
228 | KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7), | 228 | KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7), |
@@ -249,11 +249,15 @@ static unsigned int littleton_matrix_key_map[] = { | |||
249 | KEY(3, 1, KEY_F23), /* soft2 */ | 249 | KEY(3, 1, KEY_F23), /* soft2 */ |
250 | }; | 250 | }; |
251 | 251 | ||
252 | static struct matrix_keymap_data littleton_matrix_keymap_data = { | ||
253 | .keymap = littleton_matrix_key_map, | ||
254 | .keymap_size = ARRAY_SIZE(littleton_matrix_key_map), | ||
255 | }; | ||
256 | |||
252 | static struct pxa27x_keypad_platform_data littleton_keypad_info = { | 257 | static struct pxa27x_keypad_platform_data littleton_keypad_info = { |
253 | .matrix_key_rows = 6, | 258 | .matrix_key_rows = 6, |
254 | .matrix_key_cols = 5, | 259 | .matrix_key_cols = 5, |
255 | .matrix_key_map = littleton_matrix_key_map, | 260 | .matrix_keymap_data = &littleton_matrix_keymap_data, |
256 | .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map), | ||
257 | 261 | ||
258 | .enable_rotary0 = 1, | 262 | .enable_rotary0 = 1, |
259 | .rotary0_up_key = KEY_UP, | 263 | .rotary0_up_key = KEY_UP, |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 7a12c1ba90ff..d2c652318376 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -498,7 +498,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = { | |||
498 | }; | 498 | }; |
499 | 499 | ||
500 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 500 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
501 | static unsigned int mainstone_matrix_keys[] = { | 501 | static const unsigned int mainstone_matrix_keys[] = { |
502 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), | 502 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), |
503 | KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), | 503 | KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), |
504 | KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I), | 504 | KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I), |
@@ -527,11 +527,15 @@ static unsigned int mainstone_matrix_keys[] = { | |||
527 | KEY(4, 6, KEY_SELECT), | 527 | KEY(4, 6, KEY_SELECT), |
528 | }; | 528 | }; |
529 | 529 | ||
530 | static struct matrix_keymap_data mainstone_matrix_keymap_data = { | ||
531 | .keymap = mainstone_matrix_keys, | ||
532 | .keymap_size = ARRAY_SIZE(mainstone_matrix_keys), | ||
533 | }; | ||
534 | |||
530 | struct pxa27x_keypad_platform_data mainstone_keypad_info = { | 535 | struct pxa27x_keypad_platform_data mainstone_keypad_info = { |
531 | .matrix_key_rows = 6, | 536 | .matrix_key_rows = 6, |
532 | .matrix_key_cols = 7, | 537 | .matrix_key_cols = 7, |
533 | .matrix_key_map = mainstone_matrix_keys, | 538 | .matrix_keymap_data = &mainstone_matrix_keymap_data, |
534 | .matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys), | ||
535 | 539 | ||
536 | .enable_rotary0 = 1, | 540 | .enable_rotary0 = 1, |
537 | .rotary0_up_key = KEY_UP, | 541 | .rotary0_up_key = KEY_UP, |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index f8979b943cbf..654b0ac84dea 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -222,7 +222,7 @@ static struct pxafb_mach_info mioa701_pxafb_info = { | |||
222 | /* | 222 | /* |
223 | * Keyboard configuration | 223 | * Keyboard configuration |
224 | */ | 224 | */ |
225 | static unsigned int mioa701_matrix_keys[] = { | 225 | static const unsigned int mioa701_matrix_keys[] = { |
226 | KEY(0, 0, KEY_UP), | 226 | KEY(0, 0, KEY_UP), |
227 | KEY(0, 1, KEY_RIGHT), | 227 | KEY(0, 1, KEY_RIGHT), |
228 | KEY(0, 2, KEY_MEDIA), | 228 | KEY(0, 2, KEY_MEDIA), |
@@ -233,11 +233,16 @@ static unsigned int mioa701_matrix_keys[] = { | |||
233 | KEY(2, 1, KEY_PHONE), /* Phone Green key */ | 233 | KEY(2, 1, KEY_PHONE), /* Phone Green key */ |
234 | KEY(2, 2, KEY_CAMERA) /* Camera key */ | 234 | KEY(2, 2, KEY_CAMERA) /* Camera key */ |
235 | }; | 235 | }; |
236 | |||
237 | static struct matrix_keymap_data mioa701_matrix_keymap_data = { | ||
238 | .keymap = mioa701_matrix_keys, | ||
239 | .keymap_size = ARRAY_SIZE(mioa701_matrix_keys), | ||
240 | }; | ||
241 | |||
236 | static struct pxa27x_keypad_platform_data mioa701_keypad_info = { | 242 | static struct pxa27x_keypad_platform_data mioa701_keypad_info = { |
237 | .matrix_key_rows = 3, | 243 | .matrix_key_rows = 3, |
238 | .matrix_key_cols = 3, | 244 | .matrix_key_cols = 3, |
239 | .matrix_key_map = mioa701_matrix_keys, | 245 | .matrix_keymap_data = &mioa701_matrix_keymap_data, |
240 | .matrix_key_map_size = ARRAY_SIZE(mioa701_matrix_keys), | ||
241 | }; | 246 | }; |
242 | 247 | ||
243 | /* | 248 | /* |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 909b713e5789..cf210b11ffcc 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -173,7 +173,7 @@ static inline void palmld_nor_init(void) {} | |||
173 | * GPIO keyboard | 173 | * GPIO keyboard |
174 | ******************************************************************************/ | 174 | ******************************************************************************/ |
175 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 175 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
176 | static unsigned int palmld_matrix_keys[] = { | 176 | static const unsigned int palmld_matrix_keys[] = { |
177 | KEY(0, 1, KEY_F2), | 177 | KEY(0, 1, KEY_F2), |
178 | KEY(0, 2, KEY_UP), | 178 | KEY(0, 2, KEY_UP), |
179 | 179 | ||
@@ -190,11 +190,15 @@ static unsigned int palmld_matrix_keys[] = { | |||
190 | KEY(3, 2, KEY_LEFT), | 190 | KEY(3, 2, KEY_LEFT), |
191 | }; | 191 | }; |
192 | 192 | ||
193 | static struct matrix_keymap_data palmld_matrix_keymap_data = { | ||
194 | .keymap = palmld_matrix_keys, | ||
195 | .keymap_size = ARRAY_SIZE(palmld_matrix_keys), | ||
196 | }; | ||
197 | |||
193 | static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { | 198 | static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { |
194 | .matrix_key_rows = 4, | 199 | .matrix_key_rows = 4, |
195 | .matrix_key_cols = 3, | 200 | .matrix_key_cols = 3, |
196 | .matrix_key_map = palmld_matrix_keys, | 201 | .matrix_keymap_data = &palmld_matrix_keymap_data, |
197 | .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys), | ||
198 | 202 | ||
199 | .debounce_interval = 30, | 203 | .debounce_interval = 30, |
200 | }; | 204 | }; |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 5033fd07968f..3ed9b029428b 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -108,7 +108,7 @@ static unsigned long palmt5_pin_config[] __initdata = { | |||
108 | * GPIO keyboard | 108 | * GPIO keyboard |
109 | ******************************************************************************/ | 109 | ******************************************************************************/ |
110 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 110 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
111 | static unsigned int palmt5_matrix_keys[] = { | 111 | static const unsigned int palmt5_matrix_keys[] = { |
112 | KEY(0, 0, KEY_POWER), | 112 | KEY(0, 0, KEY_POWER), |
113 | KEY(0, 1, KEY_F1), | 113 | KEY(0, 1, KEY_F1), |
114 | KEY(0, 2, KEY_ENTER), | 114 | KEY(0, 2, KEY_ENTER), |
@@ -124,11 +124,15 @@ static unsigned int palmt5_matrix_keys[] = { | |||
124 | KEY(3, 2, KEY_LEFT), | 124 | KEY(3, 2, KEY_LEFT), |
125 | }; | 125 | }; |
126 | 126 | ||
127 | static struct matrix_keymap_data palmt5_matrix_keymap_data = { | ||
128 | .keymap = palmt5_matrix_keys, | ||
129 | .keymap_size = ARRAY_SIZE(palmt5_matrix_keys), | ||
130 | }; | ||
131 | |||
127 | static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { | 132 | static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { |
128 | .matrix_key_rows = 4, | 133 | .matrix_key_rows = 4, |
129 | .matrix_key_cols = 3, | 134 | .matrix_key_cols = 3, |
130 | .matrix_key_map = palmt5_matrix_keys, | 135 | .matrix_keymap_data = &palmt5_matrix_keymap_data, |
131 | .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys), | ||
132 | 136 | ||
133 | .debounce_interval = 30, | 137 | .debounce_interval = 30, |
134 | }; | 138 | }; |
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c index d82a50b4a803..d8b937c870de 100644 --- a/arch/arm/mach-pxa/palmtreo.c +++ b/arch/arm/mach-pxa/palmtreo.c | |||
@@ -168,7 +168,7 @@ static unsigned long centro685_pin_config[] __initdata = { | |||
168 | * GPIO keyboard | 168 | * GPIO keyboard |
169 | ******************************************************************************/ | 169 | ******************************************************************************/ |
170 | #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x) | 170 | #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x) |
171 | static unsigned int treo680_matrix_keys[] = { | 171 | static const unsigned int treo680_matrix_keys[] = { |
172 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ | 172 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ |
173 | KEY(0, 1, KEY_LEFT), | 173 | KEY(0, 1, KEY_LEFT), |
174 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | 174 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ |
@@ -227,7 +227,7 @@ static unsigned int treo680_matrix_keys[] = { | |||
227 | KEY(7, 5, KEY_I), | 227 | KEY(7, 5, KEY_I), |
228 | }; | 228 | }; |
229 | 229 | ||
230 | static unsigned int centro_matrix_keys[] = { | 230 | static const unsigned int centro_matrix_keys[] = { |
231 | KEY(0, 0, KEY_F9), /* Home */ | 231 | KEY(0, 0, KEY_F9), /* Home */ |
232 | KEY(0, 1, KEY_LEFT), | 232 | KEY(0, 1, KEY_LEFT), |
233 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | 233 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ |
@@ -286,11 +286,20 @@ static unsigned int centro_matrix_keys[] = { | |||
286 | KEY(7, 5, KEY_I), | 286 | KEY(7, 5, KEY_I), |
287 | }; | 287 | }; |
288 | 288 | ||
289 | static struct matrix_keymap_data treo680_matrix_keymap_data = { | ||
290 | .keymap = treo680_matrix_keys, | ||
291 | .keymap_size = ARRAY_SIZE(treo680_matrix_keys), | ||
292 | }; | ||
293 | |||
294 | static struct matrix_keymap_data centro_matrix_keymap_data = { | ||
295 | .keymap = centro_matrix_keys, | ||
296 | .keymap_size = ARRAY_SIZE(centro_matrix_keys), | ||
297 | }; | ||
298 | |||
289 | static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { | 299 | static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { |
290 | .matrix_key_rows = 8, | 300 | .matrix_key_rows = 8, |
291 | .matrix_key_cols = 7, | 301 | .matrix_key_cols = 7, |
292 | .matrix_key_map = treo680_matrix_keys, | 302 | .matrix_keymap_data = &treo680_matrix_keymap_data, |
293 | .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys), | ||
294 | .direct_key_map = { KEY_CONNECT }, | 303 | .direct_key_map = { KEY_CONNECT }, |
295 | .direct_key_num = 1, | 304 | .direct_key_num = 1, |
296 | 305 | ||
@@ -301,10 +310,8 @@ static void __init palmtreo_kpc_init(void) | |||
301 | { | 310 | { |
302 | static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; | 311 | static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; |
303 | 312 | ||
304 | if (machine_is_centro()) { | 313 | if (machine_is_centro()) |
305 | data->matrix_key_map = centro_matrix_keys; | 314 | data->matrix_keymap_data = ¢ro_matrix_keymap_data; |
306 | data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys); | ||
307 | } | ||
308 | 315 | ||
309 | pxa_set_keypad_info(&treo680_keypad_pdata); | 316 | pxa_set_keypad_info(&treo680_keypad_pdata); |
310 | } | 317 | } |
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 627c93a7364c..83f830dd8ad8 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -176,7 +176,7 @@ static inline void palmtx_nor_init(void) {} | |||
176 | * GPIO keyboard | 176 | * GPIO keyboard |
177 | ******************************************************************************/ | 177 | ******************************************************************************/ |
178 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 178 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
179 | static unsigned int palmtx_matrix_keys[] = { | 179 | static const unsigned int palmtx_matrix_keys[] = { |
180 | KEY(0, 0, KEY_POWER), | 180 | KEY(0, 0, KEY_POWER), |
181 | KEY(0, 1, KEY_F1), | 181 | KEY(0, 1, KEY_F1), |
182 | KEY(0, 2, KEY_ENTER), | 182 | KEY(0, 2, KEY_ENTER), |
@@ -192,11 +192,15 @@ static unsigned int palmtx_matrix_keys[] = { | |||
192 | KEY(3, 2, KEY_LEFT), | 192 | KEY(3, 2, KEY_LEFT), |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static struct matrix_keymap_data palmtx_matrix_keymap_data = { | ||
196 | .keymap = palmtx_matrix_keys, | ||
197 | .keymap_size = ARRAY_SIZE(palmtx_matrix_keys), | ||
198 | }; | ||
199 | |||
195 | static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { | 200 | static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { |
196 | .matrix_key_rows = 4, | 201 | .matrix_key_rows = 4, |
197 | .matrix_key_cols = 3, | 202 | .matrix_key_cols = 3, |
198 | .matrix_key_map = palmtx_matrix_keys, | 203 | .matrix_keymap_data = &palmtx_matrix_keymap_data, |
199 | .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys), | ||
200 | 204 | ||
201 | .debounce_interval = 30, | 205 | .debounce_interval = 30, |
202 | }; | 206 | }; |
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index 18b7fcd98592..1a35ddf218da 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c | |||
@@ -140,7 +140,7 @@ static unsigned long palmz72_pin_config[] __initdata = { | |||
140 | * GPIO keyboard | 140 | * GPIO keyboard |
141 | ******************************************************************************/ | 141 | ******************************************************************************/ |
142 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 142 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
143 | static unsigned int palmz72_matrix_keys[] = { | 143 | static const unsigned int palmz72_matrix_keys[] = { |
144 | KEY(0, 0, KEY_POWER), | 144 | KEY(0, 0, KEY_POWER), |
145 | KEY(0, 1, KEY_F1), | 145 | KEY(0, 1, KEY_F1), |
146 | KEY(0, 2, KEY_ENTER), | 146 | KEY(0, 2, KEY_ENTER), |
@@ -156,11 +156,15 @@ static unsigned int palmz72_matrix_keys[] = { | |||
156 | KEY(3, 2, KEY_LEFT), | 156 | KEY(3, 2, KEY_LEFT), |
157 | }; | 157 | }; |
158 | 158 | ||
159 | static struct matrix_keymap_data almz72_matrix_keymap_data = { | ||
160 | .keymap = palmz72_matrix_keys, | ||
161 | .keymap_size = ARRAY_SIZE(palmz72_matrix_keys), | ||
162 | }; | ||
163 | |||
159 | static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { | 164 | static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { |
160 | .matrix_key_rows = 4, | 165 | .matrix_key_rows = 4, |
161 | .matrix_key_cols = 3, | 166 | .matrix_key_cols = 3, |
162 | .matrix_key_map = palmz72_matrix_keys, | 167 | .matrix_keymap_data = &almz72_matrix_keymap_data, |
163 | .matrix_key_map_size = ARRAY_SIZE(palmz72_matrix_keys), | ||
164 | 168 | ||
165 | .debounce_interval = 30, | 169 | .debounce_interval = 30, |
166 | }; | 170 | }; |
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index f55979c09a5f..4680efe55345 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c | |||
@@ -106,7 +106,7 @@ static struct platform_device smc91x_device = { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 108 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
109 | static unsigned int tavorevb_matrix_key_map[] = { | 109 | static const unsigned int tavorevb_matrix_key_map[] = { |
110 | /* KEY(row, col, key_code) */ | 110 | /* KEY(row, col, key_code) */ |
111 | KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C), | 111 | KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C), |
112 | KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G), | 112 | KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G), |
@@ -147,11 +147,15 @@ static unsigned int tavorevb_matrix_key_map[] = { | |||
147 | KEY(3, 3, KEY_F23), /* soft2 */ | 147 | KEY(3, 3, KEY_F23), /* soft2 */ |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static struct matrix_keymap_data tavorevb_matrix_keymap_data = { | ||
151 | .keymap = tavorevb_matrix_key_map, | ||
152 | .keymap_size = ARRAY_SIZE(tavorevb_matrix_key_map), | ||
153 | }; | ||
154 | |||
150 | static struct pxa27x_keypad_platform_data tavorevb_keypad_info = { | 155 | static struct pxa27x_keypad_platform_data tavorevb_keypad_info = { |
151 | .matrix_key_rows = 7, | 156 | .matrix_key_rows = 7, |
152 | .matrix_key_cols = 7, | 157 | .matrix_key_cols = 7, |
153 | .matrix_key_map = tavorevb_matrix_key_map, | 158 | .matrix_keymap_data = &tavorevb_matrix_keymap_data, |
154 | .matrix_key_map_size = ARRAY_SIZE(tavorevb_matrix_key_map), | ||
155 | .debounce_interval = 30, | 159 | .debounce_interval = 30, |
156 | }; | 160 | }; |
157 | 161 | ||
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index 989903a7e467..2513d8f4931f 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c | |||
@@ -345,7 +345,7 @@ static inline void z2_leds_init(void) {} | |||
345 | * GPIO keyboard | 345 | * GPIO keyboard |
346 | ******************************************************************************/ | 346 | ******************************************************************************/ |
347 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 347 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
348 | static unsigned int z2_matrix_keys[] = { | 348 | static const unsigned int z2_matrix_keys[] = { |
349 | KEY(0, 0, KEY_OPTION), | 349 | KEY(0, 0, KEY_OPTION), |
350 | KEY(1, 0, KEY_UP), | 350 | KEY(1, 0, KEY_UP), |
351 | KEY(2, 0, KEY_DOWN), | 351 | KEY(2, 0, KEY_DOWN), |
@@ -405,11 +405,15 @@ static unsigned int z2_matrix_keys[] = { | |||
405 | KEY(5, 7, KEY_DOT), | 405 | KEY(5, 7, KEY_DOT), |
406 | }; | 406 | }; |
407 | 407 | ||
408 | static struct matrix_keymap_data z2_matrix_keymap_data = { | ||
409 | .keymap = z2_matrix_keys, | ||
410 | .keymap_size = ARRAY_SIZE(z2_matrix_keys), | ||
411 | }; | ||
412 | |||
408 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { | 413 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { |
409 | .matrix_key_rows = 7, | 414 | .matrix_key_rows = 7, |
410 | .matrix_key_cols = 8, | 415 | .matrix_key_cols = 8, |
411 | .matrix_key_map = z2_matrix_keys, | 416 | .matrix_keymap_data = &z2_matrix_keymap_data, |
412 | .matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys), | ||
413 | 417 | ||
414 | .debounce_interval = 30, | 418 | .debounce_interval = 30, |
415 | }; | 419 | }; |
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 1f00d650ac27..36cf7cf95ec1 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -263,7 +263,7 @@ static inline void zylonite_init_mmc(void) {} | |||
263 | #endif | 263 | #endif |
264 | 264 | ||
265 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | 265 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
266 | static unsigned int zylonite_matrix_key_map[] = { | 266 | static const unsigned int zylonite_matrix_key_map[] = { |
267 | /* KEY(row, col, key_code) */ | 267 | /* KEY(row, col, key_code) */ |
268 | KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), | 268 | KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), |
269 | KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), | 269 | KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), |
@@ -306,11 +306,15 @@ static unsigned int zylonite_matrix_key_map[] = { | |||
306 | KEY(0, 3, KEY_AUX), /* contact */ | 306 | KEY(0, 3, KEY_AUX), /* contact */ |
307 | }; | 307 | }; |
308 | 308 | ||
309 | static struct matrix_keymap_data zylonite_matrix_keymap_data = { | ||
310 | .keymap = zylonite_matrix_key_map, | ||
311 | .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map), | ||
312 | }; | ||
313 | |||
309 | static struct pxa27x_keypad_platform_data zylonite_keypad_info = { | 314 | static struct pxa27x_keypad_platform_data zylonite_keypad_info = { |
310 | .matrix_key_rows = 8, | 315 | .matrix_key_rows = 8, |
311 | .matrix_key_cols = 8, | 316 | .matrix_key_cols = 8, |
312 | .matrix_key_map = zylonite_matrix_key_map, | 317 | .matrix_keymap_data = &zylonite_matrix_keymap_data, |
313 | .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map), | ||
314 | 318 | ||
315 | .enable_rotary0 = 1, | 319 | .enable_rotary0 = 1, |
316 | .rotary0_up_key = KEY_UP, | 320 | .rotary0_up_key = KEY_UP, |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 37c366623fc0..706e11bb6a32 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -451,6 +451,7 @@ config KEYBOARD_OPENCORES | |||
451 | config KEYBOARD_PXA27x | 451 | config KEYBOARD_PXA27x |
452 | tristate "PXA27x/PXA3xx keypad support" | 452 | tristate "PXA27x/PXA3xx keypad support" |
453 | depends on PXA27x || PXA3xx || ARCH_MMP | 453 | depends on PXA27x || PXA3xx || ARCH_MMP |
454 | select INPUT_MATRIXKMAP | ||
454 | help | 455 | help |
455 | Enable support for PXA27x/PXA3xx keypad controller. | 456 | Enable support for PXA27x/PXA3xx keypad controller. |
456 | 457 | ||
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index b674e7aca404..5b2d8764dd37 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -118,25 +118,30 @@ struct pxa27x_keypad { | |||
118 | unsigned int direct_key_mask; | 118 | unsigned int direct_key_mask; |
119 | }; | 119 | }; |
120 | 120 | ||
121 | static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | 121 | static int pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) |
122 | { | 122 | { |
123 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | 123 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; |
124 | struct input_dev *input_dev = keypad->input_dev; | 124 | struct input_dev *input_dev = keypad->input_dev; |
125 | const struct matrix_keymap_data *keymap_data = | ||
126 | pdata ? pdata->matrix_keymap_data : NULL; | ||
125 | unsigned short keycode; | 127 | unsigned short keycode; |
126 | int i; | 128 | int i; |
129 | int error; | ||
127 | 130 | ||
128 | for (i = 0; i < pdata->matrix_key_map_size; i++) { | 131 | error = matrix_keypad_build_keymap(keymap_data, NULL, |
129 | unsigned int key = pdata->matrix_key_map[i]; | 132 | pdata->matrix_key_rows, |
130 | unsigned int row = KEY_ROW(key); | 133 | pdata->matrix_key_cols, |
131 | unsigned int col = KEY_COL(key); | 134 | keypad->keycodes, input_dev); |
132 | unsigned int scancode = MATRIX_SCAN_CODE(row, col, | 135 | if (error) |
133 | MATRIX_ROW_SHIFT); | 136 | return error; |
134 | 137 | ||
135 | keycode = KEY_VAL(key); | 138 | /* |
136 | keypad->keycodes[scancode] = keycode; | 139 | * The keycodes may not only include matrix keys but also the direct |
137 | __set_bit(keycode, input_dev->keybit); | 140 | * or rotary keys. |
138 | } | 141 | */ |
142 | input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); | ||
139 | 143 | ||
144 | /* For direct keys. */ | ||
140 | for (i = 0; i < pdata->direct_key_num; i++) { | 145 | for (i = 0; i < pdata->direct_key_num; i++) { |
141 | keycode = pdata->direct_key_map[i]; | 146 | keycode = pdata->direct_key_map[i]; |
142 | keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode; | 147 | keypad->keycodes[MAX_MATRIX_KEY_NUM + i] = keycode; |
@@ -178,6 +183,8 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
178 | } | 183 | } |
179 | 184 | ||
180 | __clear_bit(KEY_RESERVED, input_dev->keybit); | 185 | __clear_bit(KEY_RESERVED, input_dev->keybit); |
186 | |||
187 | return 0; | ||
181 | } | 188 | } |
182 | 189 | ||
183 | static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) | 190 | static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad) |
@@ -555,7 +562,11 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) | |||
555 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 562 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
556 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | 563 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); |
557 | 564 | ||
558 | pxa27x_keypad_build_keycode(keypad); | 565 | error = pxa27x_keypad_build_keycode(keypad); |
566 | if (error) { | ||
567 | dev_err(&pdev->dev, "failed to build keycode\n"); | ||
568 | goto failed_put_clk; | ||
569 | } | ||
559 | 570 | ||
560 | if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) || | 571 | if ((pdata->enable_rotary0 && keypad->rotary_rel_code[0] != -1) || |
561 | (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) { | 572 | (pdata->enable_rotary1 && keypad->rotary_rel_code[1] != -1)) { |
diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h index 5ce8d5e6ea51..24625569d16d 100644 --- a/include/linux/platform_data/keypad-pxa27x.h +++ b/include/linux/platform_data/keypad-pxa27x.h | |||
@@ -36,10 +36,9 @@ | |||
36 | struct pxa27x_keypad_platform_data { | 36 | struct pxa27x_keypad_platform_data { |
37 | 37 | ||
38 | /* code map for the matrix keys */ | 38 | /* code map for the matrix keys */ |
39 | const struct matrix_keymap_data *matrix_keymap_data; | ||
39 | unsigned int matrix_key_rows; | 40 | unsigned int matrix_key_rows; |
40 | unsigned int matrix_key_cols; | 41 | unsigned int matrix_key_cols; |
41 | unsigned int *matrix_key_map; | ||
42 | int matrix_key_map_size; | ||
43 | 42 | ||
44 | /* direct keys */ | 43 | /* direct keys */ |
45 | int direct_key_num; | 44 | int direct_key_num; |