diff options
Diffstat (limited to 'arch/arm/mach-pxa/ezx.c')
-rw-r--r-- | arch/arm/mach-pxa/ezx.c | 251 |
1 files changed, 247 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c index 588b265e5755..626c82b13970 100644 --- a/arch/arm/mach-pxa/ezx.c +++ b/arch/arm/mach-pxa/ezx.c | |||
@@ -17,7 +17,11 @@ | |||
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.h> | ||
20 | #include <linux/gpio_keys.h> | 21 | #include <linux/gpio_keys.h> |
22 | #include <linux/leds-lp3944.h> | ||
23 | |||
24 | #include <media/soc_camera.h> | ||
21 | 25 | ||
22 | #include <asm/setup.h> | 26 | #include <asm/setup.h> |
23 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
@@ -29,6 +33,7 @@ | |||
29 | #include <plat/i2c.h> | 33 | #include <plat/i2c.h> |
30 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
31 | #include <mach/pxa27x_keypad.h> | 35 | #include <mach/pxa27x_keypad.h> |
36 | #include <mach/camera.h> | ||
32 | 37 | ||
33 | #include "devices.h" | 38 | #include "devices.h" |
34 | #include "generic.h" | 39 | #include "generic.h" |
@@ -38,6 +43,9 @@ | |||
38 | #define GPIO15_A910_FLIP_LID 15 | 43 | #define GPIO15_A910_FLIP_LID 15 |
39 | #define GPIO12_E680_LOCK_SWITCH 12 | 44 | #define GPIO12_E680_LOCK_SWITCH 12 |
40 | #define GPIO15_E6_LOCK_SWITCH 15 | 45 | #define GPIO15_E6_LOCK_SWITCH 15 |
46 | #define GPIO50_nCAM_EN 50 | ||
47 | #define GPIO19_GEN1_CAM_RST 19 | ||
48 | #define GPIO28_GEN2_CAM_RST 28 | ||
41 | 49 | ||
42 | static struct platform_pwm_backlight_data ezx_backlight_data = { | 50 | static struct platform_pwm_backlight_data ezx_backlight_data = { |
43 | .pwm_id = 0, | 51 | .pwm_id = 0, |
@@ -191,8 +199,8 @@ static unsigned long gen1_pin_config[] __initdata = { | |||
191 | GPIO94_CIF_DD_5, | 199 | GPIO94_CIF_DD_5, |
192 | GPIO17_CIF_DD_6, | 200 | GPIO17_CIF_DD_6, |
193 | GPIO108_CIF_DD_7, | 201 | GPIO108_CIF_DD_7, |
194 | GPIO50_GPIO, /* CAM_EN */ | 202 | GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */ |
195 | GPIO19_GPIO, /* CAM_RST */ | 203 | GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */ |
196 | 204 | ||
197 | /* EMU */ | 205 | /* EMU */ |
198 | GPIO120_GPIO, /* EMU_MUX1 */ | 206 | GPIO120_GPIO, /* EMU_MUX1 */ |
@@ -248,8 +256,8 @@ static unsigned long gen2_pin_config[] __initdata = { | |||
248 | GPIO48_CIF_DD_5, | 256 | GPIO48_CIF_DD_5, |
249 | GPIO93_CIF_DD_6, | 257 | GPIO93_CIF_DD_6, |
250 | GPIO12_CIF_DD_7, | 258 | GPIO12_CIF_DD_7, |
251 | GPIO50_GPIO, /* CAM_EN */ | 259 | GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */ |
252 | GPIO28_GPIO, /* CAM_RST */ | 260 | GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */ |
253 | GPIO17_GPIO, /* CAM_FLASH */ | 261 | GPIO17_GPIO, /* CAM_FLASH */ |
254 | }; | 262 | }; |
255 | #endif | 263 | #endif |
@@ -683,6 +691,81 @@ static struct platform_device a780_gpio_keys = { | |||
683 | }, | 691 | }, |
684 | }; | 692 | }; |
685 | 693 | ||
694 | /* camera */ | ||
695 | static int a780_camera_init(void) | ||
696 | { | ||
697 | int err; | ||
698 | |||
699 | /* | ||
700 | * GPIO50_nCAM_EN is active low | ||
701 | * GPIO19_GEN1_CAM_RST is active on rising edge | ||
702 | */ | ||
703 | err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN"); | ||
704 | if (err) { | ||
705 | pr_err("%s: Failed to request nCAM_EN\n", __func__); | ||
706 | goto fail; | ||
707 | } | ||
708 | |||
709 | err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST"); | ||
710 | if (err) { | ||
711 | pr_err("%s: Failed to request CAM_RST\n", __func__); | ||
712 | goto fail_gpio_cam_rst; | ||
713 | } | ||
714 | |||
715 | gpio_direction_output(GPIO50_nCAM_EN, 1); | ||
716 | gpio_direction_output(GPIO19_GEN1_CAM_RST, 0); | ||
717 | |||
718 | return 0; | ||
719 | |||
720 | fail_gpio_cam_rst: | ||
721 | gpio_free(GPIO50_nCAM_EN); | ||
722 | fail: | ||
723 | return err; | ||
724 | } | ||
725 | |||
726 | static int a780_camera_power(struct device *dev, int on) | ||
727 | { | ||
728 | gpio_set_value(GPIO50_nCAM_EN, !on); | ||
729 | return 0; | ||
730 | } | ||
731 | |||
732 | static int a780_camera_reset(struct device *dev) | ||
733 | { | ||
734 | gpio_set_value(GPIO19_GEN1_CAM_RST, 0); | ||
735 | msleep(10); | ||
736 | gpio_set_value(GPIO19_GEN1_CAM_RST, 1); | ||
737 | |||
738 | return 0; | ||
739 | } | ||
740 | |||
741 | struct pxacamera_platform_data a780_pxacamera_platform_data = { | ||
742 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | ||
743 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | ||
744 | .mclk_10khz = 5000, | ||
745 | }; | ||
746 | |||
747 | static struct i2c_board_info a780_camera_i2c_board_info = { | ||
748 | I2C_BOARD_INFO("mt9m111", 0x5d), | ||
749 | }; | ||
750 | |||
751 | static struct soc_camera_link a780_iclink = { | ||
752 | .bus_id = 0, | ||
753 | .flags = SOCAM_SENSOR_INVERT_PCLK, | ||
754 | .i2c_adapter_id = 0, | ||
755 | .board_info = &a780_camera_i2c_board_info, | ||
756 | .module_name = "mt9m111", | ||
757 | .power = a780_camera_power, | ||
758 | .reset = a780_camera_reset, | ||
759 | }; | ||
760 | |||
761 | static struct platform_device a780_camera = { | ||
762 | .name = "soc-camera-pdrv", | ||
763 | .id = 0, | ||
764 | .dev = { | ||
765 | .platform_data = &a780_iclink, | ||
766 | }, | ||
767 | }; | ||
768 | |||
686 | static struct platform_device *a780_devices[] __initdata = { | 769 | static struct platform_device *a780_devices[] __initdata = { |
687 | &a780_gpio_keys, | 770 | &a780_gpio_keys, |
688 | }; | 771 | }; |
@@ -693,12 +776,21 @@ static void __init a780_init(void) | |||
693 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); | 776 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); |
694 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config)); | 777 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config)); |
695 | 778 | ||
779 | pxa_set_ffuart_info(NULL); | ||
780 | pxa_set_btuart_info(NULL); | ||
781 | pxa_set_stuart_info(NULL); | ||
782 | |||
696 | pxa_set_i2c_info(NULL); | 783 | pxa_set_i2c_info(NULL); |
697 | 784 | ||
698 | set_pxa_fb_info(&ezx_fb_info_1); | 785 | set_pxa_fb_info(&ezx_fb_info_1); |
699 | 786 | ||
700 | pxa_set_keypad_info(&a780_keypad_platform_data); | 787 | pxa_set_keypad_info(&a780_keypad_platform_data); |
701 | 788 | ||
789 | if (a780_camera_init() == 0) { | ||
790 | pxa_set_camera_info(&a780_pxacamera_platform_data); | ||
791 | platform_device_register(&a780_camera); | ||
792 | } | ||
793 | |||
702 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 794 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
703 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); | 795 | platform_add_devices(ARRAY_AND_SIZE(a780_devices)); |
704 | } | 796 | } |
@@ -754,6 +846,10 @@ static void __init e680_init(void) | |||
754 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); | 846 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config)); |
755 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config)); | 847 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config)); |
756 | 848 | ||
849 | pxa_set_ffuart_info(NULL); | ||
850 | pxa_set_btuart_info(NULL); | ||
851 | pxa_set_stuart_info(NULL); | ||
852 | |||
757 | pxa_set_i2c_info(NULL); | 853 | pxa_set_i2c_info(NULL); |
758 | i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); | 854 | i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); |
759 | 855 | ||
@@ -816,6 +912,10 @@ static void __init a1200_init(void) | |||
816 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | 912 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); |
817 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config)); | 913 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config)); |
818 | 914 | ||
915 | pxa_set_ffuart_info(NULL); | ||
916 | pxa_set_btuart_info(NULL); | ||
917 | pxa_set_stuart_info(NULL); | ||
918 | |||
819 | pxa_set_i2c_info(NULL); | 919 | pxa_set_i2c_info(NULL); |
820 | i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); | 920 | i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); |
821 | 921 | ||
@@ -864,6 +964,131 @@ static struct platform_device a910_gpio_keys = { | |||
864 | }, | 964 | }, |
865 | }; | 965 | }; |
866 | 966 | ||
967 | /* camera */ | ||
968 | static int a910_camera_init(void) | ||
969 | { | ||
970 | int err; | ||
971 | |||
972 | /* | ||
973 | * GPIO50_nCAM_EN is active low | ||
974 | * GPIO28_GEN2_CAM_RST is active on rising edge | ||
975 | */ | ||
976 | err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN"); | ||
977 | if (err) { | ||
978 | pr_err("%s: Failed to request nCAM_EN\n", __func__); | ||
979 | goto fail; | ||
980 | } | ||
981 | |||
982 | err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST"); | ||
983 | if (err) { | ||
984 | pr_err("%s: Failed to request CAM_RST\n", __func__); | ||
985 | goto fail_gpio_cam_rst; | ||
986 | } | ||
987 | |||
988 | gpio_direction_output(GPIO50_nCAM_EN, 1); | ||
989 | gpio_direction_output(GPIO28_GEN2_CAM_RST, 0); | ||
990 | |||
991 | return 0; | ||
992 | |||
993 | fail_gpio_cam_rst: | ||
994 | gpio_free(GPIO50_nCAM_EN); | ||
995 | fail: | ||
996 | return err; | ||
997 | } | ||
998 | |||
999 | static int a910_camera_power(struct device *dev, int on) | ||
1000 | { | ||
1001 | gpio_set_value(GPIO50_nCAM_EN, !on); | ||
1002 | return 0; | ||
1003 | } | ||
1004 | |||
1005 | static int a910_camera_reset(struct device *dev) | ||
1006 | { | ||
1007 | gpio_set_value(GPIO28_GEN2_CAM_RST, 0); | ||
1008 | msleep(10); | ||
1009 | gpio_set_value(GPIO28_GEN2_CAM_RST, 1); | ||
1010 | |||
1011 | return 0; | ||
1012 | } | ||
1013 | |||
1014 | struct pxacamera_platform_data a910_pxacamera_platform_data = { | ||
1015 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | | ||
1016 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, | ||
1017 | .mclk_10khz = 5000, | ||
1018 | }; | ||
1019 | |||
1020 | static struct i2c_board_info a910_camera_i2c_board_info = { | ||
1021 | I2C_BOARD_INFO("mt9m111", 0x5d), | ||
1022 | }; | ||
1023 | |||
1024 | static struct soc_camera_link a910_iclink = { | ||
1025 | .bus_id = 0, | ||
1026 | .i2c_adapter_id = 0, | ||
1027 | .board_info = &a910_camera_i2c_board_info, | ||
1028 | .module_name = "mt9m111", | ||
1029 | .power = a910_camera_power, | ||
1030 | .reset = a910_camera_reset, | ||
1031 | }; | ||
1032 | |||
1033 | static struct platform_device a910_camera = { | ||
1034 | .name = "soc-camera-pdrv", | ||
1035 | .id = 0, | ||
1036 | .dev = { | ||
1037 | .platform_data = &a910_iclink, | ||
1038 | }, | ||
1039 | }; | ||
1040 | |||
1041 | /* leds-lp3944 */ | ||
1042 | static struct lp3944_platform_data a910_lp3944_leds = { | ||
1043 | .leds_size = LP3944_LEDS_MAX, | ||
1044 | .leds = { | ||
1045 | [0] = { | ||
1046 | .name = "a910:red:", | ||
1047 | .status = LP3944_LED_STATUS_OFF, | ||
1048 | .type = LP3944_LED_TYPE_LED, | ||
1049 | }, | ||
1050 | [1] = { | ||
1051 | .name = "a910:green:", | ||
1052 | .status = LP3944_LED_STATUS_OFF, | ||
1053 | .type = LP3944_LED_TYPE_LED, | ||
1054 | }, | ||
1055 | [2] { | ||
1056 | .name = "a910:blue:", | ||
1057 | .status = LP3944_LED_STATUS_OFF, | ||
1058 | .type = LP3944_LED_TYPE_LED, | ||
1059 | }, | ||
1060 | /* Leds 3 and 4 are used as display power switches */ | ||
1061 | [3] = { | ||
1062 | .name = "a910::cli_display", | ||
1063 | .status = LP3944_LED_STATUS_OFF, | ||
1064 | .type = LP3944_LED_TYPE_LED_INVERTED | ||
1065 | }, | ||
1066 | [4] = { | ||
1067 | .name = "a910::main_display", | ||
1068 | .status = LP3944_LED_STATUS_ON, | ||
1069 | .type = LP3944_LED_TYPE_LED_INVERTED | ||
1070 | }, | ||
1071 | [5] = { .type = LP3944_LED_TYPE_NONE }, | ||
1072 | [6] = { | ||
1073 | .name = "a910::torch", | ||
1074 | .status = LP3944_LED_STATUS_OFF, | ||
1075 | .type = LP3944_LED_TYPE_LED, | ||
1076 | }, | ||
1077 | [7] = { | ||
1078 | .name = "a910::flash", | ||
1079 | .status = LP3944_LED_STATUS_OFF, | ||
1080 | .type = LP3944_LED_TYPE_LED_INVERTED, | ||
1081 | }, | ||
1082 | }, | ||
1083 | }; | ||
1084 | |||
1085 | static struct i2c_board_info __initdata a910_i2c_board_info[] = { | ||
1086 | { | ||
1087 | I2C_BOARD_INFO("lp3944", 0x60), | ||
1088 | .platform_data = &a910_lp3944_leds, | ||
1089 | }, | ||
1090 | }; | ||
1091 | |||
867 | static struct platform_device *a910_devices[] __initdata = { | 1092 | static struct platform_device *a910_devices[] __initdata = { |
868 | &a910_gpio_keys, | 1093 | &a910_gpio_keys, |
869 | }; | 1094 | }; |
@@ -874,12 +1099,22 @@ static void __init a910_init(void) | |||
874 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | 1099 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); |
875 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config)); | 1100 | pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config)); |
876 | 1101 | ||
1102 | pxa_set_ffuart_info(NULL); | ||
1103 | pxa_set_btuart_info(NULL); | ||
1104 | pxa_set_stuart_info(NULL); | ||
1105 | |||
877 | pxa_set_i2c_info(NULL); | 1106 | pxa_set_i2c_info(NULL); |
1107 | i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info)); | ||
878 | 1108 | ||
879 | set_pxa_fb_info(&ezx_fb_info_2); | 1109 | set_pxa_fb_info(&ezx_fb_info_2); |
880 | 1110 | ||
881 | pxa_set_keypad_info(&a910_keypad_platform_data); | 1111 | pxa_set_keypad_info(&a910_keypad_platform_data); |
882 | 1112 | ||
1113 | if (a910_camera_init() == 0) { | ||
1114 | pxa_set_camera_info(&a910_pxacamera_platform_data); | ||
1115 | platform_device_register(&a910_camera); | ||
1116 | } | ||
1117 | |||
883 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); | 1118 | platform_add_devices(ARRAY_AND_SIZE(ezx_devices)); |
884 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); | 1119 | platform_add_devices(ARRAY_AND_SIZE(a910_devices)); |
885 | } | 1120 | } |
@@ -935,6 +1170,10 @@ static void __init e6_init(void) | |||
935 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | 1170 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); |
936 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config)); | 1171 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config)); |
937 | 1172 | ||
1173 | pxa_set_ffuart_info(NULL); | ||
1174 | pxa_set_btuart_info(NULL); | ||
1175 | pxa_set_stuart_info(NULL); | ||
1176 | |||
938 | pxa_set_i2c_info(NULL); | 1177 | pxa_set_i2c_info(NULL); |
939 | i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); | 1178 | i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); |
940 | 1179 | ||
@@ -971,6 +1210,10 @@ static void __init e2_init(void) | |||
971 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); | 1210 | pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config)); |
972 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config)); | 1211 | pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config)); |
973 | 1212 | ||
1213 | pxa_set_ffuart_info(NULL); | ||
1214 | pxa_set_btuart_info(NULL); | ||
1215 | pxa_set_stuart_info(NULL); | ||
1216 | |||
974 | pxa_set_i2c_info(NULL); | 1217 | pxa_set_i2c_info(NULL); |
975 | i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); | 1218 | i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); |
976 | 1219 | ||