diff options
author | Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | 2010-12-20 16:09:22 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-12-22 14:11:47 -0500 |
commit | da1f026b532ce944d74461497dc6d8c16456466e (patch) | |
tree | 227cd89307e0094d02e944a29225b19c2fca286b | |
parent | 4e012e5f246d4da924b14d453452fd0838d4e03b (diff) |
Keyboard: omap-keypad: use matrix_keypad.h
Most keypad drivers make use of the <linux/input/matrix_keypad.h>
defined macros, structures and inline functions.
Convert omap-keypad driver to use those as well, as suggested by a
compile time warning, hardcoded into the OMAP <palt/keypad.h>.
Created against linux-2.6.37-rc5.
Tested on Amstrad Delta.
Compile tested with omap1_defconfig and omap2plus_defconfig shrinked to
board-h4.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Reviewed-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 128 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-fsample.c | 67 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h2.c | 75 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h3.c | 75 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-htcherald.c | 98 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-innovator.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 29 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 21 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-palmte.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-palmtt.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-palmz71.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-perseus2.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-sx1.c | 57 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-h4.c | 63 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/keypad.h | 35 | ||||
-rw-r--r-- | drivers/input/keyboard/omap-keypad.c | 41 | ||||
-rw-r--r-- | include/linux/input/matrix_keypad.h | 2 |
17 files changed, 457 insertions, 410 deletions
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index e1439506eba9..bd0495a9ac3b 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
@@ -43,84 +43,82 @@ | |||
43 | static u8 ams_delta_latch1_reg; | 43 | static u8 ams_delta_latch1_reg; |
44 | static u16 ams_delta_latch2_reg; | 44 | static u16 ams_delta_latch2_reg; |
45 | 45 | ||
46 | static int ams_delta_keymap[] = { | 46 | static const unsigned int ams_delta_keymap[] = { |
47 | KEY(0, 0, KEY_F1), /* Advert */ | 47 | KEY(0, 0, KEY_F1), /* Advert */ |
48 | 48 | ||
49 | KEY(3, 0, KEY_COFFEE), /* Games */ | 49 | KEY(0, 3, KEY_COFFEE), /* Games */ |
50 | KEY(2, 0, KEY_QUESTION), /* Directory */ | 50 | KEY(0, 2, KEY_QUESTION), /* Directory */ |
51 | KEY(3, 2, KEY_CONNECT), /* Internet */ | 51 | KEY(2, 3, KEY_CONNECT), /* Internet */ |
52 | KEY(2, 1, KEY_SHOP), /* Services */ | 52 | KEY(1, 2, KEY_SHOP), /* Services */ |
53 | KEY(1, 1, KEY_PHONE), /* VoiceMail */ | 53 | KEY(1, 1, KEY_PHONE), /* VoiceMail */ |
54 | 54 | ||
55 | KEY(1, 0, KEY_DELETE), /* Delete */ | 55 | KEY(0, 1, KEY_DELETE), /* Delete */ |
56 | KEY(2, 2, KEY_PLAY), /* Play */ | 56 | KEY(2, 2, KEY_PLAY), /* Play */ |
57 | KEY(0, 1, KEY_PAGEUP), /* Up */ | 57 | KEY(1, 0, KEY_PAGEUP), /* Up */ |
58 | KEY(3, 1, KEY_PAGEDOWN), /* Down */ | 58 | KEY(1, 3, KEY_PAGEDOWN), /* Down */ |
59 | KEY(0, 2, KEY_EMAIL), /* ReadEmail */ | 59 | KEY(2, 0, KEY_EMAIL), /* ReadEmail */ |
60 | KEY(1, 2, KEY_STOP), /* Stop */ | 60 | KEY(2, 1, KEY_STOP), /* Stop */ |
61 | 61 | ||
62 | /* Numeric keypad portion */ | 62 | /* Numeric keypad portion */ |
63 | KEY(7, 0, KEY_KP1), | 63 | KEY(0, 7, KEY_KP1), |
64 | KEY(6, 0, KEY_KP2), | 64 | KEY(0, 6, KEY_KP2), |
65 | KEY(5, 0, KEY_KP3), | 65 | KEY(0, 5, KEY_KP3), |
66 | KEY(7, 1, KEY_KP4), | 66 | KEY(1, 7, KEY_KP4), |
67 | KEY(6, 1, KEY_KP5), | 67 | KEY(1, 6, KEY_KP5), |
68 | KEY(5, 1, KEY_KP6), | 68 | KEY(1, 5, KEY_KP6), |
69 | KEY(7, 2, KEY_KP7), | 69 | KEY(2, 7, KEY_KP7), |
70 | KEY(6, 2, KEY_KP8), | 70 | KEY(2, 6, KEY_KP8), |
71 | KEY(5, 2, KEY_KP9), | 71 | KEY(2, 5, KEY_KP9), |
72 | KEY(6, 3, KEY_KP0), | 72 | KEY(3, 6, KEY_KP0), |
73 | KEY(7, 3, KEY_KPASTERISK), | 73 | KEY(3, 7, KEY_KPASTERISK), |
74 | KEY(5, 3, KEY_KPDOT), /* # key */ | 74 | KEY(3, 5, KEY_KPDOT), /* # key */ |
75 | KEY(2, 7, KEY_NUMLOCK), /* Mute */ | 75 | KEY(7, 2, KEY_NUMLOCK), /* Mute */ |
76 | KEY(1, 7, KEY_KPMINUS), /* Recall */ | 76 | KEY(7, 1, KEY_KPMINUS), /* Recall */ |
77 | KEY(1, 6, KEY_KPPLUS), /* Redial */ | 77 | KEY(6, 1, KEY_KPPLUS), /* Redial */ |
78 | KEY(6, 7, KEY_KPSLASH), /* Handsfree */ | 78 | KEY(7, 6, KEY_KPSLASH), /* Handsfree */ |
79 | KEY(0, 6, KEY_ENTER), /* Video */ | 79 | KEY(6, 0, KEY_ENTER), /* Video */ |
80 | 80 | ||
81 | KEY(4, 7, KEY_CAMERA), /* Photo */ | 81 | KEY(7, 4, KEY_CAMERA), /* Photo */ |
82 | 82 | ||
83 | KEY(4, 0, KEY_F2), /* Home */ | 83 | KEY(0, 4, KEY_F2), /* Home */ |
84 | KEY(4, 1, KEY_F3), /* Office */ | 84 | KEY(1, 4, KEY_F3), /* Office */ |
85 | KEY(4, 2, KEY_F4), /* Mobile */ | 85 | KEY(2, 4, KEY_F4), /* Mobile */ |
86 | KEY(7, 7, KEY_F5), /* SMS */ | 86 | KEY(7, 7, KEY_F5), /* SMS */ |
87 | KEY(5, 7, KEY_F6), /* Email */ | 87 | KEY(7, 5, KEY_F6), /* Email */ |
88 | 88 | ||
89 | /* QWERTY portion of keypad */ | 89 | /* QWERTY portion of keypad */ |
90 | KEY(4, 3, KEY_Q), | 90 | KEY(3, 4, KEY_Q), |
91 | KEY(3, 3, KEY_W), | 91 | KEY(3, 3, KEY_W), |
92 | KEY(2, 3, KEY_E), | 92 | KEY(3, 2, KEY_E), |
93 | KEY(1, 3, KEY_R), | 93 | KEY(3, 1, KEY_R), |
94 | KEY(0, 3, KEY_T), | 94 | KEY(3, 0, KEY_T), |
95 | KEY(7, 4, KEY_Y), | 95 | KEY(4, 7, KEY_Y), |
96 | KEY(6, 4, KEY_U), | 96 | KEY(4, 6, KEY_U), |
97 | KEY(5, 4, KEY_I), | 97 | KEY(4, 5, KEY_I), |
98 | KEY(4, 4, KEY_O), | 98 | KEY(4, 4, KEY_O), |
99 | KEY(3, 4, KEY_P), | 99 | KEY(4, 3, KEY_P), |
100 | 100 | ||
101 | KEY(2, 4, KEY_A), | 101 | KEY(4, 2, KEY_A), |
102 | KEY(1, 4, KEY_S), | 102 | KEY(4, 1, KEY_S), |
103 | KEY(0, 4, KEY_D), | 103 | KEY(4, 0, KEY_D), |
104 | KEY(7, 5, KEY_F), | 104 | KEY(5, 7, KEY_F), |
105 | KEY(6, 5, KEY_G), | 105 | KEY(5, 6, KEY_G), |
106 | KEY(5, 5, KEY_H), | 106 | KEY(5, 5, KEY_H), |
107 | KEY(4, 5, KEY_J), | 107 | KEY(5, 4, KEY_J), |
108 | KEY(3, 5, KEY_K), | 108 | KEY(5, 3, KEY_K), |
109 | KEY(2, 5, KEY_L), | 109 | KEY(5, 2, KEY_L), |
110 | 110 | ||
111 | KEY(1, 5, KEY_Z), | 111 | KEY(5, 1, KEY_Z), |
112 | KEY(0, 5, KEY_X), | 112 | KEY(5, 0, KEY_X), |
113 | KEY(7, 6, KEY_C), | 113 | KEY(6, 7, KEY_C), |
114 | KEY(6, 6, KEY_V), | 114 | KEY(6, 6, KEY_V), |
115 | KEY(5, 6, KEY_B), | 115 | KEY(6, 5, KEY_B), |
116 | KEY(4, 6, KEY_N), | 116 | KEY(6, 4, KEY_N), |
117 | KEY(3, 6, KEY_M), | 117 | KEY(6, 3, KEY_M), |
118 | KEY(2, 6, KEY_SPACE), | 118 | KEY(6, 2, KEY_SPACE), |
119 | 119 | ||
120 | KEY(0, 7, KEY_LEFTSHIFT), /* Vol up */ | 120 | KEY(7, 0, KEY_LEFTSHIFT), /* Vol up */ |
121 | KEY(3, 7, KEY_LEFTCTRL), /* Vol down */ | 121 | KEY(7, 3, KEY_LEFTCTRL), /* Vol down */ |
122 | |||
123 | 0 | ||
124 | }; | 122 | }; |
125 | 123 | ||
126 | void ams_delta_latch1_write(u8 mask, u8 value) | 124 | void ams_delta_latch1_write(u8 mask, u8 value) |
@@ -189,11 +187,15 @@ static struct resource ams_delta_kp_resources[] = { | |||
189 | }, | 187 | }, |
190 | }; | 188 | }; |
191 | 189 | ||
190 | static const struct matrix_keymap_data ams_delta_keymap_data = { | ||
191 | .keymap = ams_delta_keymap, | ||
192 | .keymap_size = ARRAY_SIZE(ams_delta_keymap), | ||
193 | }; | ||
194 | |||
192 | static struct omap_kp_platform_data ams_delta_kp_data = { | 195 | static struct omap_kp_platform_data ams_delta_kp_data = { |
193 | .rows = 8, | 196 | .rows = 8, |
194 | .cols = 8, | 197 | .cols = 8, |
195 | .keymap = ams_delta_keymap, | 198 | .keymap_data = &ams_delta_keymap_data, |
196 | .keymapsize = ARRAY_SIZE(ams_delta_keymap), | ||
197 | .delay = 9, | 199 | .delay = 9, |
198 | }; | 200 | }; |
199 | 201 | ||
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c index 0c3f396328bd..0efb9dbae44c 100644 --- a/arch/arm/mach-omap1/board-fsample.c +++ b/arch/arm/mach-omap1/board-fsample.c | |||
@@ -69,36 +69,35 @@ | |||
69 | #define fsample_cpld_clear(bit) \ | 69 | #define fsample_cpld_clear(bit) \ |
70 | fsample_cpld_write(0xf0 | ((bit) & 15), FSAMPLE_CPLD_SET_CLR) | 70 | fsample_cpld_write(0xf0 | ((bit) & 15), FSAMPLE_CPLD_SET_CLR) |
71 | 71 | ||
72 | static int fsample_keymap[] = { | 72 | static const unsigned int fsample_keymap[] = { |
73 | KEY(0,0,KEY_UP), | 73 | KEY(0, 0, KEY_UP), |
74 | KEY(0,1,KEY_RIGHT), | 74 | KEY(1, 0, KEY_RIGHT), |
75 | KEY(0,2,KEY_LEFT), | 75 | KEY(2, 0, KEY_LEFT), |
76 | KEY(0,3,KEY_DOWN), | 76 | KEY(3, 0, KEY_DOWN), |
77 | KEY(0,4,KEY_ENTER), | 77 | KEY(4, 0, KEY_ENTER), |
78 | KEY(1,0,KEY_F10), | 78 | KEY(0, 1, KEY_F10), |
79 | KEY(1,1,KEY_SEND), | 79 | KEY(1, 1, KEY_SEND), |
80 | KEY(1,2,KEY_END), | 80 | KEY(2, 1, KEY_END), |
81 | KEY(1,3,KEY_VOLUMEDOWN), | 81 | KEY(3, 1, KEY_VOLUMEDOWN), |
82 | KEY(1,4,KEY_VOLUMEUP), | 82 | KEY(4, 1, KEY_VOLUMEUP), |
83 | KEY(1,5,KEY_RECORD), | 83 | KEY(5, 1, KEY_RECORD), |
84 | KEY(2,0,KEY_F9), | 84 | KEY(0, 2, KEY_F9), |
85 | KEY(2,1,KEY_3), | 85 | KEY(1, 2, KEY_3), |
86 | KEY(2,2,KEY_6), | 86 | KEY(2, 2, KEY_6), |
87 | KEY(2,3,KEY_9), | 87 | KEY(3, 2, KEY_9), |
88 | KEY(2,4,KEY_KPDOT), | 88 | KEY(4, 2, KEY_KPDOT), |
89 | KEY(3,0,KEY_BACK), | 89 | KEY(0, 3, KEY_BACK), |
90 | KEY(3,1,KEY_2), | 90 | KEY(1, 3, KEY_2), |
91 | KEY(3,2,KEY_5), | 91 | KEY(2, 3, KEY_5), |
92 | KEY(3,3,KEY_8), | 92 | KEY(3, 3, KEY_8), |
93 | KEY(3,4,KEY_0), | 93 | KEY(4, 3, KEY_0), |
94 | KEY(3,5,KEY_KPSLASH), | 94 | KEY(5, 3, KEY_KPSLASH), |
95 | KEY(4,0,KEY_HOME), | 95 | KEY(0, 4, KEY_HOME), |
96 | KEY(4,1,KEY_1), | 96 | KEY(1, 4, KEY_1), |
97 | KEY(4,2,KEY_4), | 97 | KEY(2, 4, KEY_4), |
98 | KEY(4,3,KEY_7), | 98 | KEY(3, 4, KEY_7), |
99 | KEY(4,4,KEY_KPASTERISK), | 99 | KEY(4, 4, KEY_KPASTERISK), |
100 | KEY(4,5,KEY_POWER), | 100 | KEY(5, 4, KEY_POWER), |
101 | 0 | ||
102 | }; | 101 | }; |
103 | 102 | ||
104 | static struct smc91x_platdata smc91x_info = { | 103 | static struct smc91x_platdata smc91x_info = { |
@@ -253,11 +252,15 @@ static struct resource kp_resources[] = { | |||
253 | }, | 252 | }, |
254 | }; | 253 | }; |
255 | 254 | ||
255 | static const struct matrix_keymap_data fsample_keymap_data = { | ||
256 | .keymap = fsample_keymap, | ||
257 | .keymap_size = ARRAY_SIZE(fsample_keymap), | ||
258 | }; | ||
259 | |||
256 | static struct omap_kp_platform_data kp_data = { | 260 | static struct omap_kp_platform_data kp_data = { |
257 | .rows = 8, | 261 | .rows = 8, |
258 | .cols = 8, | 262 | .cols = 8, |
259 | .keymap = fsample_keymap, | 263 | .keymap_data = &fsample_keymap_data, |
260 | .keymapsize = ARRAY_SIZE(fsample_keymap), | ||
261 | .delay = 4, | 264 | .delay = 4, |
262 | }; | 265 | }; |
263 | 266 | ||
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 082a73ca5564..28b84aa9bdba 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -52,43 +52,42 @@ | |||
52 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ | 52 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ |
53 | #define OMAP1610_ETHR_START 0x04000300 | 53 | #define OMAP1610_ETHR_START 0x04000300 |
54 | 54 | ||
55 | static int h2_keymap[] = { | 55 | static const unsigned int h2_keymap[] = { |
56 | KEY(0, 0, KEY_LEFT), | 56 | KEY(0, 0, KEY_LEFT), |
57 | KEY(0, 1, KEY_RIGHT), | 57 | KEY(1, 0, KEY_RIGHT), |
58 | KEY(0, 2, KEY_3), | 58 | KEY(2, 0, KEY_3), |
59 | KEY(0, 3, KEY_F10), | 59 | KEY(3, 0, KEY_F10), |
60 | KEY(0, 4, KEY_F5), | 60 | KEY(4, 0, KEY_F5), |
61 | KEY(0, 5, KEY_9), | 61 | KEY(5, 0, KEY_9), |
62 | KEY(1, 0, KEY_DOWN), | 62 | KEY(0, 1, KEY_DOWN), |
63 | KEY(1, 1, KEY_UP), | 63 | KEY(1, 1, KEY_UP), |
64 | KEY(1, 2, KEY_2), | 64 | KEY(2, 1, KEY_2), |
65 | KEY(1, 3, KEY_F9), | 65 | KEY(3, 1, KEY_F9), |
66 | KEY(1, 4, KEY_F7), | 66 | KEY(4, 1, KEY_F7), |
67 | KEY(1, 5, KEY_0), | 67 | KEY(5, 1, KEY_0), |
68 | KEY(2, 0, KEY_ENTER), | 68 | KEY(0, 2, KEY_ENTER), |
69 | KEY(2, 1, KEY_6), | 69 | KEY(1, 2, KEY_6), |
70 | KEY(2, 2, KEY_1), | 70 | KEY(2, 2, KEY_1), |
71 | KEY(2, 3, KEY_F2), | 71 | KEY(3, 2, KEY_F2), |
72 | KEY(2, 4, KEY_F6), | 72 | KEY(4, 2, KEY_F6), |
73 | KEY(2, 5, KEY_HOME), | 73 | KEY(5, 2, KEY_HOME), |
74 | KEY(3, 0, KEY_8), | 74 | KEY(0, 3, KEY_8), |
75 | KEY(3, 1, KEY_5), | 75 | KEY(1, 3, KEY_5), |
76 | KEY(3, 2, KEY_F12), | 76 | KEY(2, 3, KEY_F12), |
77 | KEY(3, 3, KEY_F3), | 77 | KEY(3, 3, KEY_F3), |
78 | KEY(3, 4, KEY_F8), | 78 | KEY(4, 3, KEY_F8), |
79 | KEY(3, 5, KEY_END), | 79 | KEY(5, 3, KEY_END), |
80 | KEY(4, 0, KEY_7), | 80 | KEY(0, 4, KEY_7), |
81 | KEY(4, 1, KEY_4), | 81 | KEY(1, 4, KEY_4), |
82 | KEY(4, 2, KEY_F11), | 82 | KEY(2, 4, KEY_F11), |
83 | KEY(4, 3, KEY_F1), | 83 | KEY(3, 4, KEY_F1), |
84 | KEY(4, 4, KEY_F4), | 84 | KEY(4, 4, KEY_F4), |
85 | KEY(4, 5, KEY_ESC), | 85 | KEY(5, 4, KEY_ESC), |
86 | KEY(5, 0, KEY_F13), | 86 | KEY(0, 5, KEY_F13), |
87 | KEY(5, 1, KEY_F14), | 87 | KEY(1, 5, KEY_F14), |
88 | KEY(5, 2, KEY_F15), | 88 | KEY(2, 5, KEY_F15), |
89 | KEY(5, 3, KEY_F16), | 89 | KEY(3, 5, KEY_F16), |
90 | KEY(5, 4, KEY_SLEEP), | 90 | KEY(4, 5, KEY_SLEEP), |
91 | 0 | ||
92 | }; | 91 | }; |
93 | 92 | ||
94 | static struct mtd_partition h2_nor_partitions[] = { | 93 | static struct mtd_partition h2_nor_partitions[] = { |
@@ -270,14 +269,18 @@ static struct resource h2_kp_resources[] = { | |||
270 | }, | 269 | }, |
271 | }; | 270 | }; |
272 | 271 | ||
272 | static const struct matrix_keymap_data h2_keymap_data = { | ||
273 | .keymap = h2_keymap, | ||
274 | .keymap_size = ARRAY_SIZE(h2_keymap), | ||
275 | }; | ||
276 | |||
273 | static struct omap_kp_platform_data h2_kp_data = { | 277 | static struct omap_kp_platform_data h2_kp_data = { |
274 | .rows = 8, | 278 | .rows = 8, |
275 | .cols = 8, | 279 | .cols = 8, |
276 | .keymap = h2_keymap, | 280 | .keymap_data = &h2_keymap_data, |
277 | .keymapsize = ARRAY_SIZE(h2_keymap), | 281 | .rep = true, |
278 | .rep = 1, | ||
279 | .delay = 9, | 282 | .delay = 9, |
280 | .dbounce = 1, | 283 | .dbounce = true, |
281 | }; | 284 | }; |
282 | 285 | ||
283 | static struct platform_device h2_kp_device = { | 286 | static struct platform_device h2_kp_device = { |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index d2cff5022fe5..dbc8b8d882ba 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -56,43 +56,42 @@ | |||
56 | 56 | ||
57 | #define H3_TS_GPIO 48 | 57 | #define H3_TS_GPIO 48 |
58 | 58 | ||
59 | static int h3_keymap[] = { | 59 | static const unsigned int h3_keymap[] = { |
60 | KEY(0, 0, KEY_LEFT), | 60 | KEY(0, 0, KEY_LEFT), |
61 | KEY(0, 1, KEY_RIGHT), | 61 | KEY(1, 0, KEY_RIGHT), |
62 | KEY(0, 2, KEY_3), | 62 | KEY(2, 0, KEY_3), |
63 | KEY(0, 3, KEY_F10), | 63 | KEY(3, 0, KEY_F10), |
64 | KEY(0, 4, KEY_F5), | 64 | KEY(4, 0, KEY_F5), |
65 | KEY(0, 5, KEY_9), | 65 | KEY(5, 0, KEY_9), |
66 | KEY(1, 0, KEY_DOWN), | 66 | KEY(0, 1, KEY_DOWN), |
67 | KEY(1, 1, KEY_UP), | 67 | KEY(1, 1, KEY_UP), |
68 | KEY(1, 2, KEY_2), | 68 | KEY(2, 1, KEY_2), |
69 | KEY(1, 3, KEY_F9), | 69 | KEY(3, 1, KEY_F9), |
70 | KEY(1, 4, KEY_F7), | 70 | KEY(4, 1, KEY_F7), |
71 | KEY(1, 5, KEY_0), | 71 | KEY(5, 1, KEY_0), |
72 | KEY(2, 0, KEY_ENTER), | 72 | KEY(0, 2, KEY_ENTER), |
73 | KEY(2, 1, KEY_6), | 73 | KEY(1, 2, KEY_6), |
74 | KEY(2, 2, KEY_1), | 74 | KEY(2, 2, KEY_1), |
75 | KEY(2, 3, KEY_F2), | 75 | KEY(3, 2, KEY_F2), |
76 | KEY(2, 4, KEY_F6), | 76 | KEY(4, 2, KEY_F6), |
77 | KEY(2, 5, KEY_HOME), | 77 | KEY(5, 2, KEY_HOME), |
78 | KEY(3, 0, KEY_8), | 78 | KEY(0, 3, KEY_8), |
79 | KEY(3, 1, KEY_5), | 79 | KEY(1, 3, KEY_5), |
80 | KEY(3, 2, KEY_F12), | 80 | KEY(2, 3, KEY_F12), |
81 | KEY(3, 3, KEY_F3), | 81 | KEY(3, 3, KEY_F3), |
82 | KEY(3, 4, KEY_F8), | 82 | KEY(4, 3, KEY_F8), |
83 | KEY(3, 5, KEY_END), | 83 | KEY(5, 3, KEY_END), |
84 | KEY(4, 0, KEY_7), | 84 | KEY(0, 4, KEY_7), |
85 | KEY(4, 1, KEY_4), | 85 | KEY(1, 4, KEY_4), |
86 | KEY(4, 2, KEY_F11), | 86 | KEY(2, 4, KEY_F11), |
87 | KEY(4, 3, KEY_F1), | 87 | KEY(3, 4, KEY_F1), |
88 | KEY(4, 4, KEY_F4), | 88 | KEY(4, 4, KEY_F4), |
89 | KEY(4, 5, KEY_ESC), | 89 | KEY(5, 4, KEY_ESC), |
90 | KEY(5, 0, KEY_F13), | 90 | KEY(0, 5, KEY_F13), |
91 | KEY(5, 1, KEY_F14), | 91 | KEY(1, 5, KEY_F14), |
92 | KEY(5, 2, KEY_F15), | 92 | KEY(2, 5, KEY_F15), |
93 | KEY(5, 3, KEY_F16), | 93 | KEY(3, 5, KEY_F16), |
94 | KEY(5, 4, KEY_SLEEP), | 94 | KEY(4, 5, KEY_SLEEP), |
95 | 0 | ||
96 | }; | 95 | }; |
97 | 96 | ||
98 | 97 | ||
@@ -305,14 +304,18 @@ static struct resource h3_kp_resources[] = { | |||
305 | }, | 304 | }, |
306 | }; | 305 | }; |
307 | 306 | ||
307 | static const struct matrix_keymap_data h3_keymap_data = { | ||
308 | .keymap = h3_keymap, | ||
309 | .keymap_size = ARRAY_SIZE(h3_keymap), | ||
310 | }; | ||
311 | |||
308 | static struct omap_kp_platform_data h3_kp_data = { | 312 | static struct omap_kp_platform_data h3_kp_data = { |
309 | .rows = 8, | 313 | .rows = 8, |
310 | .cols = 8, | 314 | .cols = 8, |
311 | .keymap = h3_keymap, | 315 | .keymap_data = &h3_keymap_data, |
312 | .keymapsize = ARRAY_SIZE(h3_keymap), | 316 | .rep = true, |
313 | .rep = 1, | ||
314 | .delay = 9, | 317 | .delay = 9, |
315 | .dbounce = 1, | 318 | .dbounce = true, |
316 | }; | 319 | }; |
317 | 320 | ||
318 | static struct platform_device h3_kp_device = { | 321 | static struct platform_device h3_kp_device = { |
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c index 742c6d107268..f2c5c585bc83 100644 --- a/arch/arm/mach-omap1/board-htcherald.c +++ b/arch/arm/mach-omap1/board-htcherald.c | |||
@@ -180,64 +180,68 @@ | |||
180 | 180 | ||
181 | /* Keyboard definition */ | 181 | /* Keyboard definition */ |
182 | 182 | ||
183 | static int htc_herald_keymap[] = { | 183 | static const unsigned int htc_herald_keymap[] = { |
184 | KEY(0, 0, KEY_RECORD), /* Mail button */ | 184 | KEY(0, 0, KEY_RECORD), /* Mail button */ |
185 | KEY(0, 1, KEY_CAMERA), /* Camera */ | 185 | KEY(1, 0, KEY_CAMERA), /* Camera */ |
186 | KEY(0, 2, KEY_PHONE), /* Send key */ | 186 | KEY(2, 0, KEY_PHONE), /* Send key */ |
187 | KEY(0, 3, KEY_VOLUMEUP), /* Volume up */ | 187 | KEY(3, 0, KEY_VOLUMEUP), /* Volume up */ |
188 | KEY(0, 4, KEY_F2), /* Right bar (landscape) */ | 188 | KEY(4, 0, KEY_F2), /* Right bar (landscape) */ |
189 | KEY(0, 5, KEY_MAIL), /* Win key (portrait) */ | 189 | KEY(5, 0, KEY_MAIL), /* Win key (portrait) */ |
190 | KEY(0, 6, KEY_DIRECTORY), /* Right bar (protrait) */ | 190 | KEY(6, 0, KEY_DIRECTORY), /* Right bar (protrait) */ |
191 | KEY(1, 0, KEY_LEFTCTRL), /* Windows key */ | 191 | KEY(0, 1, KEY_LEFTCTRL), /* Windows key */ |
192 | KEY(1, 1, KEY_COMMA), | 192 | KEY(1, 1, KEY_COMMA), |
193 | KEY(1, 2, KEY_M), | 193 | KEY(2, 1, KEY_M), |
194 | KEY(1, 3, KEY_K), | 194 | KEY(3, 1, KEY_K), |
195 | KEY(1, 4, KEY_SLASH), /* OK key */ | 195 | KEY(4, 1, KEY_SLASH), /* OK key */ |
196 | KEY(1, 5, KEY_I), | 196 | KEY(5, 1, KEY_I), |
197 | KEY(1, 6, KEY_U), | 197 | KEY(6, 1, KEY_U), |
198 | KEY(2, 0, KEY_LEFTALT), | 198 | KEY(0, 2, KEY_LEFTALT), |
199 | KEY(2, 1, KEY_TAB), | 199 | KEY(1, 2, KEY_TAB), |
200 | KEY(2, 2, KEY_N), | 200 | KEY(2, 2, KEY_N), |
201 | KEY(2, 3, KEY_J), | 201 | KEY(3, 2, KEY_J), |
202 | KEY(2, 4, KEY_ENTER), | 202 | KEY(4, 2, KEY_ENTER), |
203 | KEY(2, 5, KEY_H), | 203 | KEY(5, 2, KEY_H), |
204 | KEY(2, 6, KEY_Y), | 204 | KEY(6, 2, KEY_Y), |
205 | KEY(3, 0, KEY_SPACE), | 205 | KEY(0, 3, KEY_SPACE), |
206 | KEY(3, 1, KEY_L), | 206 | KEY(1, 3, KEY_L), |
207 | KEY(3, 2, KEY_B), | 207 | KEY(2, 3, KEY_B), |
208 | KEY(3, 3, KEY_V), | 208 | KEY(3, 3, KEY_V), |
209 | KEY(3, 4, KEY_BACKSPACE), | 209 | KEY(4, 3, KEY_BACKSPACE), |
210 | KEY(3, 5, KEY_G), | 210 | KEY(5, 3, KEY_G), |
211 | KEY(3, 6, KEY_T), | 211 | KEY(6, 3, KEY_T), |
212 | KEY(4, 0, KEY_CAPSLOCK), /* Shift */ | 212 | KEY(0, 4, KEY_CAPSLOCK), /* Shift */ |
213 | KEY(4, 1, KEY_C), | 213 | KEY(1, 4, KEY_C), |
214 | KEY(4, 2, KEY_F), | 214 | KEY(2, 4, KEY_F), |
215 | KEY(4, 3, KEY_R), | 215 | KEY(3, 4, KEY_R), |
216 | KEY(4, 4, KEY_O), | 216 | KEY(4, 4, KEY_O), |
217 | KEY(4, 5, KEY_E), | 217 | KEY(5, 4, KEY_E), |
218 | KEY(4, 6, KEY_D), | 218 | KEY(6, 4, KEY_D), |
219 | KEY(5, 0, KEY_X), | 219 | KEY(0, 5, KEY_X), |
220 | KEY(5, 1, KEY_Z), | 220 | KEY(1, 5, KEY_Z), |
221 | KEY(5, 2, KEY_S), | 221 | KEY(2, 5, KEY_S), |
222 | KEY(5, 3, KEY_W), | 222 | KEY(3, 5, KEY_W), |
223 | KEY(5, 4, KEY_P), | 223 | KEY(4, 5, KEY_P), |
224 | KEY(5, 5, KEY_Q), | 224 | KEY(5, 5, KEY_Q), |
225 | KEY(5, 6, KEY_A), | 225 | KEY(6, 5, KEY_A), |
226 | KEY(6, 0, KEY_CONNECT), /* Voice button */ | 226 | KEY(0, 6, KEY_CONNECT), /* Voice button */ |
227 | KEY(6, 2, KEY_CANCEL), /* End key */ | 227 | KEY(2, 6, KEY_CANCEL), /* End key */ |
228 | KEY(6, 3, KEY_VOLUMEDOWN), /* Volume down */ | 228 | KEY(3, 6, KEY_VOLUMEDOWN), /* Volume down */ |
229 | KEY(6, 4, KEY_F1), /* Left bar (landscape) */ | 229 | KEY(4, 6, KEY_F1), /* Left bar (landscape) */ |
230 | KEY(6, 5, KEY_WWW), /* OK button (portrait) */ | 230 | KEY(5, 6, KEY_WWW), /* OK button (portrait) */ |
231 | KEY(6, 6, KEY_CALENDAR), /* Left bar (portrait) */ | 231 | KEY(6, 6, KEY_CALENDAR), /* Left bar (portrait) */ |
232 | 0 | ||
233 | }; | 232 | }; |
234 | 233 | ||
235 | struct omap_kp_platform_data htcherald_kp_data = { | 234 | static const struct matrix_keymap_data htc_herald_keymap_data = { |
235 | .keymap = htc_herald_keymap, | ||
236 | .keymap_size = ARRAY_SIZE(htc_herald_keymap), | ||
237 | }; | ||
238 | |||
239 | static struct omap_kp_platform_data htcherald_kp_data = { | ||
236 | .rows = 7, | 240 | .rows = 7, |
237 | .cols = 7, | 241 | .cols = 7, |
238 | .delay = 20, | 242 | .delay = 20, |
239 | .rep = 1, | 243 | .rep = true, |
240 | .keymap = htc_herald_keymap, | 244 | .keymap_data = &htc_herald_keymap_data, |
241 | }; | 245 | }; |
242 | 246 | ||
243 | static struct resource kp_resources[] = { | 247 | static struct resource kp_resources[] = { |
@@ -278,7 +282,7 @@ static struct gpio_keys_button herald_gpio_keys_table[] = { | |||
278 | static struct gpio_keys_platform_data herald_gpio_keys_data = { | 282 | static struct gpio_keys_platform_data herald_gpio_keys_data = { |
279 | .buttons = herald_gpio_keys_table, | 283 | .buttons = herald_gpio_keys_table, |
280 | .nbuttons = ARRAY_SIZE(herald_gpio_keys_table), | 284 | .nbuttons = ARRAY_SIZE(herald_gpio_keys_table), |
281 | .rep = 1, | 285 | .rep = true, |
282 | }; | 286 | }; |
283 | 287 | ||
284 | static struct platform_device herald_gpiokeys_device = { | 288 | static struct platform_device herald_gpiokeys_device = { |
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 8d59b078fc2c..a36e6742bf9b 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c | |||
@@ -44,17 +44,16 @@ | |||
44 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ | 44 | /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ |
45 | #define INNOVATOR1610_ETHR_START 0x04000300 | 45 | #define INNOVATOR1610_ETHR_START 0x04000300 |
46 | 46 | ||
47 | static int innovator_keymap[] = { | 47 | static const unsigned int innovator_keymap[] = { |
48 | KEY(0, 0, KEY_F1), | 48 | KEY(0, 0, KEY_F1), |
49 | KEY(0, 3, KEY_DOWN), | 49 | KEY(3, 0, KEY_DOWN), |
50 | KEY(1, 1, KEY_F2), | 50 | KEY(1, 1, KEY_F2), |
51 | KEY(1, 2, KEY_RIGHT), | 51 | KEY(2, 1, KEY_RIGHT), |
52 | KEY(2, 0, KEY_F3), | 52 | KEY(0, 2, KEY_F3), |
53 | KEY(2, 1, KEY_F4), | 53 | KEY(1, 2, KEY_F4), |
54 | KEY(2, 2, KEY_UP), | 54 | KEY(2, 2, KEY_UP), |
55 | KEY(3, 2, KEY_ENTER), | 55 | KEY(2, 3, KEY_ENTER), |
56 | KEY(3, 3, KEY_LEFT), | 56 | KEY(3, 3, KEY_LEFT), |
57 | 0 | ||
58 | }; | 57 | }; |
59 | 58 | ||
60 | static struct mtd_partition innovator_partitions[] = { | 59 | static struct mtd_partition innovator_partitions[] = { |
@@ -126,11 +125,15 @@ static struct resource innovator_kp_resources[] = { | |||
126 | }, | 125 | }, |
127 | }; | 126 | }; |
128 | 127 | ||
128 | static const struct matrix_keymap_data innovator_keymap_data = { | ||
129 | .keymap = innovator_keymap, | ||
130 | .keymap_size = ARRAY_SIZE(innovator_keymap), | ||
131 | }; | ||
132 | |||
129 | static struct omap_kp_platform_data innovator_kp_data = { | 133 | static struct omap_kp_platform_data innovator_kp_data = { |
130 | .rows = 8, | 134 | .rows = 8, |
131 | .cols = 8, | 135 | .cols = 8, |
132 | .keymap = innovator_keymap, | 136 | .keymap_data = &innovator_keymap_data, |
133 | .keymapsize = ARRAY_SIZE(innovator_keymap), | ||
134 | .delay = 4, | 137 | .delay = 4, |
135 | }; | 138 | }; |
136 | 139 | ||
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 605495bbc583..d21f09dc78f4 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c | |||
@@ -54,19 +54,18 @@ static void __init omap_nokia770_init_irq(void) | |||
54 | omap_init_irq(); | 54 | omap_init_irq(); |
55 | } | 55 | } |
56 | 56 | ||
57 | static int nokia770_keymap[] = { | 57 | static const unsigned int nokia770_keymap[] = { |
58 | KEY(0, 1, GROUP_0 | KEY_UP), | 58 | KEY(1, 0, GROUP_0 | KEY_UP), |
59 | KEY(0, 2, GROUP_1 | KEY_F5), | 59 | KEY(2, 0, GROUP_1 | KEY_F5), |
60 | KEY(1, 0, GROUP_0 | KEY_LEFT), | 60 | KEY(0, 1, GROUP_0 | KEY_LEFT), |
61 | KEY(1, 1, GROUP_0 | KEY_ENTER), | 61 | KEY(1, 1, GROUP_0 | KEY_ENTER), |
62 | KEY(1, 2, GROUP_0 | KEY_RIGHT), | 62 | KEY(2, 1, GROUP_0 | KEY_RIGHT), |
63 | KEY(2, 0, GROUP_1 | KEY_ESC), | 63 | KEY(0, 2, GROUP_1 | KEY_ESC), |
64 | KEY(2, 1, GROUP_0 | KEY_DOWN), | 64 | KEY(1, 2, GROUP_0 | KEY_DOWN), |
65 | KEY(2, 2, GROUP_1 | KEY_F4), | 65 | KEY(2, 2, GROUP_1 | KEY_F4), |
66 | KEY(3, 0, GROUP_2 | KEY_F7), | 66 | KEY(0, 3, GROUP_2 | KEY_F7), |
67 | KEY(3, 1, GROUP_2 | KEY_F8), | 67 | KEY(1, 3, GROUP_2 | KEY_F8), |
68 | KEY(3, 2, GROUP_2 | KEY_F6), | 68 | KEY(2, 3, GROUP_2 | KEY_F6), |
69 | 0 | ||
70 | }; | 69 | }; |
71 | 70 | ||
72 | static struct resource nokia770_kp_resources[] = { | 71 | static struct resource nokia770_kp_resources[] = { |
@@ -77,11 +76,15 @@ static struct resource nokia770_kp_resources[] = { | |||
77 | }, | 76 | }, |
78 | }; | 77 | }; |
79 | 78 | ||
79 | static const struct matrix_keymap_data nokia770_keymap_data = { | ||
80 | .keymap = nokia770_keymap, | ||
81 | .keymap_size = ARRAY_SIZE(nokia770_keymap), | ||
82 | }; | ||
83 | |||
80 | static struct omap_kp_platform_data nokia770_kp_data = { | 84 | static struct omap_kp_platform_data nokia770_kp_data = { |
81 | .rows = 8, | 85 | .rows = 8, |
82 | .cols = 8, | 86 | .cols = 8, |
83 | .keymap = nokia770_keymap, | 87 | .keymap_data = &nokia770_keymap_data, |
84 | .keymapsize = ARRAY_SIZE(nokia770_keymap), | ||
85 | .delay = 4, | 88 | .delay = 4, |
86 | }; | 89 | }; |
87 | 90 | ||
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index d44e7172efc2..7c5e2112c776 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -338,25 +338,28 @@ static struct i2c_board_info __initdata mistral_i2c_board_info[] = { | |||
338 | */ | 338 | */ |
339 | }; | 339 | }; |
340 | 340 | ||
341 | static const int osk_keymap[] = { | 341 | static const unsigned int osk_keymap[] = { |
342 | /* KEY(col, row, code) */ | 342 | /* KEY(col, row, code) */ |
343 | KEY(0, 0, KEY_F1), /* SW4 */ | 343 | KEY(0, 0, KEY_F1), /* SW4 */ |
344 | KEY(0, 3, KEY_UP), /* (sw2/up) */ | 344 | KEY(3, 0, KEY_UP), /* (sw2/up) */ |
345 | KEY(1, 1, KEY_LEFTCTRL), /* SW5 */ | 345 | KEY(1, 1, KEY_LEFTCTRL), /* SW5 */ |
346 | KEY(1, 2, KEY_LEFT), /* (sw2/left) */ | 346 | KEY(2, 1, KEY_LEFT), /* (sw2/left) */ |
347 | KEY(2, 0, KEY_SPACE), /* SW3 */ | 347 | KEY(0, 2, KEY_SPACE), /* SW3 */ |
348 | KEY(2, 1, KEY_ESC), /* SW6 */ | 348 | KEY(1, 2, KEY_ESC), /* SW6 */ |
349 | KEY(2, 2, KEY_DOWN), /* (sw2/down) */ | 349 | KEY(2, 2, KEY_DOWN), /* (sw2/down) */ |
350 | KEY(3, 2, KEY_ENTER), /* (sw2/select) */ | 350 | KEY(2, 3, KEY_ENTER), /* (sw2/select) */ |
351 | KEY(3, 3, KEY_RIGHT), /* (sw2/right) */ | 351 | KEY(3, 3, KEY_RIGHT), /* (sw2/right) */ |
352 | 0 | 352 | }; |
353 | |||
354 | static const struct matrix_keymap_data osk_keymap_data = { | ||
355 | .keymap = osk_keymap, | ||
356 | .keymap_size = ARRAY_SIZE(osk_keymap), | ||
353 | }; | 357 | }; |
354 | 358 | ||
355 | static struct omap_kp_platform_data osk_kp_data = { | 359 | static struct omap_kp_platform_data osk_kp_data = { |
356 | .rows = 8, | 360 | .rows = 8, |
357 | .cols = 8, | 361 | .cols = 8, |
358 | .keymap = (int *) osk_keymap, | 362 | .keymap_data = &osk_keymap_data, |
359 | .keymapsize = ARRAY_SIZE(osk_keymap), | ||
360 | .delay = 9, | 363 | .delay = 9, |
361 | }; | 364 | }; |
362 | 365 | ||
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c index 994dc6f50729..fb51ce6123d8 100644 --- a/arch/arm/mach-omap1/board-palmte.c +++ b/arch/arm/mach-omap1/board-palmte.c | |||
@@ -65,25 +65,29 @@ static void __init omap_palmte_init_irq(void) | |||
65 | omap_init_irq(); | 65 | omap_init_irq(); |
66 | } | 66 | } |
67 | 67 | ||
68 | static const int palmte_keymap[] = { | 68 | static const unsigned int palmte_keymap[] = { |
69 | KEY(0, 0, KEY_F1), /* Calendar */ | 69 | KEY(0, 0, KEY_F1), /* Calendar */ |
70 | KEY(0, 1, KEY_F2), /* Contacts */ | 70 | KEY(1, 0, KEY_F2), /* Contacts */ |
71 | KEY(0, 2, KEY_F3), /* Tasks List */ | 71 | KEY(2, 0, KEY_F3), /* Tasks List */ |
72 | KEY(0, 3, KEY_F4), /* Note Pad */ | 72 | KEY(3, 0, KEY_F4), /* Note Pad */ |
73 | KEY(0, 4, KEY_POWER), | 73 | KEY(4, 0, KEY_POWER), |
74 | KEY(1, 0, KEY_LEFT), | 74 | KEY(0, 1, KEY_LEFT), |
75 | KEY(1, 1, KEY_DOWN), | 75 | KEY(1, 1, KEY_DOWN), |
76 | KEY(1, 2, KEY_UP), | 76 | KEY(2, 1, KEY_UP), |
77 | KEY(1, 3, KEY_RIGHT), | 77 | KEY(3, 1, KEY_RIGHT), |
78 | KEY(1, 4, KEY_ENTER), | 78 | KEY(4, 1, KEY_ENTER), |
79 | 0, | 79 | }; |
80 | |||
81 | static const struct matrix_keymap_data palmte_keymap_data = { | ||
82 | .keymap = palmte_keymap, | ||
83 | .keymap_size = ARRAY_SIZE(palmte_keymap), | ||
80 | }; | 84 | }; |
81 | 85 | ||
82 | static struct omap_kp_platform_data palmte_kp_data = { | 86 | static struct omap_kp_platform_data palmte_kp_data = { |
83 | .rows = 8, | 87 | .rows = 8, |
84 | .cols = 8, | 88 | .cols = 8, |
85 | .keymap = (int *) palmte_keymap, | 89 | .keymap_data = &palmte_keymap_data, |
86 | .rep = 1, | 90 | .rep = true, |
87 | .delay = 12, | 91 | .delay = 12, |
88 | }; | 92 | }; |
89 | 93 | ||
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c index ed1400a67f75..f04f2d36e7d3 100644 --- a/arch/arm/mach-omap1/board-palmtt.c +++ b/arch/arm/mach-omap1/board-palmtt.c | |||
@@ -51,19 +51,18 @@ | |||
51 | #define PALMTT_MMC_WP_GPIO 8 | 51 | #define PALMTT_MMC_WP_GPIO 8 |
52 | #define PALMTT_HDQ_GPIO 11 | 52 | #define PALMTT_HDQ_GPIO 11 |
53 | 53 | ||
54 | static int palmtt_keymap[] = { | 54 | static const unsigned int palmtt_keymap[] = { |
55 | KEY(0, 0, KEY_ESC), | 55 | KEY(0, 0, KEY_ESC), |
56 | KEY(0, 1, KEY_SPACE), | 56 | KEY(1, 0, KEY_SPACE), |
57 | KEY(0, 2, KEY_LEFTCTRL), | 57 | KEY(2, 0, KEY_LEFTCTRL), |
58 | KEY(0, 3, KEY_TAB), | 58 | KEY(3, 0, KEY_TAB), |
59 | KEY(0, 4, KEY_ENTER), | 59 | KEY(4, 0, KEY_ENTER), |
60 | KEY(1, 0, KEY_LEFT), | 60 | KEY(0, 1, KEY_LEFT), |
61 | KEY(1, 1, KEY_DOWN), | 61 | KEY(1, 1, KEY_DOWN), |
62 | KEY(1, 2, KEY_UP), | 62 | KEY(2, 1, KEY_UP), |
63 | KEY(1, 3, KEY_RIGHT), | 63 | KEY(3, 1, KEY_RIGHT), |
64 | KEY(2, 0, KEY_SLEEP), | 64 | KEY(0, 2, KEY_SLEEP), |
65 | KEY(2, 4, KEY_Y), | 65 | KEY(4, 2, KEY_Y), |
66 | 0 | ||
67 | }; | 66 | }; |
68 | 67 | ||
69 | static struct mtd_partition palmtt_partitions[] = { | 68 | static struct mtd_partition palmtt_partitions[] = { |
@@ -136,10 +135,15 @@ static struct resource palmtt_kp_resources[] = { | |||
136 | }, | 135 | }, |
137 | }; | 136 | }; |
138 | 137 | ||
138 | static const struct matrix_keymap_data palmtt_keymap_data = { | ||
139 | .keymap = palmtt_keymap, | ||
140 | .keymap_size = ARRAY_SIZE(palmtt_keymap), | ||
141 | }; | ||
142 | |||
139 | static struct omap_kp_platform_data palmtt_kp_data = { | 143 | static struct omap_kp_platform_data palmtt_kp_data = { |
140 | .rows = 6, | 144 | .rows = 6, |
141 | .cols = 3, | 145 | .cols = 3, |
142 | .keymap = palmtt_keymap, | 146 | .keymap_data = &palmtt_keymap_data, |
143 | }; | 147 | }; |
144 | 148 | ||
145 | static struct platform_device palmtt_kp_device = { | 149 | static struct platform_device palmtt_kp_device = { |
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c index 2afac598baee..d7bbbe721a75 100644 --- a/arch/arm/mach-omap1/board-palmz71.c +++ b/arch/arm/mach-omap1/board-palmz71.c | |||
@@ -64,26 +64,30 @@ omap_palmz71_init_irq(void) | |||
64 | omap_init_irq(); | 64 | omap_init_irq(); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int palmz71_keymap[] = { | 67 | static const unsigned int palmz71_keymap[] = { |
68 | KEY(0, 0, KEY_F1), | 68 | KEY(0, 0, KEY_F1), |
69 | KEY(0, 1, KEY_F2), | 69 | KEY(1, 0, KEY_F2), |
70 | KEY(0, 2, KEY_F3), | 70 | KEY(2, 0, KEY_F3), |
71 | KEY(0, 3, KEY_F4), | 71 | KEY(3, 0, KEY_F4), |
72 | KEY(0, 4, KEY_POWER), | 72 | KEY(4, 0, KEY_POWER), |
73 | KEY(1, 0, KEY_LEFT), | 73 | KEY(0, 1, KEY_LEFT), |
74 | KEY(1, 1, KEY_DOWN), | 74 | KEY(1, 1, KEY_DOWN), |
75 | KEY(1, 2, KEY_UP), | 75 | KEY(2, 1, KEY_UP), |
76 | KEY(1, 3, KEY_RIGHT), | 76 | KEY(3, 1, KEY_RIGHT), |
77 | KEY(1, 4, KEY_ENTER), | 77 | KEY(4, 1, KEY_ENTER), |
78 | KEY(2, 0, KEY_CAMERA), | 78 | KEY(0, 2, KEY_CAMERA), |
79 | 0, | 79 | }; |
80 | |||
81 | static const struct matrix_keymap_data palmz71_keymap_data = { | ||
82 | .keymap = palmz71_keymap, | ||
83 | .keymap_size = ARRAY_SIZE(palmz71_keymap), | ||
80 | }; | 84 | }; |
81 | 85 | ||
82 | static struct omap_kp_platform_data palmz71_kp_data = { | 86 | static struct omap_kp_platform_data palmz71_kp_data = { |
83 | .rows = 8, | 87 | .rows = 8, |
84 | .cols = 8, | 88 | .cols = 8, |
85 | .keymap = palmz71_keymap, | 89 | .keymap_data = &palmz71_keymap_data, |
86 | .rep = 1, | 90 | .rep = true, |
87 | .delay = 80, | 91 | .delay = 80, |
88 | }; | 92 | }; |
89 | 93 | ||
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c index 69fda218fb45..3c8ee8489458 100644 --- a/arch/arm/mach-omap1/board-perseus2.c +++ b/arch/arm/mach-omap1/board-perseus2.c | |||
@@ -36,36 +36,35 @@ | |||
36 | #include <plat/common.h> | 36 | #include <plat/common.h> |
37 | #include <plat/board.h> | 37 | #include <plat/board.h> |
38 | 38 | ||
39 | static int p2_keymap[] = { | 39 | static const unsigned int p2_keymap[] = { |
40 | KEY(0,0,KEY_UP), | 40 | KEY(0, 0, KEY_UP), |
41 | KEY(0,1,KEY_RIGHT), | 41 | KEY(1, 0, KEY_RIGHT), |
42 | KEY(0,2,KEY_LEFT), | 42 | KEY(2, 0, KEY_LEFT), |
43 | KEY(0,3,KEY_DOWN), | 43 | KEY(3, 0, KEY_DOWN), |
44 | KEY(0,4,KEY_ENTER), | 44 | KEY(4, 0, KEY_ENTER), |
45 | KEY(1,0,KEY_F10), | 45 | KEY(0, 1, KEY_F10), |
46 | KEY(1,1,KEY_SEND), | 46 | KEY(1, 1, KEY_SEND), |
47 | KEY(1,2,KEY_END), | 47 | KEY(2, 1, KEY_END), |
48 | KEY(1,3,KEY_VOLUMEDOWN), | 48 | KEY(3, 1, KEY_VOLUMEDOWN), |
49 | KEY(1,4,KEY_VOLUMEUP), | 49 | KEY(4, 1, KEY_VOLUMEUP), |
50 | KEY(1,5,KEY_RECORD), | 50 | KEY(5, 1, KEY_RECORD), |
51 | KEY(2,0,KEY_F9), | 51 | KEY(0, 2, KEY_F9), |
52 | KEY(2,1,KEY_3), | 52 | KEY(1, 2, KEY_3), |
53 | KEY(2,2,KEY_6), | 53 | KEY(2, 2, KEY_6), |
54 | KEY(2,3,KEY_9), | 54 | KEY(3, 2, KEY_9), |
55 | KEY(2,4,KEY_KPDOT), | 55 | KEY(4, 2, KEY_KPDOT), |
56 | KEY(3,0,KEY_BACK), | 56 | KEY(0, 3, KEY_BACK), |
57 | KEY(3,1,KEY_2), | 57 | KEY(1, 3, KEY_2), |
58 | KEY(3,2,KEY_5), | 58 | KEY(2, 3, KEY_5), |
59 | KEY(3,3,KEY_8), | 59 | KEY(3, 3, KEY_8), |
60 | KEY(3,4,KEY_0), | 60 | KEY(4, 3, KEY_0), |
61 | KEY(3,5,KEY_KPSLASH), | 61 | KEY(5, 3, KEY_KPSLASH), |
62 | KEY(4,0,KEY_HOME), | 62 | KEY(0, 4, KEY_HOME), |
63 | KEY(4,1,KEY_1), | 63 | KEY(1, 4, KEY_1), |
64 | KEY(4,2,KEY_4), | 64 | KEY(2, 4, KEY_4), |
65 | KEY(4,3,KEY_7), | 65 | KEY(3, 4, KEY_7), |
66 | KEY(4,4,KEY_KPASTERISK), | 66 | KEY(4, 4, KEY_KPASTERISK), |
67 | KEY(4,5,KEY_POWER), | 67 | KEY(5, 4, KEY_POWER), |
68 | 0 | ||
69 | }; | 68 | }; |
70 | 69 | ||
71 | static struct smc91x_platdata smc91x_info = { | 70 | static struct smc91x_platdata smc91x_info = { |
@@ -211,13 +210,17 @@ static struct resource kp_resources[] = { | |||
211 | }, | 210 | }, |
212 | }; | 211 | }; |
213 | 212 | ||
213 | static const struct matrix_keymap_data p2_keymap_data = { | ||
214 | .keymap = p2_keymap, | ||
215 | .keymap_size = ARRAY_SIZE(p2_keymap), | ||
216 | }; | ||
217 | |||
214 | static struct omap_kp_platform_data kp_data = { | 218 | static struct omap_kp_platform_data kp_data = { |
215 | .rows = 8, | 219 | .rows = 8, |
216 | .cols = 8, | 220 | .cols = 8, |
217 | .keymap = p2_keymap, | 221 | .keymap_data = &p2_keymap_data, |
218 | .keymapsize = ARRAY_SIZE(p2_keymap), | ||
219 | .delay = 4, | 222 | .delay = 4, |
220 | .dbounce = 1, | 223 | .dbounce = true, |
221 | }; | 224 | }; |
222 | 225 | ||
223 | static struct platform_device kp_device = { | 226 | static struct platform_device kp_device = { |
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c index 463862c67819..d41fe2d0616a 100644 --- a/arch/arm/mach-omap1/board-sx1.c +++ b/arch/arm/mach-omap1/board-sx1.c | |||
@@ -164,36 +164,35 @@ EXPORT_SYMBOL(sx1_setusbpower); | |||
164 | 164 | ||
165 | /*----------- Keypad -------------------------*/ | 165 | /*----------- Keypad -------------------------*/ |
166 | 166 | ||
167 | static int sx1_keymap[] = { | 167 | static const unsigned int sx1_keymap[] = { |
168 | KEY(5, 3, GROUP_0 | 117), /* camera Qt::Key_F17 */ | 168 | KEY(3, 5, GROUP_0 | 117), /* camera Qt::Key_F17 */ |
169 | KEY(0, 4, GROUP_0 | 114), /* voice memo Qt::Key_F14 */ | 169 | KEY(4, 0, GROUP_0 | 114), /* voice memo Qt::Key_F14 */ |
170 | KEY(1, 4, GROUP_2 | 114), /* voice memo */ | 170 | KEY(4, 1, GROUP_2 | 114), /* voice memo */ |
171 | KEY(2, 4, GROUP_3 | 114), /* voice memo */ | 171 | KEY(4, 2, GROUP_3 | 114), /* voice memo */ |
172 | KEY(0, 0, GROUP_1 | KEY_F12), /* red button Qt::Key_Hangup */ | 172 | KEY(0, 0, GROUP_1 | KEY_F12), /* red button Qt::Key_Hangup */ |
173 | KEY(4, 3, GROUP_1 | KEY_LEFT), | 173 | KEY(3, 4, GROUP_1 | KEY_LEFT), |
174 | KEY(2, 3, GROUP_1 | KEY_DOWN), | 174 | KEY(3, 2, GROUP_1 | KEY_DOWN), |
175 | KEY(1, 3, GROUP_1 | KEY_RIGHT), | 175 | KEY(3, 1, GROUP_1 | KEY_RIGHT), |
176 | KEY(0, 3, GROUP_1 | KEY_UP), | 176 | KEY(3, 0, GROUP_1 | KEY_UP), |
177 | KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */ | 177 | KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */ |
178 | KEY(5, 0, GROUP_1 | KEY_1), | 178 | KEY(0, 5, GROUP_1 | KEY_1), |
179 | KEY(4, 0, GROUP_1 | KEY_2), | 179 | KEY(0, 4, GROUP_1 | KEY_2), |
180 | KEY(3, 0, GROUP_1 | KEY_3), | 180 | KEY(0, 3, GROUP_1 | KEY_3), |
181 | KEY(3, 4, GROUP_1 | KEY_4), | 181 | KEY(4, 3, GROUP_1 | KEY_4), |
182 | KEY(4, 4, GROUP_1 | KEY_5), | 182 | KEY(4, 4, GROUP_1 | KEY_5), |
183 | KEY(5, 4, GROUP_1 | KEY_KPASTERISK),/* "*" */ | 183 | KEY(4, 5, GROUP_1 | KEY_KPASTERISK),/* "*" */ |
184 | KEY(4, 1, GROUP_1 | KEY_6), | 184 | KEY(1, 4, GROUP_1 | KEY_6), |
185 | KEY(5, 1, GROUP_1 | KEY_7), | 185 | KEY(1, 5, GROUP_1 | KEY_7), |
186 | KEY(3, 1, GROUP_1 | KEY_8), | 186 | KEY(1, 3, GROUP_1 | KEY_8), |
187 | KEY(3, 2, GROUP_1 | KEY_9), | 187 | KEY(2, 3, GROUP_1 | KEY_9), |
188 | KEY(5, 2, GROUP_1 | KEY_0), | 188 | KEY(2, 5, GROUP_1 | KEY_0), |
189 | KEY(4, 2, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */ | 189 | KEY(2, 4, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */ |
190 | KEY(0, 1, GROUP_1 | KEY_F11), /* green button Qt::Key_Call */ | 190 | KEY(1, 0, GROUP_1 | KEY_F11), /* green button Qt::Key_Call */ |
191 | KEY(1, 2, GROUP_1 | KEY_YEN), /* left soft Qt::Key_Context1 */ | 191 | KEY(2, 1, GROUP_1 | KEY_YEN), /* left soft Qt::Key_Context1 */ |
192 | KEY(2, 2, GROUP_1 | KEY_F8), /* right soft Qt::Key_Back */ | 192 | KEY(2, 2, GROUP_1 | KEY_F8), /* right soft Qt::Key_Back */ |
193 | KEY(2, 1, GROUP_1 | KEY_LEFTSHIFT), /* shift */ | 193 | KEY(1, 2, GROUP_1 | KEY_LEFTSHIFT), /* shift */ |
194 | KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */ | 194 | KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */ |
195 | KEY(0, 2, GROUP_1 | KEY_F7), /* menu Qt::Key_Menu */ | 195 | KEY(2, 0, GROUP_1 | KEY_F7), /* menu Qt::Key_Menu */ |
196 | 0 | ||
197 | }; | 196 | }; |
198 | 197 | ||
199 | static struct resource sx1_kp_resources[] = { | 198 | static struct resource sx1_kp_resources[] = { |
@@ -204,11 +203,15 @@ static struct resource sx1_kp_resources[] = { | |||
204 | }, | 203 | }, |
205 | }; | 204 | }; |
206 | 205 | ||
206 | static const struct matrix_keymap_data sx1_keymap_data = { | ||
207 | .keymap = sx1_keymap, | ||
208 | .keymap_size = ARRAY_SIZE(sx1_keymap), | ||
209 | }; | ||
210 | |||
207 | static struct omap_kp_platform_data sx1_kp_data = { | 211 | static struct omap_kp_platform_data sx1_kp_data = { |
208 | .rows = 6, | 212 | .rows = 6, |
209 | .cols = 6, | 213 | .cols = 6, |
210 | .keymap = sx1_keymap, | 214 | .keymap_data = &sx1_keymap_data, |
211 | .keymapsize = ARRAY_SIZE(sx1_keymap), | ||
212 | .delay = 80, | 215 | .delay = 80, |
213 | }; | 216 | }; |
214 | 217 | ||
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 0a2d73cf036f..b386a403c379 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -51,38 +51,37 @@ | |||
51 | static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; | 51 | static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; |
52 | static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; | 52 | static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; |
53 | 53 | ||
54 | static int h4_keymap[] = { | 54 | static const unsigned int h4_keymap[] = { |
55 | KEY(0, 0, KEY_LEFT), | 55 | KEY(0, 0, KEY_LEFT), |
56 | KEY(0, 1, KEY_RIGHT), | 56 | KEY(1, 0, KEY_RIGHT), |
57 | KEY(0, 2, KEY_A), | 57 | KEY(2, 0, KEY_A), |
58 | KEY(0, 3, KEY_B), | 58 | KEY(3, 0, KEY_B), |
59 | KEY(0, 4, KEY_C), | 59 | KEY(4, 0, KEY_C), |
60 | KEY(1, 0, KEY_DOWN), | 60 | KEY(0, 1, KEY_DOWN), |
61 | KEY(1, 1, KEY_UP), | 61 | KEY(1, 1, KEY_UP), |
62 | KEY(1, 2, KEY_E), | 62 | KEY(2, 1, KEY_E), |
63 | KEY(1, 3, KEY_F), | 63 | KEY(3, 1, KEY_F), |
64 | KEY(1, 4, KEY_G), | 64 | KEY(4, 1, KEY_G), |
65 | KEY(2, 0, KEY_ENTER), | 65 | KEY(0, 2, KEY_ENTER), |
66 | KEY(2, 1, KEY_I), | 66 | KEY(1, 2, KEY_I), |
67 | KEY(2, 2, KEY_J), | 67 | KEY(2, 2, KEY_J), |
68 | KEY(2, 3, KEY_K), | 68 | KEY(3, 2, KEY_K), |
69 | KEY(2, 4, KEY_3), | 69 | KEY(4, 2, KEY_3), |
70 | KEY(3, 0, KEY_M), | 70 | KEY(0, 3, KEY_M), |
71 | KEY(3, 1, KEY_N), | 71 | KEY(1, 3, KEY_N), |
72 | KEY(3, 2, KEY_O), | 72 | KEY(2, 3, KEY_O), |
73 | KEY(3, 3, KEY_P), | 73 | KEY(3, 3, KEY_P), |
74 | KEY(3, 4, KEY_Q), | 74 | KEY(4, 3, KEY_Q), |
75 | KEY(4, 0, KEY_R), | 75 | KEY(0, 4, KEY_R), |
76 | KEY(4, 1, KEY_4), | 76 | KEY(1, 4, KEY_4), |
77 | KEY(4, 2, KEY_T), | 77 | KEY(2, 4, KEY_T), |
78 | KEY(4, 3, KEY_U), | 78 | KEY(3, 4, KEY_U), |
79 | KEY(4, 4, KEY_ENTER), | 79 | KEY(4, 4, KEY_ENTER), |
80 | KEY(5, 0, KEY_V), | 80 | KEY(0, 5, KEY_V), |
81 | KEY(5, 1, KEY_W), | 81 | KEY(1, 5, KEY_W), |
82 | KEY(5, 2, KEY_L), | 82 | KEY(2, 5, KEY_L), |
83 | KEY(5, 3, KEY_S), | 83 | KEY(3, 5, KEY_S), |
84 | KEY(5, 4, KEY_ENTER), | 84 | KEY(4, 5, KEY_ENTER), |
85 | 0 | ||
86 | }; | 85 | }; |
87 | 86 | ||
88 | static struct mtd_partition h4_partitions[] = { | 87 | static struct mtd_partition h4_partitions[] = { |
@@ -136,12 +135,16 @@ static struct platform_device h4_flash_device = { | |||
136 | .resource = &h4_flash_resource, | 135 | .resource = &h4_flash_resource, |
137 | }; | 136 | }; |
138 | 137 | ||
138 | static const struct matrix_keymap_data h4_keymap_data = { | ||
139 | .keymap = h4_keymap, | ||
140 | .keymap_size = ARRAY_SIZE(h4_keymap), | ||
141 | }; | ||
142 | |||
139 | static struct omap_kp_platform_data h4_kp_data = { | 143 | static struct omap_kp_platform_data h4_kp_data = { |
140 | .rows = 6, | 144 | .rows = 6, |
141 | .cols = 7, | 145 | .cols = 7, |
142 | .keymap = h4_keymap, | 146 | .keymap_data = &h4_keymap_data, |
143 | .keymapsize = ARRAY_SIZE(h4_keymap), | 147 | .rep = true, |
144 | .rep = 1, | ||
145 | .row_gpios = row_gpios, | 148 | .row_gpios = row_gpios, |
146 | .col_gpios = col_gpios, | 149 | .col_gpios = col_gpios, |
147 | }; | 150 | }; |
diff --git a/arch/arm/plat-omap/include/plat/keypad.h b/arch/arm/plat-omap/include/plat/keypad.h index 3ae52ccc793c..793ce9d53294 100644 --- a/arch/arm/plat-omap/include/plat/keypad.h +++ b/arch/arm/plat-omap/include/plat/keypad.h | |||
@@ -10,16 +10,18 @@ | |||
10 | #ifndef ASMARM_ARCH_KEYPAD_H | 10 | #ifndef ASMARM_ARCH_KEYPAD_H |
11 | #define ASMARM_ARCH_KEYPAD_H | 11 | #define ASMARM_ARCH_KEYPAD_H |
12 | 12 | ||
13 | #warning: Please update the board to use matrix_keypad.h instead | 13 | #ifndef CONFIG_ARCH_OMAP1 |
14 | #warning Please update the board to use matrix-keypad driver | ||
15 | #endif | ||
16 | #include <linux/input/matrix_keypad.h> | ||
14 | 17 | ||
15 | struct omap_kp_platform_data { | 18 | struct omap_kp_platform_data { |
16 | int rows; | 19 | int rows; |
17 | int cols; | 20 | int cols; |
18 | int *keymap; | 21 | const struct matrix_keymap_data *keymap_data; |
19 | unsigned int keymapsize; | 22 | bool rep; |
20 | unsigned int rep:1; | ||
21 | unsigned long delay; | 23 | unsigned long delay; |
22 | unsigned int dbounce:1; | 24 | bool dbounce; |
23 | /* specific to OMAP242x*/ | 25 | /* specific to OMAP242x*/ |
24 | unsigned int *row_gpios; | 26 | unsigned int *row_gpios; |
25 | unsigned int *col_gpios; | 27 | unsigned int *col_gpios; |
@@ -28,18 +30,21 @@ struct omap_kp_platform_data { | |||
28 | /* Group (0..3) -- when multiple keys are pressed, only the | 30 | /* Group (0..3) -- when multiple keys are pressed, only the |
29 | * keys pressed in the same group are considered as pressed. This is | 31 | * keys pressed in the same group are considered as pressed. This is |
30 | * in order to workaround certain crappy HW designs that produce ghost | 32 | * in order to workaround certain crappy HW designs that produce ghost |
31 | * keypresses. */ | 33 | * keypresses. Two free bits, not used by neither row/col nor keynum, |
32 | #define GROUP_0 (0 << 16) | 34 | * must be available for use as group bits. The below GROUP_SHIFT |
33 | #define GROUP_1 (1 << 16) | 35 | * macro definition is based on some prior knowledge of the |
34 | #define GROUP_2 (2 << 16) | 36 | * matrix_keypad defined KEY() macro internals. |
35 | #define GROUP_3 (3 << 16) | 37 | */ |
38 | #define GROUP_SHIFT 14 | ||
39 | #define GROUP_0 (0 << GROUP_SHIFT) | ||
40 | #define GROUP_1 (1 << GROUP_SHIFT) | ||
41 | #define GROUP_2 (2 << GROUP_SHIFT) | ||
42 | #define GROUP_3 (3 << GROUP_SHIFT) | ||
36 | #define GROUP_MASK GROUP_3 | 43 | #define GROUP_MASK GROUP_3 |
44 | #if KEY_MAX & GROUP_MASK | ||
45 | #error Group bits in conflict with keynum bits | ||
46 | #endif | ||
37 | 47 | ||
38 | #define KEY_PERSISTENT 0x00800000 | ||
39 | #define KEYNUM_MASK 0x00EFFFFF | ||
40 | #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val)) | ||
41 | #define PERSISTENT_KEY(col, row) (((col) << 28) | ((row) << 24) | \ | ||
42 | KEY_PERSISTENT) | ||
43 | 48 | ||
44 | #endif | 49 | #endif |
45 | 50 | ||
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); |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index 80352ad6581a..697474691749 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ | 10 | #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ |
11 | (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ | 11 | (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ |
12 | (val & 0xffff)) | 12 | ((val) & 0xffff)) |
13 | 13 | ||
14 | #define KEY_ROW(k) (((k) >> 24) & 0xff) | 14 | #define KEY_ROW(k) (((k) >> 24) & 0xff) |
15 | #define KEY_COL(k) (((k) >> 16) & 0xff) | 15 | #define KEY_COL(k) (((k) >> 16) & 0xff) |