diff options
author | Stefan Schmidt <stefan@datenfreihafen.org> | 2008-12-08 09:58:09 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2008-12-17 09:51:39 -0500 |
commit | fe9490c67ad26bdf5e0c32019e7da591c253bee2 (patch) | |
tree | e3747b1c2c3c0fae5c94288a98497e25eb70c81d | |
parent | 9078ac21530ce15705c59ebaee0b33508385936d (diff) |
[ARM] pxa/ezx: Keypad configuration
Matrix and single key setups for all phones.
Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r-- | arch/arm/mach-pxa/ezx.c | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 44a418ac88a4..1382b4919d16 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -16,11 +16,13 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/pwm_backlight.h> | 18 | #include <linux/pwm_backlight.h> |
19 | #include <linux/input.h> | ||
19 | 20 | ||
20 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
21 | #include <mach/pxafb.h> | 22 | #include <mach/pxafb.h> |
22 | #include <mach/ohci.h> | 23 | #include <mach/ohci.h> |
23 | #include <mach/i2c.h> | 24 | #include <mach/i2c.h> |
25 | #include <mach/pxa27x_keypad.h> | ||
24 | 26 | ||
25 | #include <mach/mfp-pxa27x.h> | 27 | #include <mach/mfp-pxa27x.h> |
26 | #include <mach/pxa-regs.h> | 28 | #include <mach/pxa-regs.h> |
@@ -372,6 +374,283 @@ static unsigned long e6_pin_config[] __initdata = { | |||
372 | }; | 374 | }; |
373 | #endif | 375 | #endif |
374 | 376 | ||
377 | /* KEYPAD */ | ||
378 | #ifdef CONFIG_MACH_EZX_A780 | ||
379 | static unsigned int a780_key_map[] = { | ||
380 | KEY(0, 0, KEY_SEND), | ||
381 | KEY(0, 1, KEY_BACK), | ||
382 | KEY(0, 2, KEY_END), | ||
383 | KEY(0, 3, KEY_PAGEUP), | ||
384 | KEY(0, 4, KEY_UP), | ||
385 | |||
386 | KEY(1, 0, KEY_NUMERIC_1), | ||
387 | KEY(1, 1, KEY_NUMERIC_2), | ||
388 | KEY(1, 2, KEY_NUMERIC_3), | ||
389 | KEY(1, 3, KEY_SELECT), | ||
390 | KEY(1, 4, KEY_KPENTER), | ||
391 | |||
392 | KEY(2, 0, KEY_NUMERIC_4), | ||
393 | KEY(2, 1, KEY_NUMERIC_5), | ||
394 | KEY(2, 2, KEY_NUMERIC_6), | ||
395 | KEY(2, 3, KEY_RECORD), | ||
396 | KEY(2, 4, KEY_LEFT), | ||
397 | |||
398 | KEY(3, 0, KEY_NUMERIC_7), | ||
399 | KEY(3, 1, KEY_NUMERIC_8), | ||
400 | KEY(3, 2, KEY_NUMERIC_9), | ||
401 | KEY(3, 3, KEY_HOME), | ||
402 | KEY(3, 4, KEY_RIGHT), | ||
403 | |||
404 | KEY(4, 0, KEY_NUMERIC_STAR), | ||
405 | KEY(4, 1, KEY_NUMERIC_0), | ||
406 | KEY(4, 2, KEY_NUMERIC_POUND), | ||
407 | KEY(4, 3, KEY_PAGEDOWN), | ||
408 | KEY(4, 4, KEY_DOWN), | ||
409 | }; | ||
410 | |||
411 | static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { | ||
412 | .matrix_key_rows = 5, | ||
413 | .matrix_key_cols = 5, | ||
414 | .matrix_key_map = a780_key_map, | ||
415 | .matrix_key_map_size = ARRAY_SIZE(a780_key_map), | ||
416 | |||
417 | .direct_key_map = { KEY_CAMERA }, | ||
418 | .direct_key_num = 1, | ||
419 | |||
420 | .debounce_interval = 30, | ||
421 | }; | ||
422 | #endif /* CONFIG_MACH_EZX_A780 */ | ||
423 | |||
424 | #ifdef CONFIG_MACH_EZX_E680 | ||
425 | static unsigned int e680_key_map[] = { | ||
426 | KEY(0, 0, KEY_UP), | ||
427 | KEY(0, 1, KEY_RIGHT), | ||
428 | KEY(0, 2, KEY_RESERVED), | ||
429 | KEY(0, 3, KEY_SEND), | ||
430 | |||
431 | KEY(1, 0, KEY_DOWN), | ||
432 | KEY(1, 1, KEY_LEFT), | ||
433 | KEY(1, 2, KEY_PAGEUP), | ||
434 | KEY(1, 3, KEY_PAGEDOWN), | ||
435 | |||
436 | KEY(2, 0, KEY_RESERVED), | ||
437 | KEY(2, 1, KEY_RESERVED), | ||
438 | KEY(2, 2, KEY_RESERVED), | ||
439 | KEY(2, 3, KEY_KPENTER), | ||
440 | }; | ||
441 | |||
442 | static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { | ||
443 | .matrix_key_rows = 3, | ||
444 | .matrix_key_cols = 4, | ||
445 | .matrix_key_map = e680_key_map, | ||
446 | .matrix_key_map_size = ARRAY_SIZE(e680_key_map), | ||
447 | |||
448 | .direct_key_map = { | ||
449 | KEY_CAMERA, | ||
450 | KEY_RESERVED, | ||
451 | KEY_RESERVED, | ||
452 | KEY_F1, | ||
453 | KEY_CANCEL, | ||
454 | KEY_F2, | ||
455 | }, | ||
456 | .direct_key_num = 6, | ||
457 | |||
458 | .debounce_interval = 30, | ||
459 | }; | ||
460 | #endif /* CONFIG_MACH_EZX_E680 */ | ||
461 | |||
462 | #ifdef CONFIG_MACH_EZX_A1200 | ||
463 | static unsigned int a1200_key_map[] = { | ||
464 | KEY(0, 0, KEY_RESERVED), | ||
465 | KEY(0, 1, KEY_RIGHT), | ||
466 | KEY(0, 2, KEY_PAGEDOWN), | ||
467 | KEY(0, 3, KEY_RESERVED), | ||
468 | KEY(0, 4, KEY_RESERVED), | ||
469 | KEY(0, 5, KEY_RESERVED), | ||
470 | |||
471 | KEY(1, 0, KEY_RESERVED), | ||
472 | KEY(1, 1, KEY_DOWN), | ||
473 | KEY(1, 2, KEY_CAMERA), | ||
474 | KEY(1, 3, KEY_RESERVED), | ||
475 | KEY(1, 4, KEY_RESERVED), | ||
476 | KEY(1, 5, KEY_RESERVED), | ||
477 | |||
478 | KEY(2, 0, KEY_RESERVED), | ||
479 | KEY(2, 1, KEY_KPENTER), | ||
480 | KEY(2, 2, KEY_RECORD), | ||
481 | KEY(2, 3, KEY_RESERVED), | ||
482 | KEY(2, 4, KEY_RESERVED), | ||
483 | KEY(2, 5, KEY_SELECT), | ||
484 | |||
485 | KEY(3, 0, KEY_RESERVED), | ||
486 | KEY(3, 1, KEY_UP), | ||
487 | KEY(3, 2, KEY_SEND), | ||
488 | KEY(3, 3, KEY_RESERVED), | ||
489 | KEY(3, 4, KEY_RESERVED), | ||
490 | KEY(3, 5, KEY_RESERVED), | ||
491 | |||
492 | KEY(4, 0, KEY_RESERVED), | ||
493 | KEY(4, 1, KEY_LEFT), | ||
494 | KEY(4, 2, KEY_PAGEUP), | ||
495 | KEY(4, 3, KEY_RESERVED), | ||
496 | KEY(4, 4, KEY_RESERVED), | ||
497 | KEY(4, 5, KEY_RESERVED), | ||
498 | }; | ||
499 | |||
500 | static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { | ||
501 | .matrix_key_rows = 5, | ||
502 | .matrix_key_cols = 6, | ||
503 | .matrix_key_map = a1200_key_map, | ||
504 | .matrix_key_map_size = ARRAY_SIZE(a1200_key_map), | ||
505 | |||
506 | .debounce_interval = 30, | ||
507 | }; | ||
508 | #endif /* CONFIG_MACH_EZX_A1200 */ | ||
509 | |||
510 | #ifdef CONFIG_MACH_EZX_E6 | ||
511 | static unsigned int e6_key_map[] = { | ||
512 | KEY(0, 0, KEY_RESERVED), | ||
513 | KEY(0, 1, KEY_RIGHT), | ||
514 | KEY(0, 2, KEY_PAGEDOWN), | ||
515 | KEY(0, 3, KEY_RESERVED), | ||
516 | KEY(0, 4, KEY_RESERVED), | ||
517 | KEY(0, 5, KEY_NEXTSONG), | ||
518 | |||
519 | KEY(1, 0, KEY_RESERVED), | ||
520 | KEY(1, 1, KEY_DOWN), | ||
521 | KEY(1, 2, KEY_PROG1), | ||
522 | KEY(1, 3, KEY_RESERVED), | ||
523 | KEY(1, 4, KEY_RESERVED), | ||
524 | KEY(1, 5, KEY_RESERVED), | ||
525 | |||
526 | KEY(2, 0, KEY_RESERVED), | ||
527 | KEY(2, 1, KEY_ENTER), | ||
528 | KEY(2, 2, KEY_CAMERA), | ||
529 | KEY(2, 3, KEY_RESERVED), | ||
530 | KEY(2, 4, KEY_RESERVED), | ||
531 | KEY(2, 5, KEY_WWW), | ||
532 | |||
533 | KEY(3, 0, KEY_RESERVED), | ||
534 | KEY(3, 1, KEY_UP), | ||
535 | KEY(3, 2, KEY_SEND), | ||
536 | KEY(3, 3, KEY_RESERVED), | ||
537 | KEY(3, 4, KEY_RESERVED), | ||
538 | KEY(3, 5, KEY_PLAYPAUSE), | ||
539 | |||
540 | KEY(4, 0, KEY_RESERVED), | ||
541 | KEY(4, 1, KEY_LEFT), | ||
542 | KEY(4, 2, KEY_PAGEUP), | ||
543 | KEY(4, 3, KEY_RESERVED), | ||
544 | KEY(4, 4, KEY_RESERVED), | ||
545 | KEY(4, 5, KEY_PREVIOUSSONG), | ||
546 | }; | ||
547 | |||
548 | static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { | ||
549 | .matrix_key_rows = 5, | ||
550 | .matrix_key_cols = 6, | ||
551 | .matrix_key_map = e6_key_map, | ||
552 | .matrix_key_map_size = ARRAY_SIZE(e6_key_map), | ||
553 | |||
554 | .debounce_interval = 30, | ||
555 | }; | ||
556 | #endif /* CONFIG_MACH_EZX_E6 */ | ||
557 | |||
558 | #ifdef CONFIG_MACH_EZX_A910 | ||
559 | static unsigned int a910_key_map[] = { | ||
560 | KEY(0, 0, KEY_NUMERIC_6), | ||
561 | KEY(0, 1, KEY_RIGHT), | ||
562 | KEY(0, 2, KEY_PAGEDOWN), | ||
563 | KEY(0, 3, KEY_KPENTER), | ||
564 | KEY(0, 4, KEY_NUMERIC_5), | ||
565 | KEY(0, 5, KEY_CAMERA), | ||
566 | |||
567 | KEY(1, 0, KEY_NUMERIC_8), | ||
568 | KEY(1, 1, KEY_DOWN), | ||
569 | KEY(1, 2, KEY_RESERVED), | ||
570 | KEY(1, 3, KEY_F1), /* Left SoftKey */ | ||
571 | KEY(1, 4, KEY_NUMERIC_STAR), | ||
572 | KEY(1, 5, KEY_RESERVED), | ||
573 | |||
574 | KEY(2, 0, KEY_NUMERIC_7), | ||
575 | KEY(2, 1, KEY_NUMERIC_9), | ||
576 | KEY(2, 2, KEY_RECORD), | ||
577 | KEY(2, 3, KEY_F2), /* Right SoftKey */ | ||
578 | KEY(2, 4, KEY_BACK), | ||
579 | KEY(2, 5, KEY_SELECT), | ||
580 | |||
581 | KEY(3, 0, KEY_NUMERIC_2), | ||
582 | KEY(3, 1, KEY_UP), | ||
583 | KEY(3, 2, KEY_SEND), | ||
584 | KEY(3, 3, KEY_NUMERIC_0), | ||
585 | KEY(3, 4, KEY_NUMERIC_1), | ||
586 | KEY(3, 5, KEY_RECORD), | ||
587 | |||
588 | KEY(4, 0, KEY_NUMERIC_4), | ||
589 | KEY(4, 1, KEY_LEFT), | ||
590 | KEY(4, 2, KEY_PAGEUP), | ||
591 | KEY(4, 3, KEY_NUMERIC_POUND), | ||
592 | KEY(4, 4, KEY_NUMERIC_3), | ||
593 | KEY(4, 5, KEY_RESERVED), | ||
594 | }; | ||
595 | |||
596 | static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { | ||
597 | .matrix_key_rows = 5, | ||
598 | .matrix_key_cols = 6, | ||
599 | .matrix_key_map = a910_key_map, | ||
600 | .matrix_key_map_size = ARRAY_SIZE(a910_key_map), | ||
601 | |||
602 | .debounce_interval = 30, | ||
603 | }; | ||
604 | #endif /* CONFIG_MACH_EZX_A910 */ | ||
605 | |||
606 | #ifdef CONFIG_MACH_EZX_E2 | ||
607 | static unsigned int e2_key_map[] = { | ||
608 | KEY(0, 0, KEY_NUMERIC_6), | ||
609 | KEY(0, 1, KEY_RIGHT), | ||
610 | KEY(0, 2, KEY_NUMERIC_9), | ||
611 | KEY(0, 3, KEY_NEXTSONG), | ||
612 | KEY(0, 4, KEY_NUMERIC_5), | ||
613 | KEY(0, 5, KEY_F1), /* Left SoftKey */ | ||
614 | |||
615 | KEY(1, 0, KEY_NUMERIC_8), | ||
616 | KEY(1, 1, KEY_DOWN), | ||
617 | KEY(1, 2, KEY_RESERVED), | ||
618 | KEY(1, 3, KEY_PAGEUP), | ||
619 | KEY(1, 4, KEY_NUMERIC_STAR), | ||
620 | KEY(1, 5, KEY_F2), /* Right SoftKey */ | ||
621 | |||
622 | KEY(2, 0, KEY_NUMERIC_7), | ||
623 | KEY(2, 1, KEY_KPENTER), | ||
624 | KEY(2, 2, KEY_RECORD), | ||
625 | KEY(2, 3, KEY_PAGEDOWN), | ||
626 | KEY(2, 4, KEY_BACK), | ||
627 | KEY(2, 5, KEY_NUMERIC_0), | ||
628 | |||
629 | KEY(3, 0, KEY_NUMERIC_2), | ||
630 | KEY(3, 1, KEY_UP), | ||
631 | KEY(3, 2, KEY_SEND), | ||
632 | KEY(3, 3, KEY_PLAYPAUSE), | ||
633 | KEY(3, 4, KEY_NUMERIC_1), | ||
634 | KEY(3, 5, KEY_SOUND), /* Music SoftKey */ | ||
635 | |||
636 | KEY(4, 0, KEY_NUMERIC_4), | ||
637 | KEY(4, 1, KEY_LEFT), | ||
638 | KEY(4, 2, KEY_NUMERIC_POUND), | ||
639 | KEY(4, 3, KEY_PREVIOUSSONG), | ||
640 | KEY(4, 4, KEY_NUMERIC_3), | ||
641 | KEY(4, 5, KEY_RESERVED), | ||
642 | }; | ||
643 | |||
644 | static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | ||
645 | .matrix_key_rows = 5, | ||
646 | .matrix_key_cols = 6, | ||
647 | .matrix_key_map = e2_key_map, | ||
648 | .matrix_key_map_size = ARRAY_SIZE(e2_key_map), | ||
649 | |||
650 | .debounce_interval = 30, | ||
651 | }; | ||
652 | #endif /* CONFIG_MACH_EZX_E2 */ | ||
653 | |||
375 | #ifdef CONFIG_MACH_EZX_A780 | 654 | #ifdef CONFIG_MACH_EZX_A780 |
376 | static void __init a780_init(void) | 655 | static void __init a780_init(void) |
377 | { | 656 | { |
@@ -383,6 +662,8 @@ static void __init a780_init(void) | |||
383 | 662 | ||
384 | set_pxa_fb_info(&ezx_fb_info_1); | 663 | set_pxa_fb_info(&ezx_fb_info_1); |
385 | 664 | ||
665 | pxa_set_keypad_info(&a780_keypad_platform_data); | ||
666 | |||
386 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 667 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
387 | } | 668 | } |
388 | 669 | ||
@@ -408,6 +689,8 @@ static void __init e680_init(void) | |||
408 | 689 | ||
409 | set_pxa_fb_info(&ezx_fb_info_1); | 690 | set_pxa_fb_info(&ezx_fb_info_1); |
410 | 691 | ||
692 | pxa_set_keypad_info(&e680_keypad_platform_data); | ||
693 | |||
411 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 694 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
412 | } | 695 | } |
413 | 696 | ||
@@ -433,6 +716,8 @@ static void __init a1200_init(void) | |||
433 | 716 | ||
434 | set_pxa_fb_info(&ezx_fb_info_2); | 717 | set_pxa_fb_info(&ezx_fb_info_2); |
435 | 718 | ||
719 | pxa_set_keypad_info(&a1200_keypad_platform_data); | ||
720 | |||
436 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 721 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
437 | } | 722 | } |
438 | 723 | ||
@@ -458,6 +743,8 @@ static void __init a910_init(void) | |||
458 | 743 | ||
459 | set_pxa_fb_info(&ezx_fb_info_2); | 744 | set_pxa_fb_info(&ezx_fb_info_2); |
460 | 745 | ||
746 | pxa_set_keypad_info(&a910_keypad_platform_data); | ||
747 | |||
461 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 748 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
462 | } | 749 | } |
463 | 750 | ||
@@ -483,6 +770,8 @@ static void __init e6_init(void) | |||
483 | 770 | ||
484 | set_pxa_fb_info(&ezx_fb_info_2); | 771 | set_pxa_fb_info(&ezx_fb_info_2); |
485 | 772 | ||
773 | pxa_set_keypad_info(&e6_keypad_platform_data); | ||
774 | |||
486 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 775 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
487 | } | 776 | } |
488 | 777 | ||
@@ -508,6 +797,8 @@ static void __init e2_init(void) | |||
508 | 797 | ||
509 | set_pxa_fb_info(&ezx_fb_info_2); | 798 | set_pxa_fb_info(&ezx_fb_info_2); |
510 | 799 | ||
800 | pxa_set_keypad_info(&e2_keypad_platform_data); | ||
801 | |||
511 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 802 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
512 | } | 803 | } |
513 | 804 | ||