aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/spitz.c
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2009-07-27 04:59:39 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-09-10 06:49:37 -0400
commit93dd29a818a0fdb485a8f10bac58f5993e55d9c8 (patch)
tree40f3eb0d702fdf83ed49f8a1e111448deff159df /arch/arm/mach-pxa/spitz.c
parenta90c4fb89a870dede5d69a7eb5cb320158e21aab (diff)
[ARM] pxa/spitz: make use of GPIO based matrix keypad driver
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r--arch/arm/mach-pxa/spitz.c129
1 files changed, 128 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index da85327e630c..c4b8305b66a4 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -24,6 +24,7 @@
24#include <linux/spi/ads7846.h> 24#include <linux/spi/ads7846.h>
25#include <linux/spi/corgi_lcd.h> 25#include <linux/spi/corgi_lcd.h>
26#include <linux/mtd/sharpsl.h> 26#include <linux/mtd/sharpsl.h>
27#include <linux/input/matrix_keypad.h>
27 28
28#include <asm/setup.h> 29#include <asm/setup.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -111,6 +112,26 @@ static unsigned long spitz_pin_config[] __initdata = {
111 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */ 112 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */
112 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */ 113 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */
113 114
115 /* GPIO matrix keypad */
116 GPIO88_GPIO, /* column 0 */
117 GPIO23_GPIO, /* column 1 */
118 GPIO24_GPIO, /* column 2 */
119 GPIO25_GPIO, /* column 3 */
120 GPIO26_GPIO, /* column 4 */
121 GPIO27_GPIO, /* column 5 */
122 GPIO52_GPIO, /* column 6 */
123 GPIO103_GPIO, /* column 7 */
124 GPIO107_GPIO, /* column 8 */
125 GPIO108_GPIO, /* column 9 */
126 GPIO114_GPIO, /* column 10 */
127 GPIO12_GPIO, /* row 0 */
128 GPIO17_GPIO, /* row 1 */
129 GPIO91_GPIO, /* row 2 */
130 GPIO34_GPIO, /* row 3 */
131 GPIO36_GPIO, /* row 4 */
132 GPIO38_GPIO, /* row 5 */
133 GPIO39_GPIO, /* row 6 */
134
114 /* I2C */ 135 /* I2C */
115 GPIO117_I2C_SCL, 136 GPIO117_I2C_SCL,
116 GPIO118_I2C_SDA, 137 GPIO118_I2C_SDA,
@@ -242,9 +263,115 @@ EXPORT_SYMBOL(spitzscoop2_device);
242/* 263/*
243 * Spitz Keyboard Device 264 * Spitz Keyboard Device
244 */ 265 */
266#define SPITZ_KEY_CALENDAR KEY_F1
267#define SPITZ_KEY_ADDRESS KEY_F2
268#define SPITZ_KEY_FN KEY_F3
269#define SPITZ_KEY_CANCEL KEY_F4
270#define SPITZ_KEY_EXOK KEY_F5
271#define SPITZ_KEY_EXCANCEL KEY_F6
272#define SPITZ_KEY_EXJOGDOWN KEY_F7
273#define SPITZ_KEY_EXJOGUP KEY_F8
274#define SPITZ_KEY_JAP1 KEY_LEFTALT
275#define SPITZ_KEY_JAP2 KEY_RIGHTCTRL
276#define SPITZ_KEY_SYNC KEY_F9
277#define SPITZ_KEY_MAIL KEY_F10
278#define SPITZ_KEY_OK KEY_F11
279#define SPITZ_KEY_MENU KEY_F12
280
281static const uint32_t spitzkbd_keymap[] = {
282 KEY(0, 0, KEY_LEFTCTRL),
283 KEY(0, 1, KEY_1),
284 KEY(0, 2, KEY_3),
285 KEY(0, 3, KEY_5),
286 KEY(0, 4, KEY_6),
287 KEY(0, 5, KEY_7),
288 KEY(0, 6, KEY_9),
289 KEY(0, 7, KEY_0),
290 KEY(0, 8, KEY_BACKSPACE),
291 KEY(0, 9, SPITZ_KEY_EXOK), /* EXOK */
292 KEY(0, 10, SPITZ_KEY_EXCANCEL), /* EXCANCEL */
293 KEY(1, 1, KEY_2),
294 KEY(1, 2, KEY_4),
295 KEY(1, 3, KEY_R),
296 KEY(1, 4, KEY_Y),
297 KEY(1, 5, KEY_8),
298 KEY(1, 6, KEY_I),
299 KEY(1, 7, KEY_O),
300 KEY(1, 8, KEY_P),
301 KEY(1, 9, SPITZ_KEY_EXJOGDOWN), /* EXJOGDOWN */
302 KEY(1, 10, SPITZ_KEY_EXJOGUP), /* EXJOGUP */
303 KEY(2, 0, KEY_TAB),
304 KEY(2, 1, KEY_Q),
305 KEY(2, 2, KEY_E),
306 KEY(2, 3, KEY_T),
307 KEY(2, 4, KEY_G),
308 KEY(2, 5, KEY_U),
309 KEY(2, 6, KEY_J),
310 KEY(2, 7, KEY_K),
311 KEY(3, 0, SPITZ_KEY_ADDRESS), /* ADDRESS */
312 KEY(3, 1, KEY_W),
313 KEY(3, 2, KEY_S),
314 KEY(3, 3, KEY_F),
315 KEY(3, 4, KEY_V),
316 KEY(3, 5, KEY_H),
317 KEY(3, 6, KEY_M),
318 KEY(3, 7, KEY_L),
319 KEY(3, 9, KEY_RIGHTSHIFT),
320 KEY(4, 0, SPITZ_KEY_CALENDAR), /* CALENDAR */
321 KEY(4, 1, KEY_A),
322 KEY(4, 2, KEY_D),
323 KEY(4, 3, KEY_C),
324 KEY(4, 4, KEY_B),
325 KEY(4, 5, KEY_N),
326 KEY(4, 6, KEY_DOT),
327 KEY(4, 8, KEY_ENTER),
328 KEY(4, 9, KEY_LEFTSHIFT),
329 KEY(5, 0, SPITZ_KEY_MAIL), /* MAIL */
330 KEY(5, 1, KEY_Z),
331 KEY(5, 2, KEY_X),
332 KEY(5, 3, KEY_MINUS),
333 KEY(5, 4, KEY_SPACE),
334 KEY(5, 5, KEY_COMMA),
335 KEY(5, 7, KEY_UP),
336 KEY(5, 10, SPITZ_KEY_FN), /* FN */
337 KEY(6, 0, KEY_SYSRQ),
338 KEY(6, 1, SPITZ_KEY_JAP1), /* JAP1 */
339 KEY(6, 2, SPITZ_KEY_JAP2), /* JAP2 */
340 KEY(6, 3, SPITZ_KEY_CANCEL), /* CANCEL */
341 KEY(6, 4, SPITZ_KEY_OK), /* OK */
342 KEY(6, 5, SPITZ_KEY_MENU), /* MENU */
343 KEY(6, 6, KEY_LEFT),
344 KEY(6, 7, KEY_DOWN),
345 KEY(6, 8, KEY_RIGHT),
346};
347
348static const struct matrix_keymap_data spitzkbd_keymap_data = {
349 .keymap = spitzkbd_keymap,
350 .keymap_size = ARRAY_SIZE(spitzkbd_keymap),
351};
352
353static const uint32_t spitzkbd_row_gpios[] =
354 { 12, 17, 91, 34, 36, 38, 39 };
355static const uint32_t spitzkbd_col_gpios[] =
356 { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 };
357
358static struct matrix_keypad_platform_data spitzkbd_pdata = {
359 .keymap_data = &spitzkbd_keymap_data,
360 .row_gpios = spitzkbd_row_gpios,
361 .col_gpios = spitzkbd_col_gpios,
362 .num_row_gpios = ARRAY_SIZE(spitzkbd_row_gpios),
363 .num_col_gpios = ARRAY_SIZE(spitzkbd_col_gpios),
364 .col_scan_delay_us = 10,
365 .debounce_ms = 10,
366 .wakeup = 1,
367};
368
245static struct platform_device spitzkbd_device = { 369static struct platform_device spitzkbd_device = {
246 .name = "spitz-keyboard", 370 .name = "matrix-keypad",
247 .id = -1, 371 .id = -1,
372 .dev = {
373 .platform_data = &spitzkbd_pdata,
374 },
248}; 375};
249 376
250 377