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