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