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