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