diff options
-rw-r--r-- | arch/arm/mach-pxa/ezx.c | 175 |
1 files changed, 168 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 4ce63b4e15c5..588b265e5755 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -17,6 +17,7 @@ | |||
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 | #include <linux/input.h> |
20 | #include <linux/gpio_keys.h> | ||
20 | 21 | ||
21 | #include <asm/setup.h> | 22 | #include <asm/setup.h> |
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
@@ -32,6 +33,12 @@ | |||
32 | #include "devices.h" | 33 | #include "devices.h" |
33 | #include "generic.h" | 34 | #include "generic.h" |
34 | 35 | ||
36 | #define GPIO12_A780_FLIP_LID 12 | ||
37 | #define GPIO15_A1200_FLIP_LID 15 | ||
38 | #define GPIO15_A910_FLIP_LID 15 | ||
39 | #define GPIO12_E680_LOCK_SWITCH 12 | ||
40 | #define GPIO15_E6_LOCK_SWITCH 15 | ||
41 | |||
35 | static struct platform_pwm_backlight_data ezx_backlight_data = { | 42 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
36 | .pwm_id = 0, | 43 | .pwm_id = 0, |
37 | .max_brightness = 1023, | 44 | .max_brightness = 1023, |
@@ -88,7 +95,7 @@ static struct pxafb_mach_info ezx_fb_info_2 = { | |||
88 | .lcd_conn = LCD_COLOR_TFT_18BPP, | 95 | .lcd_conn = LCD_COLOR_TFT_18BPP, |
89 | }; | 96 | }; |
90 | 97 | ||
91 | static struct platform_device *devices[] __initdata = { | 98 | static struct platform_device *ezx_devices[] __initdata = { |
92 | &ezx_backlight_device, | 99 | &ezx_backlight_device, |
93 | }; | 100 | }; |
94 | 101 | ||
@@ -651,6 +658,35 @@ static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { | |||
651 | #endif /* CONFIG_MACH_EZX_E2 */ | 658 | #endif /* CONFIG_MACH_EZX_E2 */ |
652 | 659 | ||
653 | #ifdef CONFIG_MACH_EZX_A780 | 660 | #ifdef CONFIG_MACH_EZX_A780 |
661 | /* gpio_keys */ | ||
662 | static struct gpio_keys_button a780_buttons[] = { | ||
663 | [0] = { | ||
664 | .code = SW_LID, | ||
665 | .gpio = GPIO12_A780_FLIP_LID, | ||
666 | .active_low = 0, | ||
667 | .desc = "A780 flip lid", | ||
668 | .type = EV_SW, | ||
669 | .wakeup = 1, | ||
670 | }, | ||
671 | }; | ||
672 | |||
673 | static struct gpio_keys_platform_data a780_gpio_keys_platform_data = { | ||
674 | .buttons = a780_buttons, | ||
675 | .nbuttons = ARRAY_SIZE(a780_buttons), | ||
676 | }; | ||
677 | |||
678 | static struct platform_device a780_gpio_keys = { | ||
679 | .name = "gpio-keys", | ||
680 | .id = -1, | ||
681 | .dev = { | ||
682 | .platform_data = &a780_gpio_keys_platform_data, | ||
683 | }, | ||
684 | }; | ||
685 | |||
686 | static struct platform_device *a780_devices[] __initdata = { | ||
687 | &a780_gpio_keys, | ||
688 | }; | ||
689 | |||
654 | static void __init a780_init(void) | 690 | static void __init a780_init(void) |
655 | { | 691 | { |
656 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 692 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -663,7 +699,8 @@ static void __init a780_init(void) | |||
663 | 699 | ||
664 | pxa_set_keypad_info(&a780_keypad_platform_data); | 700 | pxa_set_keypad_info(&a780_keypad_platform_data); |
665 | 701 | ||
666 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 702 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
703 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); | ||
667 | } | 704 | } |
668 | 705 | ||
669 | MACHINE_START(EZX_A780, "Motorola EZX A780") | 706 | MACHINE_START(EZX_A780, "Motorola EZX A780") |
@@ -678,10 +715,39 @@ MACHINE_END | |||
678 | #endif | 715 | #endif |
679 | 716 | ||
680 | #ifdef CONFIG_MACH_EZX_E680 | 717 | #ifdef CONFIG_MACH_EZX_E680 |
718 | /* gpio_keys */ | ||
719 | static struct gpio_keys_button e680_buttons[] = { | ||
720 | [0] = { | ||
721 | .code = KEY_SCREENLOCK, | ||
722 | .gpio = GPIO12_E680_LOCK_SWITCH, | ||
723 | .active_low = 0, | ||
724 | .desc = "E680 lock switch", | ||
725 | .type = EV_KEY, | ||
726 | .wakeup = 1, | ||
727 | }, | ||
728 | }; | ||
729 | |||
730 | static struct gpio_keys_platform_data e680_gpio_keys_platform_data = { | ||
731 | .buttons = e680_buttons, | ||
732 | .nbuttons = ARRAY_SIZE(e680_buttons), | ||
733 | }; | ||
734 | |||
735 | static struct platform_device e680_gpio_keys = { | ||
736 | .name = "gpio-keys", | ||
737 | .id = -1, | ||
738 | .dev = { | ||
739 | .platform_data = &e680_gpio_keys_platform_data, | ||
740 | }, | ||
741 | }; | ||
742 | |||
681 | static struct i2c_board_info __initdata e680_i2c_board_info[] = { | 743 | static struct i2c_board_info __initdata e680_i2c_board_info[] = { |
682 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 744 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
683 | }; | 745 | }; |
684 | 746 | ||
747 | static struct platform_device *e680_devices[] __initdata = { | ||
748 | &e680_gpio_keys, | ||
749 | }; | ||
750 | |||
685 | static void __init e680_init(void) | 751 | static void __init e680_init(void) |
686 | { | 752 | { |
687 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 753 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -695,7 +761,8 @@ static void __init e680_init(void) | |||
695 | 761 | ||
696 | pxa_set_keypad_info(&e680_keypad_platform_data); | 762 | pxa_set_keypad_info(&e680_keypad_platform_data); |
697 | 763 | ||
698 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 764 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
765 | platform_add_devices(ARRAY_AND_SIZE(e680_devices)); | ||
699 | } | 766 | } |
700 | 767 | ||
701 | MACHINE_START(EZX_E680, "Motorola EZX E680") | 768 | MACHINE_START(EZX_E680, "Motorola EZX E680") |
@@ -710,10 +777,39 @@ MACHINE_END | |||
710 | #endif | 777 | #endif |
711 | 778 | ||
712 | #ifdef CONFIG_MACH_EZX_A1200 | 779 | #ifdef CONFIG_MACH_EZX_A1200 |
780 | /* gpio_keys */ | ||
781 | static struct gpio_keys_button a1200_buttons[] = { | ||
782 | [0] = { | ||
783 | .code = SW_LID, | ||
784 | .gpio = GPIO15_A1200_FLIP_LID, | ||
785 | .active_low = 0, | ||
786 | .desc = "A1200 flip lid", | ||
787 | .type = EV_SW, | ||
788 | .wakeup = 1, | ||
789 | }, | ||
790 | }; | ||
791 | |||
792 | static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = { | ||
793 | .buttons = a1200_buttons, | ||
794 | .nbuttons = ARRAY_SIZE(a1200_buttons), | ||
795 | }; | ||
796 | |||
797 | static struct platform_device a1200_gpio_keys = { | ||
798 | .name = "gpio-keys", | ||
799 | .id = -1, | ||
800 | .dev = { | ||
801 | .platform_data = &a1200_gpio_keys_platform_data, | ||
802 | }, | ||
803 | }; | ||
804 | |||
713 | static struct i2c_board_info __initdata a1200_i2c_board_info[] = { | 805 | static struct i2c_board_info __initdata a1200_i2c_board_info[] = { |
714 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 806 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
715 | }; | 807 | }; |
716 | 808 | ||
809 | static struct platform_device *a1200_devices[] __initdata = { | ||
810 | &a1200_gpio_keys, | ||
811 | }; | ||
812 | |||
717 | static void __init a1200_init(void) | 813 | static void __init a1200_init(void) |
718 | { | 814 | { |
719 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 815 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -727,7 +823,8 @@ static void __init a1200_init(void) | |||
727 | 823 | ||
728 | pxa_set_keypad_info(&a1200_keypad_platform_data); | 824 | pxa_set_keypad_info(&a1200_keypad_platform_data); |
729 | 825 | ||
730 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 826 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
827 | platform_add_devices(ARRAY_AND_SIZE(a1200_devices)); | ||
731 | } | 828 | } |
732 | 829 | ||
733 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") | 830 | MACHINE_START(EZX_A1200, "Motorola EZX A1200") |
@@ -742,6 +839,35 @@ MACHINE_END | |||
742 | #endif | 839 | #endif |
743 | 840 | ||
744 | #ifdef CONFIG_MACH_EZX_A910 | 841 | #ifdef CONFIG_MACH_EZX_A910 |
842 | /* gpio_keys */ | ||
843 | static struct gpio_keys_button a910_buttons[] = { | ||
844 | [0] = { | ||
845 | .code = SW_LID, | ||
846 | .gpio = GPIO15_A910_FLIP_LID, | ||
847 | .active_low = 0, | ||
848 | .desc = "A910 flip lid", | ||
849 | .type = EV_SW, | ||
850 | .wakeup = 1, | ||
851 | }, | ||
852 | }; | ||
853 | |||
854 | static struct gpio_keys_platform_data a910_gpio_keys_platform_data = { | ||
855 | .buttons = a910_buttons, | ||
856 | .nbuttons = ARRAY_SIZE(a910_buttons), | ||
857 | }; | ||
858 | |||
859 | static struct platform_device a910_gpio_keys = { | ||
860 | .name = "gpio-keys", | ||
861 | .id = -1, | ||
862 | .dev = { | ||
863 | .platform_data = &a910_gpio_keys_platform_data, | ||
864 | }, | ||
865 | }; | ||
866 | |||
867 | static struct platform_device *a910_devices[] __initdata = { | ||
868 | &a910_gpio_keys, | ||
869 | }; | ||
870 | |||
745 | static void __init a910_init(void) | 871 | static void __init a910_init(void) |
746 | { | 872 | { |
747 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 873 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -754,7 +880,8 @@ static void __init a910_init(void) | |||
754 | 880 | ||
755 | pxa_set_keypad_info(&a910_keypad_platform_data); | 881 | pxa_set_keypad_info(&a910_keypad_platform_data); |
756 | 882 | ||
757 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 883 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
884 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); | ||
758 | } | 885 | } |
759 | 886 | ||
760 | MACHINE_START(EZX_A910, "Motorola EZX A910") | 887 | MACHINE_START(EZX_A910, "Motorola EZX A910") |
@@ -769,10 +896,39 @@ MACHINE_END | |||
769 | #endif | 896 | #endif |
770 | 897 | ||
771 | #ifdef CONFIG_MACH_EZX_E6 | 898 | #ifdef CONFIG_MACH_EZX_E6 |
899 | /* gpio_keys */ | ||
900 | static struct gpio_keys_button e6_buttons[] = { | ||
901 | [0] = { | ||
902 | .code = KEY_SCREENLOCK, | ||
903 | .gpio = GPIO15_E6_LOCK_SWITCH, | ||
904 | .active_low = 0, | ||
905 | .desc = "E6 lock switch", | ||
906 | .type = EV_KEY, | ||
907 | .wakeup = 1, | ||
908 | }, | ||
909 | }; | ||
910 | |||
911 | static struct gpio_keys_platform_data e6_gpio_keys_platform_data = { | ||
912 | .buttons = e6_buttons, | ||
913 | .nbuttons = ARRAY_SIZE(e6_buttons), | ||
914 | }; | ||
915 | |||
916 | static struct platform_device e6_gpio_keys = { | ||
917 | .name = "gpio-keys", | ||
918 | .id = -1, | ||
919 | .dev = { | ||
920 | .platform_data = &e6_gpio_keys_platform_data, | ||
921 | }, | ||
922 | }; | ||
923 | |||
772 | static struct i2c_board_info __initdata e6_i2c_board_info[] = { | 924 | static struct i2c_board_info __initdata e6_i2c_board_info[] = { |
773 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 925 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
774 | }; | 926 | }; |
775 | 927 | ||
928 | static struct platform_device *e6_devices[] __initdata = { | ||
929 | &e6_gpio_keys, | ||
930 | }; | ||
931 | |||
776 | static void __init e6_init(void) | 932 | static void __init e6_init(void) |
777 | { | 933 | { |
778 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 934 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -786,7 +942,8 @@ static void __init e6_init(void) | |||
786 | 942 | ||
787 | pxa_set_keypad_info(&e6_keypad_platform_data); | 943 | pxa_set_keypad_info(&e6_keypad_platform_data); |
788 | 944 | ||
789 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 945 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
946 | platform_add_devices(ARRAY_AND_SIZE(e6_devices)); | ||
790 | } | 947 | } |
791 | 948 | ||
792 | MACHINE_START(EZX_E6, "Motorola EZX E6") | 949 | MACHINE_START(EZX_E6, "Motorola EZX E6") |
@@ -805,6 +962,9 @@ static struct i2c_board_info __initdata e2_i2c_board_info[] = { | |||
805 | { I2C_BOARD_INFO("tea5767", 0x81) }, | 962 | { I2C_BOARD_INFO("tea5767", 0x81) }, |
806 | }; | 963 | }; |
807 | 964 | ||
965 | static struct platform_device *e2_devices[] __initdata = { | ||
966 | }; | ||
967 | |||
808 | static void __init e2_init(void) | 968 | static void __init e2_init(void) |
809 | { | 969 | { |
810 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); | 970 | pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config)); |
@@ -818,7 +978,8 @@ static void __init e2_init(void) | |||
818 | 978 | ||
819 | pxa_set_keypad_info(&e2_keypad_platform_data); | 979 | pxa_set_keypad_info(&e2_keypad_platform_data); |
820 | 980 | ||
821 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 981 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
982 | platform_add_devices(ARRAY_AND_SIZE(e2_devices)); | ||
822 | } | 983 | } |
823 | 984 | ||
824 | MACHINE_START(EZX_E2, "Motorola EZX E2") | 985 | MACHINE_START(EZX_E2, "Motorola EZX E2") |