aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/ezx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/ezx.c')
-rw-r--r--arch/arm/mach-pxa/ezx.c213
1 files changed, 187 insertions, 26 deletions
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 92ba16e1b6fc..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>
@@ -25,13 +26,19 @@
25#include <mach/pxa27x.h> 26#include <mach/pxa27x.h>
26#include <mach/pxafb.h> 27#include <mach/pxafb.h>
27#include <mach/ohci.h> 28#include <mach/ohci.h>
28#include <mach/i2c.h> 29#include <plat/i2c.h>
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <mach/pxa27x_keypad.h> 31#include <mach/pxa27x_keypad.h>
31 32
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
35static struct platform_pwm_backlight_data ezx_backlight_data = { 42static 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
91static struct platform_device *devices[] __initdata = { 98static struct platform_device *ezx_devices[] __initdata = {
92 &ezx_backlight_device, 99 &ezx_backlight_device,
93}; 100};
94 101
@@ -111,9 +118,9 @@ static unsigned long ezx_pin_config[] __initdata = {
111 GPIO25_SSP1_TXD, 118 GPIO25_SSP1_TXD,
112 GPIO26_SSP1_RXD, 119 GPIO26_SSP1_RXD,
113 GPIO24_GPIO, /* pcap chip select */ 120 GPIO24_GPIO, /* pcap chip select */
114 GPIO1_GPIO, /* pcap interrupt */ 121 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
115 GPIO4_GPIO, /* WDI_AP */ 122 GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
116 GPIO55_GPIO, /* SYS_RESTART */ 123 GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
117 124
118 /* MMC */ 125 /* MMC */
119 GPIO32_MMC_CLK, 126 GPIO32_MMC_CLK,
@@ -144,20 +151,20 @@ static unsigned long ezx_pin_config[] __initdata = {
144#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680) 151#if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
145static unsigned long gen1_pin_config[] __initdata = { 152static unsigned long gen1_pin_config[] __initdata = {
146 /* flip / lockswitch */ 153 /* flip / lockswitch */
147 GPIO12_GPIO, 154 GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
148 155
149 /* bluetooth (bcm2035) */ 156 /* bluetooth (bcm2035) */
150 GPIO14_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */ 157 GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
151 GPIO48_GPIO, /* RESET */ 158 GPIO48_GPIO, /* RESET */
152 GPIO28_GPIO, /* WAKEUP */ 159 GPIO28_GPIO, /* WAKEUP */
153 160
154 /* Neptune handshake */ 161 /* Neptune handshake */
155 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* BP_RDY */ 162 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
156 GPIO57_GPIO, /* AP_RDY */ 163 GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
157 GPIO13_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI */ 164 GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
158 GPIO3_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI2 */ 165 GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
159 GPIO82_GPIO, /* RESET */ 166 GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
160 GPIO99_GPIO, /* TC_MM_EN */ 167 GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
161 168
162 /* sound */ 169 /* sound */
163 GPIO52_SSP3_SCLK, 170 GPIO52_SSP3_SCLK,
@@ -199,21 +206,21 @@ static unsigned long gen1_pin_config[] __initdata = {
199 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6) 206 defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
200static unsigned long gen2_pin_config[] __initdata = { 207static unsigned long gen2_pin_config[] __initdata = {
201 /* flip / lockswitch */ 208 /* flip / lockswitch */
202 GPIO15_GPIO, 209 GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
203 210
204 /* EOC */ 211 /* EOC */
205 GPIO10_GPIO, 212 GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
206 213
207 /* bluetooth (bcm2045) */ 214 /* bluetooth (bcm2045) */
208 GPIO13_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */ 215 GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
209 GPIO37_GPIO, /* RESET */ 216 GPIO37_GPIO, /* RESET */
210 GPIO57_GPIO, /* WAKEUP */ 217 GPIO57_GPIO, /* WAKEUP */
211 218
212 /* Neptune handshake */ 219 /* Neptune handshake */
213 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* BP_RDY */ 220 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
214 GPIO96_GPIO, /* AP_RDY */ 221 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
215 GPIO3_GPIO | WAKEUP_ON_LEVEL_HIGH, /* WDI */ 222 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
216 GPIO116_GPIO, /* RESET */ 223 GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
217 GPIO41_GPIO, /* BP_FLASH */ 224 GPIO41_GPIO, /* BP_FLASH */
218 225
219 /* sound */ 226 /* sound */
@@ -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 */
662static 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
673static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
674 .buttons = a780_buttons,
675 .nbuttons = ARRAY_SIZE(a780_buttons),
676};
677
678static 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
686static struct platform_device *a780_devices[] __initdata = {
687 &a780_gpio_keys,
688};
689
654static void __init a780_init(void) 690static 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
669MACHINE_START(EZX_A780, "Motorola EZX A780") 706MACHINE_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 */
719static 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
730static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
731 .buttons = e680_buttons,
732 .nbuttons = ARRAY_SIZE(e680_buttons),
733};
734
735static 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
681static struct i2c_board_info __initdata e680_i2c_board_info[] = { 743static 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
747static struct platform_device *e680_devices[] __initdata = {
748 &e680_gpio_keys,
749};
750
685static void __init e680_init(void) 751static 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
701MACHINE_START(EZX_E680, "Motorola EZX E680") 768MACHINE_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 */
781static 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
792static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
793 .buttons = a1200_buttons,
794 .nbuttons = ARRAY_SIZE(a1200_buttons),
795};
796
797static 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
713static struct i2c_board_info __initdata a1200_i2c_board_info[] = { 805static 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
809static struct platform_device *a1200_devices[] __initdata = {
810 &a1200_gpio_keys,
811};
812
717static void __init a1200_init(void) 813static 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
733MACHINE_START(EZX_A1200, "Motorola EZX A1200") 830MACHINE_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 */
843static 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
854static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
855 .buttons = a910_buttons,
856 .nbuttons = ARRAY_SIZE(a910_buttons),
857};
858
859static 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
867static struct platform_device *a910_devices[] __initdata = {
868 &a910_gpio_keys,
869};
870
745static void __init a910_init(void) 871static 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
760MACHINE_START(EZX_A910, "Motorola EZX A910") 887MACHINE_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 */
900static 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
911static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
912 .buttons = e6_buttons,
913 .nbuttons = ARRAY_SIZE(e6_buttons),
914};
915
916static 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
772static struct i2c_board_info __initdata e6_i2c_board_info[] = { 924static 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
928static struct platform_device *e6_devices[] __initdata = {
929 &e6_gpio_keys,
930};
931
776static void __init e6_init(void) 932static 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
792MACHINE_START(EZX_E6, "Motorola EZX E6") 949MACHINE_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
965static struct platform_device *e2_devices[] __initdata = {
966};
967
808static void __init e2_init(void) 968static 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
824MACHINE_START(EZX_E2, "Motorola EZX E2") 985MACHINE_START(EZX_E2, "Motorola EZX E2")