Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/i2c.h> |
| 14 | #include <linux/i2c/sx150x.h> |
| 15 | #include <linux/gpio.h> |
| 16 | #include <linux/regulator/consumer.h> |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <asm/mach-types.h> |
| 20 | #include <mach/msm_iomap.h> |
| 21 | #include <mach/board.h> |
| 22 | #include <mach/irqs-7xxx.h> |
| 23 | #include "devices-msm7x2xa.h" |
| 24 | #include "board-msm7627a.h" |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 25 | #include <mach/vreg.h> |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 26 | |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 27 | #define GPIO_SKU1_CAM_VGA_SHDN 18 |
| 28 | #define GPIO_SKU1_CAM_VGA_RESET_N 29 |
| 29 | #define GPIO_SKU3_CAM_5MP_SHDN_N 5 /* PWDN */ |
| 30 | #define GPIO_SKU3_CAM_5MP_CAMIF_RESET 6 /* (board_is(EVT))?123:121 RESET */ |
| 31 | #define GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN 30 |
| 32 | |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 33 | #ifdef CONFIG_MSM_CAMERA_V4L2 |
| 34 | static uint32_t camera_off_gpio_table[] = { |
| 35 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 36 | }; |
| 37 | |
| 38 | static uint32_t camera_on_gpio_table[] = { |
| 39 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 40 | }; |
| 41 | |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 42 | static struct gpio s5k4e1_cam_req_gpio[] = { |
| 43 | {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_DIR_OUT, "CAM_RESET"}, |
| 44 | }; |
| 45 | |
| 46 | static struct msm_gpio_set_tbl s5k4e1_cam_gpio_set_tbl[] = { |
| 47 | {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_OUT_INIT_LOW, 1000}, |
| 48 | {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_OUT_INIT_HIGH, 4000}, |
| 49 | }; |
| 50 | |
| 51 | static struct msm_camera_gpio_conf gpio_conf_s5k4e1 = { |
| 52 | .camera_off_table = camera_off_gpio_table, |
| 53 | .camera_off_table_size = ARRAY_SIZE(camera_off_gpio_table), |
| 54 | .camera_on_table = camera_on_gpio_table, |
| 55 | .camera_on_table_size = ARRAY_SIZE(camera_on_gpio_table), |
| 56 | .cam_gpio_req_tbl = s5k4e1_cam_req_gpio, |
| 57 | .cam_gpio_req_tbl_size = ARRAY_SIZE(s5k4e1_cam_req_gpio), |
| 58 | .cam_gpio_set_tbl = s5k4e1_cam_gpio_set_tbl, |
| 59 | .cam_gpio_set_tbl_size = ARRAY_SIZE(s5k4e1_cam_gpio_set_tbl), |
| 60 | .gpio_no_mux = 1, |
| 61 | }; |
| 62 | |
| 63 | static struct msm_camera_gpio_conf gpio_conf_mt9e013 = { |
| 64 | .camera_off_table = camera_off_gpio_table, |
| 65 | .camera_on_table = camera_on_gpio_table, |
| 66 | .gpio_no_mux = 1, |
| 67 | }; |
| 68 | |
| 69 | static struct msm_camera_gpio_conf gpio_conf_ov9726 = { |
| 70 | .camera_off_table = camera_off_gpio_table, |
| 71 | .camera_on_table = camera_on_gpio_table, |
| 72 | .gpio_no_mux = 1, |
| 73 | }; |
| 74 | |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 75 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 76 | static struct msm_camera_gpio_conf gpio_conf_ov7692 = { |
| 77 | .camera_off_table = camera_off_gpio_table, |
| 78 | .camera_on_table = camera_on_gpio_table, |
| 79 | .gpio_no_mux = 1, |
| 80 | }; |
| 81 | #endif |
| 82 | |
| 83 | #ifdef CONFIG_OV5647 |
| 84 | static struct msm_camera_gpio_conf gpio_conf_ov5647 = { |
| 85 | .camera_off_table = camera_off_gpio_table, |
| 86 | .camera_on_table = camera_on_gpio_table, |
| 87 | .gpio_no_mux = 1, |
| 88 | }; |
| 89 | #endif |
| 90 | |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 91 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 92 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
| 93 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 94 | ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1, |
| 95 | ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2, |
| 96 | }; |
| 97 | #endif |
| 98 | |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 99 | static struct camera_vreg_t msm_cam_vreg[] = { |
| 100 | {"msme1", REG_LDO, 1800000, 1800000, 0}, |
| 101 | {"gp2", REG_LDO, 2850000, 2850000, 0}, |
| 102 | {"usb2", REG_LDO, 1800000, 1800000, 0}, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 103 | }; |
| 104 | |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 105 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data; |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 106 | |
| 107 | struct msm_camera_device_platform_data msm_camera_device_data_csi1 = { |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 108 | .csid_core = 1, |
| 109 | .is_csic = 1, |
| 110 | }; |
| 111 | |
| 112 | struct msm_camera_device_platform_data msm_camera_device_data_csi0 = { |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 113 | .csid_core = 0, |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 114 | .is_csic = 1, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | #ifdef CONFIG_DW9712_ACT |
| 118 | static struct i2c_board_info s5k4e1_actuator_i2c_info = { |
| 119 | I2C_BOARD_INFO("dw9712_act", 0x8C >> 1), |
| 120 | }; |
| 121 | |
| 122 | static struct msm_actuator_info s5k4e1_actuator_info = { |
| 123 | .board_info = &s5k4e1_actuator_i2c_info, |
| 124 | .bus_id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 125 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 126 | .vcm_enable = 1, |
| 127 | }; |
| 128 | #endif |
| 129 | |
| 130 | #ifdef CONFIG_S5K4E1 |
| 131 | static struct msm_camera_sensor_flash_data flash_s5k4e1 = { |
| 132 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 133 | .flash_src = &msm_flash_src |
| 134 | }; |
| 135 | |
| 136 | static struct msm_camera_sensor_platform_info sensor_board_info_s5k4e1 = { |
| 137 | .mount_angle = 90, |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 138 | .cam_vreg = msm_cam_vreg, |
| 139 | .num_vreg = ARRAY_SIZE(msm_cam_vreg), |
| 140 | .gpio_conf = &gpio_conf_s5k4e1, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 141 | }; |
| 142 | |
| 143 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = { |
| 144 | .sensor_name = "s5k4e1", |
| 145 | .sensor_reset_enable = 1, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 146 | .pmic_gpio_enable = 0, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 147 | .pdata = &msm_camera_device_data_csi1, |
| 148 | .flash_data = &flash_s5k4e1, |
| 149 | .sensor_platform_info = &sensor_board_info_s5k4e1, |
| 150 | .csi_if = 1, |
| 151 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 152 | .sensor_type = BAYER_SENSOR, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 153 | #ifdef CONFIG_DW9712_ACT |
| 154 | .actuator_info = &s5k4e1_actuator_info |
| 155 | #endif |
| 156 | }; |
| 157 | #endif |
| 158 | |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 159 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 160 | static struct msm_camera_sensor_platform_info sensor_board_info_ov7692 = { |
| 161 | .mount_angle = 90, |
| 162 | .cam_vreg = msm_cam_vreg, |
| 163 | .num_vreg = ARRAY_SIZE(msm_cam_vreg), |
| 164 | .gpio_conf = &gpio_conf_ov7692, |
| 165 | }; |
| 166 | |
| 167 | static struct msm_camera_sensor_flash_data flash_ov7692 = { |
| 168 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 169 | }; |
| 170 | |
| 171 | static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = { |
| 172 | .sensor_name = "ov7692", |
| 173 | .sensor_reset_enable = 0, |
| 174 | .pmic_gpio_enable = 1, |
| 175 | .sensor_reset = GPIO_SKU1_CAM_VGA_RESET_N, |
| 176 | .sensor_pwd = GPIO_SKU1_CAM_VGA_SHDN, |
| 177 | .pdata = &msm_camera_device_data_csi0, |
| 178 | .flash_data = &flash_ov7692, |
| 179 | .sensor_platform_info = &sensor_board_info_ov7692, |
| 180 | .csi_if = 1, |
| 181 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 182 | .sensor_type = YUV_SENSOR, |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 183 | }; |
| 184 | #endif |
| 185 | |
| 186 | #ifdef CONFIG_OV5647 |
| 187 | |
| 188 | #ifdef CONFIG_AD5046_ACT |
| 189 | static struct i2c_board_info ad5046_actuator_i2c_info = { |
| 190 | I2C_BOARD_INFO("ad5046_act", 0x18 >> 1), |
| 191 | }; |
| 192 | |
| 193 | static struct msm_actuator_info ad5046_actuator_info = { |
| 194 | .board_info = &ad5046_actuator_i2c_info, |
| 195 | .bus_id = MSM_GSBI0_QUP_I2C_BUS_ID, |
| 196 | .vcm_pwd = GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN, |
| 197 | .vcm_enable = 1, |
| 198 | }; |
| 199 | #endif |
| 200 | |
| 201 | static struct msm_camera_sensor_platform_info sensor_board_info_ov5647 = { |
| 202 | .mount_angle = 90, |
| 203 | .cam_vreg = msm_cam_vreg, |
| 204 | .num_vreg = ARRAY_SIZE(msm_cam_vreg), |
| 205 | .gpio_conf = &gpio_conf_ov5647, |
| 206 | }; |
| 207 | |
| 208 | static struct msm_camera_sensor_flash_src msm_flash_src_ov5647 = { |
| 209 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED, |
| 210 | ._fsrc.led_src.led_name = "flashlight", |
| 211 | ._fsrc.led_src.led_name_len = 10, |
| 212 | }; |
| 213 | |
| 214 | static struct msm_camera_sensor_flash_data flash_ov5647 = { |
| 215 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 216 | .flash_src = &msm_flash_src_ov5647, |
| 217 | }; |
| 218 | |
| 219 | static struct msm_camera_sensor_info msm_camera_sensor_ov5647_data = { |
| 220 | .sensor_name = "ov5647", |
| 221 | .sensor_reset_enable = 1, |
| 222 | .pmic_gpio_enable = 1, |
| 223 | .sensor_reset = GPIO_SKU3_CAM_5MP_CAMIF_RESET, |
| 224 | .sensor_pwd = GPIO_SKU3_CAM_5MP_SHDN_N, |
| 225 | .pdata = &msm_camera_device_data_csi1, |
| 226 | .flash_data = &flash_ov5647, |
| 227 | .sensor_platform_info = &sensor_board_info_ov5647, |
| 228 | .csi_if = 1, |
| 229 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 230 | .sensor_type = BAYER_SENSOR, |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 231 | |
| 232 | #ifdef CONFIG_AD5046_ACT |
| 233 | .actuator_info = &ad5046_actuator_info |
| 234 | #endif |
| 235 | }; |
| 236 | |
| 237 | #endif |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 238 | #ifdef CONFIG_MT9E013 |
| 239 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 240 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 241 | .flash_src = &msm_flash_src |
| 242 | }; |
| 243 | |
| 244 | static struct msm_camera_sensor_platform_info sensor_board_info_mt9e013 = { |
| 245 | .mount_angle = 90, |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 246 | .cam_vreg = msm_cam_vreg, |
| 247 | .num_vreg = ARRAY_SIZE(msm_cam_vreg), |
| 248 | .gpio_conf = &gpio_conf_mt9e013, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 249 | }; |
| 250 | |
| 251 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 252 | .sensor_name = "mt9e013", |
| 253 | .sensor_reset_enable = 1, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 254 | .pmic_gpio_enable = 0, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 255 | .pdata = &msm_camera_device_data_csi1, |
| 256 | .flash_data = &flash_mt9e013, |
| 257 | .sensor_platform_info = &sensor_board_info_mt9e013, |
| 258 | .csi_if = 1, |
| 259 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 260 | .sensor_type = BAYER_SENSOR, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 261 | }; |
| 262 | #endif |
| 263 | |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 264 | #ifdef CONFIG_WEBCAM_OV9726 |
| 265 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 266 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 267 | .flash_src = &msm_flash_src |
| 268 | }; |
| 269 | |
| 270 | static struct msm_camera_sensor_platform_info sensor_board_info_ov9726 = { |
| 271 | .mount_angle = 90, |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 272 | .cam_vreg = msm_cam_vreg, |
| 273 | .num_vreg = ARRAY_SIZE(msm_cam_vreg), |
| 274 | .gpio_conf = &gpio_conf_ov9726, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 275 | }; |
| 276 | |
| 277 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 278 | .sensor_name = "ov9726", |
| 279 | .sensor_reset_enable = 0, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 280 | .pmic_gpio_enable = 0, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 281 | .pdata = &msm_camera_device_data_csi0, |
| 282 | .flash_data = &flash_ov9726, |
| 283 | .sensor_platform_info = &sensor_board_info_ov9726, |
| 284 | .csi_if = 1, |
| 285 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 286 | .sensor_type = BAYER_SENSOR, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 287 | }; |
| 288 | #endif |
| 289 | |
| 290 | static void __init msm7x27a_init_cam(void) |
| 291 | { |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 292 | if (!(machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() |
| 293 | || machine_is_msm7627a_qrd1())) { |
| 294 | sensor_board_info_s5k4e1.cam_vreg = NULL; |
| 295 | sensor_board_info_s5k4e1.num_vreg = 0; |
| 296 | sensor_board_info_mt9e013.cam_vreg = NULL; |
| 297 | sensor_board_info_mt9e013.num_vreg = 0; |
| 298 | sensor_board_info_ov9726.cam_vreg = NULL; |
| 299 | sensor_board_info_ov9726.num_vreg = 0; |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 300 | sensor_board_info_ov7692.cam_vreg = NULL; |
| 301 | sensor_board_info_ov7692.num_vreg = 0; |
| 302 | sensor_board_info_ov5647.cam_vreg = NULL; |
| 303 | sensor_board_info_ov5647.num_vreg = 0; |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 304 | } |
Raju P.L.S.S.S.N | 2b34501 | 2012-03-15 10:18:30 +0530 | [diff] [blame] | 305 | if (machine_is_msm8625_surf() || machine_is_msm8625_evb()) { |
| 306 | platform_device_register(&msm8625_device_csic0); |
| 307 | platform_device_register(&msm8625_device_csic1); |
| 308 | } else { |
| 309 | platform_device_register(&msm7x27a_device_csic0); |
| 310 | platform_device_register(&msm7x27a_device_csic1); |
| 311 | } |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 312 | platform_device_register(&msm7x27a_device_clkctl); |
| 313 | platform_device_register(&msm7x27a_device_vfe); |
| 314 | } |
| 315 | |
| 316 | static struct i2c_board_info i2c_camera_devices[] = { |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 317 | { |
| 318 | I2C_BOARD_INFO("s5k4e1", 0x36), |
| 319 | .platform_data = &msm_camera_sensor_s5k4e1_data, |
| 320 | }, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 321 | { |
| 322 | I2C_BOARD_INFO("ov9726", 0x10), |
| 323 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 324 | }, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 325 | { |
| 326 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 327 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 328 | }, |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 329 | { |
| 330 | I2C_BOARD_INFO("ov7692", 0x78), |
| 331 | .platform_data = &msm_camera_sensor_ov7692_data, |
| 332 | }, |
| 333 | { |
| 334 | I2C_BOARD_INFO("ov5647", 0x36 << 1), |
| 335 | .platform_data = &msm_camera_sensor_ov5647_data, |
| 336 | }, |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 337 | { |
| 338 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 339 | }, |
| 340 | }; |
| 341 | #else |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 342 | static uint32_t camera_off_gpio_table[] = { |
| 343 | GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 344 | }; |
| 345 | |
| 346 | static uint32_t camera_on_gpio_table[] = { |
| 347 | GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), |
| 348 | }; |
| 349 | |
| 350 | #ifdef CONFIG_MSM_CAMERA_FLASH |
| 351 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
| 352 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 353 | ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1, |
| 354 | ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2, |
| 355 | }; |
| 356 | #endif |
| 357 | |
| 358 | static struct regulator_bulk_data regs_camera[] = { |
| 359 | { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 }, |
| 360 | { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 }, |
| 361 | { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 }, |
| 362 | }; |
| 363 | |
| 364 | static void qrd1_camera_gpio_cfg(void) |
| 365 | { |
| 366 | |
| 367 | int rc = 0; |
| 368 | |
| 369 | rc = gpio_request(QRD_GPIO_CAM_5MP_SHDN_EN, "ov5640"); |
| 370 | if (rc < 0) |
| 371 | pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!", |
| 372 | __func__); |
| 373 | |
| 374 | |
| 375 | rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_SHDN_EN, 0, |
| 376 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 377 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 378 | if (rc < 0) { |
| 379 | pr_err("%s: unable to enable Power Down gpio for main" |
| 380 | "camera!\n", __func__); |
| 381 | gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN); |
| 382 | } |
| 383 | |
| 384 | |
| 385 | rc = gpio_request(QRD_GPIO_CAM_5MP_RESET, "ov5640"); |
| 386 | if (rc < 0) { |
| 387 | pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!", |
| 388 | __func__); |
| 389 | gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN); |
| 390 | } |
| 391 | |
| 392 | |
| 393 | rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_RESET, 0, |
| 394 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 395 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 396 | if (rc < 0) { |
| 397 | pr_err("%s: unable to enable reset gpio for main camera!\n", |
| 398 | __func__); |
| 399 | gpio_free(QRD_GPIO_CAM_5MP_RESET); |
| 400 | } |
| 401 | |
| 402 | rc = gpio_request(QRD_GPIO_CAM_3MP_PWDN, "ov7692"); |
| 403 | if (rc < 0) |
| 404 | pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!", |
| 405 | __func__); |
| 406 | |
| 407 | rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_3MP_PWDN, 0, |
| 408 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 409 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 410 | if (rc < 0) { |
| 411 | pr_err("%s: unable to enable Power Down gpio for front" |
| 412 | "camera!\n", __func__); |
| 413 | gpio_free(QRD_GPIO_CAM_3MP_PWDN); |
| 414 | } |
| 415 | |
| 416 | gpio_direction_output(QRD_GPIO_CAM_5MP_SHDN_EN, 1); |
| 417 | gpio_direction_output(QRD_GPIO_CAM_5MP_RESET, 1); |
| 418 | gpio_direction_output(QRD_GPIO_CAM_3MP_PWDN, 1); |
| 419 | } |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 420 | #endif |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 421 | |
| 422 | static void evb_camera_gpio_cfg(void) |
| 423 | { |
| 424 | int rc = 0; |
| 425 | |
| 426 | rc = gpio_request(GPIO_SKU3_CAM_5MP_SHDN_N, "ov5647"); |
| 427 | if (rc < 0) |
| 428 | pr_err("%s: gpio_request GPIO_SKU3_CAM_5MP_SHDN_N failed!", |
| 429 | __func__); |
| 430 | |
| 431 | pr_debug("gpio_tlmm_config %d\r\n", GPIO_SKU3_CAM_5MP_SHDN_N); |
| 432 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU3_CAM_5MP_SHDN_N, 0, |
| 433 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 434 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 435 | if (rc < 0) { |
| 436 | pr_err("%s:unable to enable Powr Dwn gpio for main camera!\n", |
| 437 | __func__); |
| 438 | gpio_free(GPIO_SKU3_CAM_5MP_SHDN_N); |
| 439 | } |
| 440 | |
| 441 | gpio_direction_output(GPIO_SKU3_CAM_5MP_SHDN_N, 1); |
| 442 | |
| 443 | rc = gpio_request(GPIO_SKU3_CAM_5MP_CAMIF_RESET, "ov5647"); |
| 444 | if (rc < 0) |
| 445 | pr_err("%s: gpio_request GPIO_SKU3_CAM_5MP_CAMIF_RESET failed!", |
| 446 | __func__); |
| 447 | |
| 448 | pr_debug("gpio_tlmm_config %d\r\n", GPIO_SKU3_CAM_5MP_CAMIF_RESET); |
| 449 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU3_CAM_5MP_CAMIF_RESET, 0, |
| 450 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 451 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 452 | if (rc < 0) { |
| 453 | pr_err("%s: unable to enable reset gpio for main camera!\n", |
| 454 | __func__); |
| 455 | gpio_free(GPIO_SKU3_CAM_5MP_CAMIF_RESET); |
| 456 | } |
| 457 | |
| 458 | gpio_direction_output(GPIO_SKU3_CAM_5MP_CAMIF_RESET, 1); |
| 459 | |
| 460 | rc = gpio_request(GPIO_SKU1_CAM_VGA_SHDN, "ov7692"); |
| 461 | if (rc < 0) |
| 462 | pr_err("%s: gpio_request---GPIO_SKU1_CAM_VGA_SHDN failed!", |
| 463 | __func__); |
| 464 | |
| 465 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU1_CAM_VGA_SHDN, 0, |
| 466 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 467 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 468 | if (rc < 0) { |
| 469 | pr_err("%s:unable to enable Powr Dwn gpio for frnt camera!\n", |
| 470 | __func__); |
| 471 | gpio_free(GPIO_SKU1_CAM_VGA_SHDN); |
| 472 | } |
| 473 | |
| 474 | gpio_direction_output(GPIO_SKU1_CAM_VGA_SHDN, 1); |
| 475 | |
| 476 | rc = gpio_request(GPIO_SKU1_CAM_VGA_RESET_N, "ov7692"); |
| 477 | if (rc < 0) |
| 478 | pr_err("%s: gpio_request---GPIO_SKU1_CAM_VGA_RESET_N failed!", |
| 479 | __func__); |
| 480 | |
| 481 | rc = gpio_tlmm_config(GPIO_CFG(GPIO_SKU1_CAM_VGA_RESET_N, 0, |
| 482 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, |
| 483 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 484 | |
| 485 | if (rc < 0) { |
| 486 | pr_err("%s: unable to enable reset gpio for front camera!\n", |
| 487 | __func__); |
| 488 | gpio_free(GPIO_SKU1_CAM_VGA_RESET_N); |
| 489 | } |
| 490 | gpio_direction_output(GPIO_SKU1_CAM_VGA_RESET_N, 1); |
| 491 | |
| 492 | } |
| 493 | |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 494 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
| 495 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 496 | static void msm_camera_vreg_config(int vreg_en) |
| 497 | { |
| 498 | int rc = vreg_en ? |
| 499 | regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) : |
| 500 | regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera); |
| 501 | |
| 502 | if (rc) |
| 503 | pr_err("%s: could not %sable regulators: %d\n", |
| 504 | __func__, vreg_en ? "en" : "dis", rc); |
| 505 | } |
| 506 | |
| 507 | static int config_gpio_table(uint32_t *table, int len) |
| 508 | { |
| 509 | int rc = 0, i = 0; |
| 510 | |
| 511 | for (i = 0; i < len; i++) { |
| 512 | rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE); |
| 513 | if (rc) { |
| 514 | pr_err("%s not able to get gpio\n", __func__); |
| 515 | for (i--; i >= 0; i--) |
| 516 | gpio_tlmm_config(camera_off_gpio_table[i], |
| 517 | GPIO_CFG_ENABLE); |
| 518 | break; |
| 519 | } |
| 520 | } |
| 521 | return rc; |
| 522 | } |
| 523 | |
| 524 | static int config_camera_on_gpios_rear(void) |
| 525 | { |
| 526 | int rc = 0; |
| 527 | |
| 528 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() |
| 529 | || machine_is_msm7627a_qrd1()) |
| 530 | msm_camera_vreg_config(1); |
| 531 | |
| 532 | rc = config_gpio_table(camera_on_gpio_table, |
| 533 | ARRAY_SIZE(camera_on_gpio_table)); |
| 534 | if (rc < 0) { |
| 535 | pr_err("%s: CAMSENSOR gpio table request" |
| 536 | "failed\n", __func__); |
| 537 | return rc; |
| 538 | } |
| 539 | |
| 540 | return rc; |
| 541 | } |
| 542 | |
| 543 | static void config_camera_off_gpios_rear(void) |
| 544 | { |
| 545 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() |
| 546 | || machine_is_msm7627a_qrd1()) |
| 547 | msm_camera_vreg_config(0); |
| 548 | |
| 549 | config_gpio_table(camera_off_gpio_table, |
| 550 | ARRAY_SIZE(camera_off_gpio_table)); |
| 551 | } |
| 552 | |
| 553 | static int config_camera_on_gpios_front(void) |
| 554 | { |
| 555 | int rc = 0; |
| 556 | |
| 557 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() |
| 558 | || machine_is_msm7627a_qrd1()) |
| 559 | msm_camera_vreg_config(1); |
| 560 | |
| 561 | rc = config_gpio_table(camera_on_gpio_table, |
| 562 | ARRAY_SIZE(camera_on_gpio_table)); |
| 563 | if (rc < 0) { |
| 564 | pr_err("%s: CAMSENSOR gpio table request" |
| 565 | "failed\n", __func__); |
| 566 | return rc; |
| 567 | } |
| 568 | |
| 569 | return rc; |
| 570 | } |
| 571 | |
| 572 | static void config_camera_off_gpios_front(void) |
| 573 | { |
| 574 | if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() |
| 575 | || machine_is_msm7627a_qrd1()) |
| 576 | msm_camera_vreg_config(0); |
| 577 | |
| 578 | config_gpio_table(camera_off_gpio_table, |
| 579 | ARRAY_SIZE(camera_off_gpio_table)); |
| 580 | } |
| 581 | |
| 582 | struct msm_camera_device_platform_data msm_camera_device_data_rear = { |
| 583 | .camera_gpio_on = config_camera_on_gpios_rear, |
| 584 | .camera_gpio_off = config_camera_off_gpios_rear, |
| 585 | .ioext.csiphy = 0xA1000000, |
| 586 | .ioext.csisz = 0x00100000, |
| 587 | .ioext.csiirq = INT_CSI_IRQ_1, |
| 588 | .ioclk.mclk_clk_rate = 24000000, |
| 589 | .ioclk.vfe_clk_rate = 192000000, |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 590 | .ioext.appphy = MSM7XXX_CLK_CTL_PHYS, |
| 591 | .ioext.appsz = MSM7XXX_CLK_CTL_SIZE, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 592 | }; |
| 593 | |
| 594 | struct msm_camera_device_platform_data msm_camera_device_data_front = { |
| 595 | .camera_gpio_on = config_camera_on_gpios_front, |
| 596 | .camera_gpio_off = config_camera_off_gpios_front, |
| 597 | .ioext.csiphy = 0xA0F00000, |
| 598 | .ioext.csisz = 0x00100000, |
| 599 | .ioext.csiirq = INT_CSI_IRQ_0, |
| 600 | .ioclk.mclk_clk_rate = 24000000, |
| 601 | .ioclk.vfe_clk_rate = 192000000, |
Taniya Das | 13b811a | 2011-12-09 18:33:45 +0530 | [diff] [blame] | 602 | .ioext.appphy = MSM7XXX_CLK_CTL_PHYS, |
| 603 | .ioext.appsz = MSM7XXX_CLK_CTL_SIZE, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 604 | }; |
| 605 | |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 606 | #ifdef CONFIG_OV5647 |
| 607 | |
| 608 | static struct msm_camera_sensor_platform_info ov5647_sensor_7627a_info = { |
| 609 | .mount_angle = 90 |
| 610 | }; |
| 611 | |
| 612 | static struct msm_camera_sensor_flash_src msm_flash_src_ov5647 = { |
| 613 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED, |
| 614 | ._fsrc.led_src.led_name = "flashlight", |
| 615 | ._fsrc.led_src.led_name_len = 10, |
| 616 | }; |
| 617 | |
| 618 | static struct msm_camera_sensor_flash_data flash_ov5647 = { |
| 619 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 620 | .flash_src = &msm_flash_src_ov5647, |
| 621 | }; |
| 622 | |
| 623 | static struct msm_camera_sensor_info msm_camera_sensor_ov5647_data = { |
| 624 | .sensor_name = "ov5647", |
| 625 | .sensor_reset_enable = 1, |
| 626 | .sensor_reset = GPIO_SKU3_CAM_5MP_CAMIF_RESET, |
| 627 | .pmic_gpio_enable = 1, |
| 628 | .sensor_pwd = GPIO_SKU3_CAM_5MP_SHDN_N, |
| 629 | .vcm_pwd = GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN, |
Lokesh Kumar Aakulu | fe9c3ec | 2012-02-22 19:26:29 +0530 | [diff] [blame] | 630 | .vcm_enable = 1, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 631 | .pdata = &msm_camera_device_data_rear, |
| 632 | .flash_data = &flash_ov5647, |
| 633 | .sensor_platform_info = &ov5647_sensor_7627a_info, |
| 634 | .csi_if = 1 |
| 635 | }; |
| 636 | |
| 637 | static struct platform_device msm_camera_sensor_ov5647 = { |
| 638 | .name = "msm_camera_ov5647", |
| 639 | .dev = { |
| 640 | .platform_data = &msm_camera_sensor_ov5647_data, |
| 641 | }, |
| 642 | }; |
| 643 | #endif |
| 644 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 645 | #ifdef CONFIG_S5K4E1 |
| 646 | static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = { |
| 647 | .mount_angle = 90 |
| 648 | }; |
| 649 | |
| 650 | static struct msm_camera_sensor_flash_data flash_s5k4e1 = { |
| 651 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 652 | .flash_src = &msm_flash_src |
| 653 | }; |
| 654 | |
| 655 | static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = { |
| 656 | .sensor_name = "s5k4e1", |
| 657 | .sensor_reset_enable = 1, |
| 658 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 659 | .pmic_gpio_enable = 0, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 660 | .sensor_pwd = 85, |
| 661 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 662 | .vcm_enable = 1, |
| 663 | .pdata = &msm_camera_device_data_rear, |
| 664 | .flash_data = &flash_s5k4e1, |
| 665 | .sensor_platform_info = &s5k4e1_sensor_7627a_info, |
| 666 | .csi_if = 1 |
| 667 | }; |
| 668 | |
| 669 | static struct platform_device msm_camera_sensor_s5k4e1 = { |
| 670 | .name = "msm_camera_s5k4e1", |
| 671 | .dev = { |
| 672 | .platform_data = &msm_camera_sensor_s5k4e1_data, |
| 673 | }, |
| 674 | }; |
| 675 | #endif |
| 676 | |
| 677 | #ifdef CONFIG_IMX072 |
| 678 | static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = { |
| 679 | .mount_angle = 90 |
| 680 | }; |
| 681 | |
| 682 | static struct msm_camera_sensor_flash_data flash_imx072 = { |
| 683 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 684 | .flash_src = &msm_flash_src |
| 685 | }; |
| 686 | |
| 687 | static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = { |
| 688 | .sensor_name = "imx072", |
| 689 | .sensor_reset_enable = 1, |
| 690 | .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/ |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 691 | .pmic_gpio_enable = 0, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 692 | .sensor_pwd = 85, |
| 693 | .vcm_pwd = GPIO_CAM_GP_CAM_PWDN, |
| 694 | .vcm_enable = 1, |
| 695 | .pdata = &msm_camera_device_data_rear, |
| 696 | .flash_data = &flash_imx072, |
| 697 | .sensor_platform_info = &imx072_sensor_7627a_info, |
| 698 | .csi_if = 1 |
| 699 | }; |
| 700 | |
| 701 | static struct platform_device msm_camera_sensor_imx072 = { |
| 702 | .name = "msm_camera_imx072", |
| 703 | .dev = { |
| 704 | .platform_data = &msm_camera_sensor_imx072_data, |
| 705 | }, |
| 706 | }; |
| 707 | #endif |
| 708 | |
| 709 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data; |
| 710 | #ifdef CONFIG_WEBCAM_OV9726 |
| 711 | static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = { |
| 712 | .mount_angle = 90 |
| 713 | }; |
| 714 | |
| 715 | static struct msm_camera_sensor_flash_data flash_ov9726 = { |
| 716 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 717 | .flash_src = &msm_flash_src |
| 718 | }; |
| 719 | |
| 720 | static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = { |
| 721 | .sensor_name = "ov9726", |
| 722 | .sensor_reset_enable = 0, |
| 723 | .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 724 | .pmic_gpio_enable = 0, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 725 | .sensor_pwd = 85, |
| 726 | .vcm_pwd = 1, |
| 727 | .vcm_enable = 0, |
| 728 | .pdata = &msm_camera_device_data_front, |
| 729 | .flash_data = &flash_ov9726, |
| 730 | .sensor_platform_info = &ov9726_sensor_7627a_info, |
| 731 | .csi_if = 1 |
| 732 | }; |
| 733 | |
| 734 | static struct platform_device msm_camera_sensor_ov9726 = { |
| 735 | .name = "msm_camera_ov9726", |
| 736 | .dev = { |
| 737 | .platform_data = &msm_camera_sensor_ov9726_data, |
| 738 | }, |
| 739 | }; |
| 740 | #else |
| 741 | static inline void msm_camera_vreg_init(void) { } |
| 742 | #endif |
| 743 | |
| 744 | #ifdef CONFIG_MT9E013 |
| 745 | static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = { |
| 746 | .mount_angle = 90 |
| 747 | }; |
| 748 | |
| 749 | static struct msm_camera_sensor_flash_data flash_mt9e013 = { |
| 750 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 751 | .flash_src = &msm_flash_src |
| 752 | }; |
| 753 | |
| 754 | static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = { |
| 755 | .sensor_name = "mt9e013", |
| 756 | .sensor_reset = 0, |
| 757 | .sensor_reset_enable = 1, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 758 | .pmic_gpio_enable = 0, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 759 | .sensor_pwd = 85, |
| 760 | .vcm_pwd = 1, |
| 761 | .vcm_enable = 0, |
| 762 | .pdata = &msm_camera_device_data_rear, |
| 763 | .flash_data = &flash_mt9e013, |
| 764 | .sensor_platform_info = &mt9e013_sensor_7627a_info, |
| 765 | .csi_if = 1 |
| 766 | }; |
| 767 | |
| 768 | static struct platform_device msm_camera_sensor_mt9e013 = { |
| 769 | .name = "msm_camera_mt9e013", |
| 770 | .dev = { |
| 771 | .platform_data = &msm_camera_sensor_mt9e013_data, |
| 772 | }, |
| 773 | }; |
| 774 | #endif |
| 775 | |
| 776 | #ifdef CONFIG_OV5640 |
| 777 | static struct msm_camera_sensor_platform_info ov5640_sensor_info = { |
| 778 | .mount_angle = 90 |
| 779 | }; |
| 780 | |
| 781 | static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = { |
| 782 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED, |
| 783 | ._fsrc.led_src.led_name = "flashlight", |
| 784 | ._fsrc.led_src.led_name_len = 10, |
| 785 | }; |
| 786 | |
| 787 | static struct msm_camera_sensor_flash_data flash_ov5640 = { |
| 788 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 789 | .flash_src = &msm_flash_src_ov5640, |
| 790 | }; |
| 791 | |
| 792 | static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = { |
| 793 | .sensor_name = "ov5640", |
| 794 | .sensor_reset_enable = 1, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 795 | .pmic_gpio_enable = 0, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 796 | .sensor_reset = QRD_GPIO_CAM_5MP_RESET, |
| 797 | .sensor_pwd = QRD_GPIO_CAM_5MP_SHDN_EN, |
| 798 | .vcm_pwd = 0, |
| 799 | .vcm_enable = 0, |
| 800 | .pdata = &msm_camera_device_data_rear, |
| 801 | .flash_data = &flash_ov5640, |
| 802 | .sensor_platform_info = &ov5640_sensor_info, |
| 803 | .csi_if = 1, |
| 804 | }; |
| 805 | |
| 806 | static struct platform_device msm_camera_sensor_ov5640 = { |
| 807 | .name = "msm_camera_ov5640", |
| 808 | .dev = { |
| 809 | .platform_data = &msm_camera_sensor_ov5640_data, |
| 810 | }, |
| 811 | }; |
| 812 | #endif |
| 813 | |
| 814 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 815 | static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = { |
| 816 | .mount_angle = 90 |
| 817 | }; |
| 818 | |
| 819 | static struct msm_camera_sensor_flash_data flash_ov7692 = { |
| 820 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 821 | }; |
| 822 | |
| 823 | static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = { |
| 824 | .sensor_name = "ov7692", |
| 825 | .sensor_reset_enable = 0, |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 826 | .pmic_gpio_enable = 1, |
| 827 | .sensor_reset = GPIO_SKU1_CAM_VGA_RESET_N, |
| 828 | .sensor_pwd = GPIO_SKU1_CAM_VGA_SHDN, |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 829 | .vcm_pwd = 0, |
| 830 | .vcm_enable = 0, |
| 831 | .pdata = &msm_camera_device_data_front, |
| 832 | .flash_data = &flash_ov7692, |
| 833 | .sensor_platform_info = &ov7692_sensor_7627a_info, |
| 834 | .csi_if = 1, |
| 835 | }; |
| 836 | |
| 837 | static struct platform_device msm_camera_sensor_ov7692 = { |
| 838 | .name = "msm_camera_ov7692", |
| 839 | .dev = { |
| 840 | .platform_data = &msm_camera_sensor_ov7692_data, |
| 841 | }, |
| 842 | }; |
| 843 | #endif |
| 844 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 845 | static struct i2c_board_info i2c_camera_devices[] = { |
| 846 | #ifdef CONFIG_S5K4E1 |
| 847 | { |
| 848 | I2C_BOARD_INFO("s5k4e1", 0x36), |
| 849 | }, |
| 850 | { |
| 851 | I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1), |
| 852 | }, |
| 853 | #endif |
| 854 | #ifdef CONFIG_WEBCAM_OV9726 |
| 855 | { |
| 856 | I2C_BOARD_INFO("ov9726", 0x10), |
| 857 | }, |
| 858 | #endif |
| 859 | #ifdef CONFIG_IMX072 |
| 860 | { |
| 861 | I2C_BOARD_INFO("imx072", 0x34), |
| 862 | }, |
| 863 | #endif |
| 864 | #ifdef CONFIG_MT9E013 |
| 865 | { |
| 866 | I2C_BOARD_INFO("mt9e013", 0x6C >> 2), |
| 867 | }, |
| 868 | #endif |
| 869 | { |
| 870 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 871 | }, |
| 872 | }; |
| 873 | |
| 874 | static struct i2c_board_info i2c_camera_devices_qrd[] = { |
| 875 | #ifdef CONFIG_OV5640 |
| 876 | { |
| 877 | I2C_BOARD_INFO("ov5640", 0x78 >> 1), |
| 878 | }, |
| 879 | #endif |
| 880 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 881 | { |
| 882 | I2C_BOARD_INFO("ov7692", 0x78), |
| 883 | }, |
| 884 | #endif |
| 885 | }; |
| 886 | |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 887 | static struct i2c_board_info i2c_camera_devices_evb[] = { |
| 888 | #ifdef CONFIG_OV5647 |
| 889 | { |
| 890 | I2C_BOARD_INFO("ov5647", 0x36 << 1), |
| 891 | }, |
| 892 | { |
| 893 | I2C_BOARD_INFO("ov5647_af", 0x18 >> 1), |
| 894 | }, |
| 895 | #endif |
| 896 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 897 | { |
| 898 | I2C_BOARD_INFO("ov7692", 0x78), |
| 899 | }, |
| 900 | #endif |
| 901 | }; |
| 902 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 903 | static struct platform_device *camera_devices_msm[] __initdata = { |
| 904 | #ifdef CONFIG_S5K4E1 |
| 905 | &msm_camera_sensor_s5k4e1, |
| 906 | #endif |
| 907 | #ifdef CONFIG_IMX072 |
| 908 | &msm_camera_sensor_imx072, |
| 909 | #endif |
| 910 | #ifdef CONFIG_WEBCAM_OV9726 |
| 911 | &msm_camera_sensor_ov9726, |
| 912 | #endif |
| 913 | #ifdef CONFIG_MT9E013 |
| 914 | &msm_camera_sensor_mt9e013, |
| 915 | #endif |
| 916 | }; |
| 917 | |
| 918 | static struct platform_device *camera_devices_qrd[] __initdata = { |
| 919 | #ifdef CONFIG_OV5640 |
| 920 | &msm_camera_sensor_ov5640, |
| 921 | #endif |
| 922 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 923 | &msm_camera_sensor_ov7692, |
| 924 | #endif |
| 925 | }; |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 926 | |
| 927 | static struct platform_device *camera_devices_evb[] __initdata = { |
| 928 | #ifdef CONFIG_OV5647 |
| 929 | &msm_camera_sensor_ov5647, |
| 930 | #endif |
| 931 | #ifdef CONFIG_WEBCAM_OV7692_QRD |
| 932 | &msm_camera_sensor_ov7692, |
| 933 | #endif |
| 934 | }; |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 935 | #endif |
| 936 | |
| 937 | enum { |
| 938 | SX150X_CAM, |
| 939 | }; |
| 940 | |
| 941 | static struct sx150x_platform_data sx150x_data[] __initdata = { |
| 942 | [SX150X_CAM] = { |
| 943 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 944 | .oscio_is_gpo = false, |
| 945 | .io_pullup_ena = 0, |
| 946 | .io_pulldn_ena = 0, |
| 947 | .io_open_drain_ena = 0x23, |
| 948 | .irq_summary = -1, |
| 949 | }, |
| 950 | }; |
| 951 | |
| 952 | static struct i2c_board_info cam_exp_i2c_info[] __initdata = { |
| 953 | { |
| 954 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 955 | .platform_data = &sx150x_data[SX150X_CAM], |
| 956 | }, |
| 957 | }; |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 958 | |
| 959 | static void __init register_i2c_devices(void) |
| 960 | { |
| 961 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 962 | cam_exp_i2c_info, |
| 963 | ARRAY_SIZE(cam_exp_i2c_info)); |
| 964 | } |
| 965 | |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 966 | #define LCD_CAMERA_LDO_2V8 35 /* SKU1&SKU3 2.8V LDO */ |
| 967 | #define SKU3_LCD_CAMERA_LDO_1V8 40 /* SKU3 1.8V LDO */ |
| 968 | |
| 969 | static int lcd_camera_ldo_1v8 = SKU3_LCD_CAMERA_LDO_1V8; |
| 970 | |
| 971 | static void lcd_camera_power_init(void) |
| 972 | { |
| 973 | int rc = 0; |
| 974 | |
| 975 | pr_debug("lcd_camera_power_init\n"); |
| 976 | |
| 977 | lcd_camera_ldo_1v8 = SKU3_LCD_CAMERA_LDO_1V8; /* SKU3 PVT */ |
| 978 | |
| 979 | /* LDO_EXT2V8 */ |
| 980 | if (gpio_request(LCD_CAMERA_LDO_2V8, "lcd_camera_ldo_2v8")) { |
| 981 | pr_err("failed to request gpio lcd_camera_ldo_2v8\n"); |
| 982 | return; |
| 983 | } |
| 984 | |
| 985 | rc = gpio_tlmm_config(GPIO_CFG(LCD_CAMERA_LDO_2V8, 0, |
| 986 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 987 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 988 | if (rc < 0) { |
| 989 | pr_err("%s: unable to enable lcd_camera_ldo_2v8!\n", __func__); |
| 990 | goto fail_gpio2; |
| 991 | } |
| 992 | |
| 993 | /* LDO_EVT1V8 */ |
| 994 | if (gpio_request(lcd_camera_ldo_1v8, "lcd_camera_ldo_1v8")) { |
| 995 | pr_err("failed to request gpio lcd_camera_ldo_1v8\n"); |
| 996 | goto fail_gpio2; |
| 997 | } |
| 998 | |
| 999 | rc = gpio_tlmm_config(GPIO_CFG(lcd_camera_ldo_1v8, 0, |
| 1000 | GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, |
| 1001 | GPIO_CFG_2MA), GPIO_CFG_ENABLE); |
| 1002 | if (rc < 0) { |
| 1003 | pr_err("%s: unable to enable lcd_camera_ldo_1v8!\n", __func__); |
| 1004 | goto fail_gpio1; |
| 1005 | } |
| 1006 | |
| 1007 | return; |
| 1008 | |
| 1009 | fail_gpio1: |
| 1010 | gpio_free(lcd_camera_ldo_1v8); |
| 1011 | fail_gpio2: |
| 1012 | gpio_free(LCD_CAMERA_LDO_2V8); |
| 1013 | |
| 1014 | return; |
| 1015 | } |
| 1016 | |
| 1017 | static int lcd_camera_power_on_sku3(void) |
| 1018 | { |
| 1019 | int rc = 0; |
| 1020 | |
| 1021 | pr_debug("turn on sku3 lcd_camera_ldo_1v8\n"); |
| 1022 | gpio_set_value_cansleep(lcd_camera_ldo_1v8, 1); |
| 1023 | |
| 1024 | pr_debug("turn on sku3 lcd_camera_ldo\n"); |
| 1025 | gpio_set_value_cansleep(LCD_CAMERA_LDO_2V8, 1); |
| 1026 | |
| 1027 | return rc; |
| 1028 | } |
| 1029 | |
| 1030 | static int lcd_camera_power_off_sku3(void) |
| 1031 | { |
| 1032 | int rc = 0; |
| 1033 | |
| 1034 | pr_debug("turn off sku3 lcd_camera_ldo_1v8\n"); |
| 1035 | gpio_set_value_cansleep(lcd_camera_ldo_1v8, 0); |
| 1036 | |
| 1037 | pr_debug("turn off sku3 lcd_camera_ldo\n"); |
| 1038 | gpio_set_value_cansleep(LCD_CAMERA_LDO_2V8, 0); |
| 1039 | |
| 1040 | gpio_free(lcd_camera_ldo_1v8); |
| 1041 | gpio_free(LCD_CAMERA_LDO_2V8); |
| 1042 | |
| 1043 | return rc; |
| 1044 | } |
| 1045 | |
| 1046 | int lcd_camera_power_onoff(int on) |
| 1047 | { |
| 1048 | int rc = 0; |
| 1049 | |
| 1050 | pr_debug("lcd_camera_power_onoff on = %d,\n", on); |
| 1051 | |
| 1052 | if (on) |
| 1053 | rc = lcd_camera_power_on_sku3(); |
| 1054 | else |
| 1055 | rc = lcd_camera_power_off_sku3(); |
| 1056 | |
| 1057 | return rc; |
| 1058 | } |
| 1059 | EXPORT_SYMBOL(lcd_camera_power_onoff); |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1060 | |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1061 | void __init msm7627a_camera_init(void) |
| 1062 | { |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 1063 | |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 1064 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1065 | int rc; |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 1066 | #endif |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1067 | |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1068 | pr_debug("msm7627a_camera_init Entered\n"); |
| 1069 | /* LCD and camera power (VREG & LDO) init */ |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 1070 | if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) { |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1071 | lcd_camera_power_init(); |
Raju P.L.S.S.S.N | cea3151 | 2012-03-20 11:57:50 +0530 | [diff] [blame] | 1072 | evb_camera_gpio_cfg(); |
Raju P.L.S.S.S.N | cc40097 | 2012-03-13 10:09:59 +0530 | [diff] [blame] | 1073 | } |
| 1074 | |
| 1075 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1076 | if (machine_is_msm7627a_qrd1()) { |
| 1077 | qrd1_camera_gpio_cfg(); |
| 1078 | platform_add_devices(camera_devices_qrd, |
| 1079 | ARRAY_SIZE(camera_devices_qrd)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1080 | } else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) { |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1081 | platform_add_devices(camera_devices_evb, |
| 1082 | ARRAY_SIZE(camera_devices_evb)); |
| 1083 | } else if (machine_is_msm7627a_qrd3()) |
Chintan Pandya | b1bad0e | 2012-02-06 19:04:51 +0530 | [diff] [blame] | 1084 | return; |
Taniya Das | c868a2e | 2012-01-03 10:18:47 +0530 | [diff] [blame] | 1085 | else |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1086 | platform_add_devices(camera_devices_msm, |
| 1087 | ARRAY_SIZE(camera_devices_msm)); |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 1088 | #endif |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1089 | if (!machine_is_msm7627a_qrd1() || !machine_is_msm7627a_evb() |
| 1090 | || !machine_is_msm8625_evb()) |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1091 | register_i2c_devices(); |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 1092 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1093 | rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera); |
| 1094 | |
| 1095 | if (rc) { |
| 1096 | pr_err("%s: could not get regulators: %d\n", __func__, rc); |
| 1097 | return; |
| 1098 | } |
| 1099 | |
| 1100 | rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera); |
| 1101 | |
| 1102 | if (rc) { |
| 1103 | pr_err("%s: could not set voltages: %d\n", __func__, rc); |
| 1104 | return; |
| 1105 | } |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 1106 | #endif |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1107 | |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 1108 | #if defined(CONFIG_MSM_CAMERA_V4L2) |
| 1109 | msm7x27a_init_cam(); |
| 1110 | #endif |
| 1111 | #ifndef CONFIG_MSM_CAMERA_V4L2 |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1112 | if (machine_is_msm7627a_qrd1()) { |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1113 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1114 | i2c_camera_devices_qrd, |
| 1115 | ARRAY_SIZE(i2c_camera_devices_qrd)); |
Chintan Pandya | f4ad400 | 2012-02-28 19:49:03 +0530 | [diff] [blame] | 1116 | } else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()) { |
Su Liu | aca0470 | 2012-02-14 02:27:32 +0530 | [diff] [blame] | 1117 | pr_debug("machine_is_msm7627a_evb i2c_register_board_info\n"); |
| 1118 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1119 | i2c_camera_devices_evb, |
| 1120 | ARRAY_SIZE(i2c_camera_devices_evb)); |
| 1121 | } else |
Suresh Vankadara | 87e195b | 2012-01-18 00:42:58 +0530 | [diff] [blame] | 1122 | #endif |
Sandeep Kodimela | c6f7867 | 2012-03-07 10:44:04 +0530 | [diff] [blame] | 1123 | pr_debug("i2c_register_board_info\n"); |
Chintan Pandya | 4076270 | 2011-12-06 13:47:06 +0530 | [diff] [blame] | 1124 | i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID, |
| 1125 | i2c_camera_devices, |
| 1126 | ARRAY_SIZE(i2c_camera_devices)); |
| 1127 | } |