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