Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [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 | |
| 14 | #include <asm/mach-types.h> |
| 15 | #include <linux/i2c.h> |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 17 | #include <mach/board.h> |
| 18 | #include <mach/msm_bus_board.h> |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 19 | #include <mach/gpiomux.h> |
| 20 | |
| 21 | #include "devices.h" |
| 22 | #include "board-8064.h" |
| 23 | |
| 24 | static struct gpiomux_setting cam_settings[] = { |
| 25 | { |
| 26 | .func = GPIOMUX_FUNC_GPIO, /*suspend*/ |
| 27 | .drv = GPIOMUX_DRV_2MA, |
| 28 | .pull = GPIOMUX_PULL_DOWN, |
| 29 | }, |
| 30 | |
| 31 | { |
| 32 | .func = GPIOMUX_FUNC_1, /*active 1*/ |
| 33 | .drv = GPIOMUX_DRV_2MA, |
| 34 | .pull = GPIOMUX_PULL_NONE, |
| 35 | }, |
| 36 | |
| 37 | { |
| 38 | .func = GPIOMUX_FUNC_GPIO, /*active 2*/ |
| 39 | .drv = GPIOMUX_DRV_2MA, |
| 40 | .pull = GPIOMUX_PULL_NONE, |
| 41 | }, |
| 42 | |
| 43 | { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 44 | .func = GPIOMUX_FUNC_2, /*active 3*/ |
| 45 | .drv = GPIOMUX_DRV_2MA, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 46 | .pull = GPIOMUX_PULL_NONE, |
| 47 | }, |
| 48 | |
| 49 | { |
| 50 | .func = GPIOMUX_FUNC_5, /*active 4*/ |
| 51 | .drv = GPIOMUX_DRV_8MA, |
| 52 | .pull = GPIOMUX_PULL_UP, |
| 53 | }, |
| 54 | |
| 55 | { |
| 56 | .func = GPIOMUX_FUNC_6, /*active 5*/ |
| 57 | .drv = GPIOMUX_DRV_8MA, |
| 58 | .pull = GPIOMUX_PULL_UP, |
| 59 | }, |
| 60 | |
| 61 | { |
| 62 | .func = GPIOMUX_FUNC_2, /*active 6*/ |
| 63 | .drv = GPIOMUX_DRV_2MA, |
| 64 | .pull = GPIOMUX_PULL_UP, |
| 65 | }, |
| 66 | |
| 67 | { |
| 68 | .func = GPIOMUX_FUNC_3, /*active 7*/ |
| 69 | .drv = GPIOMUX_DRV_8MA, |
| 70 | .pull = GPIOMUX_PULL_UP, |
| 71 | }, |
| 72 | |
| 73 | { |
| 74 | .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/ |
| 75 | .drv = GPIOMUX_DRV_2MA, |
| 76 | .pull = GPIOMUX_PULL_KEEPER, |
| 77 | }, |
| 78 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 79 | { |
| 80 | .func = GPIOMUX_FUNC_9, /*active 9*/ |
| 81 | .drv = GPIOMUX_DRV_8MA, |
| 82 | .pull = GPIOMUX_PULL_NONE, |
| 83 | }, |
| 84 | { |
| 85 | .func = GPIOMUX_FUNC_A, /*active 10*/ |
| 86 | .drv = GPIOMUX_DRV_8MA, |
| 87 | .pull = GPIOMUX_PULL_NONE, |
| 88 | }, |
| 89 | { |
| 90 | .func = GPIOMUX_FUNC_6, /*active 11*/ |
| 91 | .drv = GPIOMUX_DRV_8MA, |
| 92 | .pull = GPIOMUX_PULL_NONE, |
| 93 | }, |
| 94 | { |
| 95 | .func = GPIOMUX_FUNC_4, /*active 12*/ |
| 96 | .drv = GPIOMUX_DRV_2MA, |
| 97 | .pull = GPIOMUX_PULL_NONE, |
| 98 | }, |
| 99 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | |
| 103 | static struct msm_gpiomux_config apq8064_cam_common_configs[] = { |
| 104 | { |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 105 | .gpio = 1, |
| 106 | .settings = { |
| 107 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 108 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 109 | }, |
| 110 | }, |
| 111 | { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 112 | .gpio = 2, |
| 113 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 114 | [GPIOMUX_ACTIVE] = &cam_settings[12], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 115 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 116 | }, |
| 117 | }, |
| 118 | { |
| 119 | .gpio = 3, |
| 120 | .settings = { |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 121 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 122 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 123 | }, |
| 124 | }, |
| 125 | { |
| 126 | .gpio = 4, |
| 127 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 128 | [GPIOMUX_ACTIVE] = &cam_settings[3], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 129 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 130 | }, |
| 131 | }, |
| 132 | { |
| 133 | .gpio = 5, |
| 134 | .settings = { |
| 135 | [GPIOMUX_ACTIVE] = &cam_settings[1], |
| 136 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 137 | }, |
| 138 | }, |
| 139 | { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 140 | .gpio = 34, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 141 | .settings = { |
| 142 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 143 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 144 | }, |
| 145 | }, |
| 146 | { |
| 147 | .gpio = 107, |
| 148 | .settings = { |
| 149 | [GPIOMUX_ACTIVE] = &cam_settings[2], |
| 150 | [GPIOMUX_SUSPENDED] = &cam_settings[0], |
| 151 | }, |
| 152 | }, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 153 | { |
| 154 | .gpio = 10, |
| 155 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 156 | [GPIOMUX_ACTIVE] = &cam_settings[9], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 157 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
| 158 | }, |
| 159 | }, |
| 160 | { |
| 161 | .gpio = 11, |
| 162 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 163 | [GPIOMUX_ACTIVE] = &cam_settings[10], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 164 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
| 165 | }, |
| 166 | }, |
| 167 | { |
| 168 | .gpio = 12, |
| 169 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 170 | [GPIOMUX_ACTIVE] = &cam_settings[11], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 171 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
| 172 | }, |
| 173 | }, |
| 174 | { |
| 175 | .gpio = 13, |
| 176 | .settings = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 177 | [GPIOMUX_ACTIVE] = &cam_settings[11], |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 178 | [GPIOMUX_SUSPENDED] = &cam_settings[8], |
| 179 | }, |
| 180 | }, |
| 181 | }; |
| 182 | |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 183 | |
| 184 | #define VFE_CAMIF_TIMER1_GPIO 3 |
| 185 | #define VFE_CAMIF_TIMER2_GPIO 1 |
| 186 | |
| 187 | static struct msm_camera_sensor_flash_src msm_flash_src = { |
| 188 | .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT, |
| 189 | ._fsrc.ext_driver_src.led_en = VFE_CAMIF_TIMER1_GPIO, |
| 190 | ._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO, |
| 191 | }; |
| 192 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 193 | static struct msm_gpiomux_config apq8064_cam_2d_configs[] = { |
| 194 | }; |
| 195 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 196 | #ifdef CONFIG_MSM_CAMERA |
| 197 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 198 | static struct msm_bus_vectors cam_init_vectors[] = { |
| 199 | { |
| 200 | .src = MSM_BUS_MASTER_VFE, |
| 201 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 202 | .ab = 0, |
| 203 | .ib = 0, |
| 204 | }, |
| 205 | { |
| 206 | .src = MSM_BUS_MASTER_VPE, |
| 207 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 208 | .ab = 0, |
| 209 | .ib = 0, |
| 210 | }, |
| 211 | { |
| 212 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 213 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 214 | .ab = 0, |
| 215 | .ib = 0, |
| 216 | }, |
| 217 | }; |
| 218 | |
| 219 | static struct msm_bus_vectors cam_preview_vectors[] = { |
| 220 | { |
| 221 | .src = MSM_BUS_MASTER_VFE, |
| 222 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 223 | .ab = 27648000, |
| 224 | .ib = 110592000, |
| 225 | }, |
| 226 | { |
| 227 | .src = MSM_BUS_MASTER_VPE, |
| 228 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 229 | .ab = 0, |
| 230 | .ib = 0, |
| 231 | }, |
| 232 | { |
| 233 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 234 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 235 | .ab = 0, |
| 236 | .ib = 0, |
| 237 | }, |
| 238 | }; |
| 239 | |
| 240 | static struct msm_bus_vectors cam_video_vectors[] = { |
| 241 | { |
| 242 | .src = MSM_BUS_MASTER_VFE, |
| 243 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 244 | .ab = 140451840, |
| 245 | .ib = 561807360, |
| 246 | }, |
| 247 | { |
| 248 | .src = MSM_BUS_MASTER_VPE, |
| 249 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 250 | .ab = 206807040, |
| 251 | .ib = 488816640, |
| 252 | }, |
| 253 | { |
| 254 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 255 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 256 | .ab = 0, |
| 257 | .ib = 0, |
| 258 | }, |
| 259 | }; |
| 260 | |
| 261 | static struct msm_bus_vectors cam_snapshot_vectors[] = { |
| 262 | { |
| 263 | .src = MSM_BUS_MASTER_VFE, |
| 264 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 265 | .ab = 274423680, |
| 266 | .ib = 1097694720, |
| 267 | }, |
| 268 | { |
| 269 | .src = MSM_BUS_MASTER_VPE, |
| 270 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 271 | .ab = 0, |
| 272 | .ib = 0, |
| 273 | }, |
| 274 | { |
| 275 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 276 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 277 | .ab = 540000000, |
| 278 | .ib = 1350000000, |
| 279 | }, |
| 280 | }; |
| 281 | |
| 282 | static struct msm_bus_vectors cam_zsl_vectors[] = { |
| 283 | { |
| 284 | .src = MSM_BUS_MASTER_VFE, |
| 285 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 286 | .ab = 302071680, |
| 287 | .ib = 1208286720, |
| 288 | }, |
| 289 | { |
| 290 | .src = MSM_BUS_MASTER_VPE, |
| 291 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 292 | .ab = 0, |
| 293 | .ib = 0, |
| 294 | }, |
| 295 | { |
| 296 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 297 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 298 | .ab = 540000000, |
| 299 | .ib = 1350000000, |
| 300 | }, |
| 301 | }; |
| 302 | |
| 303 | static struct msm_bus_paths cam_bus_client_config[] = { |
| 304 | { |
| 305 | ARRAY_SIZE(cam_init_vectors), |
| 306 | cam_init_vectors, |
| 307 | }, |
| 308 | { |
| 309 | ARRAY_SIZE(cam_preview_vectors), |
| 310 | cam_preview_vectors, |
| 311 | }, |
| 312 | { |
| 313 | ARRAY_SIZE(cam_video_vectors), |
| 314 | cam_video_vectors, |
| 315 | }, |
| 316 | { |
| 317 | ARRAY_SIZE(cam_snapshot_vectors), |
| 318 | cam_snapshot_vectors, |
| 319 | }, |
| 320 | { |
| 321 | ARRAY_SIZE(cam_zsl_vectors), |
| 322 | cam_zsl_vectors, |
| 323 | }, |
| 324 | }; |
| 325 | |
| 326 | static struct msm_bus_scale_pdata cam_bus_client_pdata = { |
| 327 | cam_bus_client_config, |
| 328 | ARRAY_SIZE(cam_bus_client_config), |
| 329 | .name = "msm_camera", |
| 330 | }; |
| 331 | |
| 332 | static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = { |
| 333 | { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 334 | .csid_core = 0, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 335 | .is_csiphy = 1, |
| 336 | .is_csid = 1, |
| 337 | .is_ispif = 1, |
| 338 | .is_vpe = 1, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 339 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 340 | }, |
| 341 | { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 342 | .csid_core = 1, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 343 | .is_csiphy = 1, |
| 344 | .is_csid = 1, |
| 345 | .is_ispif = 1, |
| 346 | .is_vpe = 1, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 347 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 348 | }, |
| 349 | }; |
| 350 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 351 | static struct camera_vreg_t apq_8064_back_cam_vreg[] = { |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 352 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 353 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 354 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 355 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 356 | }; |
| 357 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 358 | static struct camera_vreg_t apq_8064_front_cam_vreg[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 359 | {"cam_vio", REG_VS, 0, 0, 0}, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 360 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 361 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 362 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 363 | }; |
| 364 | |
| 365 | #define CAML_RSTN PM8921_GPIO_PM_TO_SYS(28) |
| 366 | #define CAMR_RSTN 34 |
| 367 | |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 368 | static struct gpio apq8064_common_cam_gpio[] = { |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 369 | }; |
| 370 | |
| 371 | static struct gpio apq8064_back_cam_gpio[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 372 | {5, GPIOF_DIR_IN, "CAMIF_MCLK"}, |
| 373 | {CAML_RSTN, GPIOF_DIR_OUT, "CAM_RESET"}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 374 | }; |
| 375 | |
| 376 | static struct msm_gpio_set_tbl apq8064_back_cam_gpio_set_tbl[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 377 | {CAML_RSTN, GPIOF_OUT_INIT_LOW, 10000}, |
| 378 | {CAML_RSTN, GPIOF_OUT_INIT_HIGH, 10000}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 379 | }; |
| 380 | |
| 381 | static struct msm_camera_gpio_conf apq8064_back_cam_gpio_conf = { |
| 382 | .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs, |
| 383 | .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs), |
| 384 | .cam_gpio_common_tbl = apq8064_common_cam_gpio, |
| 385 | .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio), |
| 386 | .cam_gpio_req_tbl = apq8064_back_cam_gpio, |
| 387 | .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio), |
| 388 | .cam_gpio_set_tbl = apq8064_back_cam_gpio_set_tbl, |
| 389 | .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio_set_tbl), |
| 390 | }; |
| 391 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 392 | static struct gpio apq8064_front_cam_gpio[] = { |
| 393 | {4, GPIOF_DIR_IN, "CAMIF_MCLK"}, |
| 394 | {12, GPIOF_DIR_IN, "CAMIF_I2C_DATA"}, |
| 395 | {13, GPIOF_DIR_IN, "CAMIF_I2C_CLK"}, |
| 396 | {CAMR_RSTN, GPIOF_DIR_OUT, "CAM_RESET"}, |
| 397 | }; |
| 398 | |
| 399 | static struct msm_gpio_set_tbl apq8064_front_cam_gpio_set_tbl[] = { |
| 400 | {CAMR_RSTN, GPIOF_OUT_INIT_LOW, 10000}, |
| 401 | {CAMR_RSTN, GPIOF_OUT_INIT_HIGH, 10000}, |
| 402 | }; |
| 403 | |
| 404 | static struct msm_camera_gpio_conf apq8064_front_cam_gpio_conf = { |
| 405 | .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs, |
| 406 | .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs), |
| 407 | .cam_gpio_common_tbl = apq8064_common_cam_gpio, |
| 408 | .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio), |
| 409 | .cam_gpio_req_tbl = apq8064_front_cam_gpio, |
| 410 | .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio), |
| 411 | .cam_gpio_set_tbl = apq8064_front_cam_gpio_set_tbl, |
| 412 | .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio_set_tbl), |
| 413 | }; |
| 414 | |
| 415 | static struct msm_camera_i2c_conf apq8064_back_cam_i2c_conf = { |
| 416 | .use_i2c_mux = 1, |
| 417 | .mux_dev = &msm8960_device_i2c_mux_gsbi4, |
| 418 | .i2c_mux_mode = MODE_L, |
| 419 | }; |
| 420 | |
Jignesh Mehta | 3339457 | 2012-02-21 19:57:41 -0800 | [diff] [blame] | 421 | static struct i2c_board_info imx074_actuator_i2c_info = { |
| 422 | I2C_BOARD_INFO("imx074_act", 0x11), |
| 423 | }; |
| 424 | |
| 425 | static struct msm_actuator_info imx074_actuator_info = { |
| 426 | .board_info = &imx074_actuator_i2c_info, |
| 427 | .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 428 | .vcm_pwd = 0, |
| 429 | .vcm_enable = 1, |
| 430 | }; |
| 431 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 432 | static struct msm_camera_i2c_conf apq8064_front_cam_i2c_conf = { |
| 433 | .use_i2c_mux = 1, |
| 434 | .mux_dev = &msm8960_device_i2c_mux_gsbi4, |
| 435 | .i2c_mux_mode = MODE_L, |
| 436 | }; |
| 437 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 438 | static struct msm_camera_sensor_flash_data flash_imx074 = { |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 439 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 440 | .flash_src = &msm_flash_src |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 441 | }; |
| 442 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 443 | static struct msm_camera_csi_lane_params imx074_csi_lane_params = { |
| 444 | .csi_lane_assign = 0xE4, |
| 445 | .csi_lane_mask = 0xF, |
| 446 | }; |
| 447 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 448 | static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = { |
| 449 | .mount_angle = 90, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 450 | .cam_vreg = apq_8064_back_cam_vreg, |
| 451 | .num_vreg = ARRAY_SIZE(apq_8064_back_cam_vreg), |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 452 | .gpio_conf = &apq8064_back_cam_gpio_conf, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 453 | .i2c_conf = &apq8064_back_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 454 | .csi_lane_params = &imx074_csi_lane_params, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 455 | }; |
| 456 | |
| 457 | static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = { |
| 458 | .sensor_name = "imx074", |
| 459 | .pdata = &msm_camera_csi_device_data[0], |
| 460 | .flash_data = &flash_imx074, |
| 461 | .sensor_platform_info = &sensor_board_info_imx074, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 462 | .csi_if = 1, |
| 463 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame^] | 464 | .sensor_type = BAYER_SENSOR, |
Jignesh Mehta | 3339457 | 2012-02-21 19:57:41 -0800 | [diff] [blame] | 465 | .actuator_info = &imx074_actuator_info |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 466 | }; |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 467 | static struct msm_camera_csi_lane_params imx091_csi_lane_params = { |
| 468 | .csi_lane_assign = 0xE4, |
| 469 | .csi_lane_mask = 0xF, |
| 470 | }; |
| 471 | |
| 472 | static struct camera_vreg_t apq_8064_imx091_vreg[] = { |
| 473 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
| 474 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 475 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 476 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 477 | }; |
| 478 | |
| 479 | static struct msm_camera_sensor_flash_data flash_imx091 = { |
| 480 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 481 | }; |
| 482 | |
| 483 | static struct msm_camera_sensor_platform_info sensor_board_info_imx091 = { |
| 484 | .mount_angle = 0, |
| 485 | .cam_vreg = apq_8064_imx091_vreg, |
| 486 | .num_vreg = ARRAY_SIZE(apq_8064_imx091_vreg), |
| 487 | .gpio_conf = &apq8064_back_cam_gpio_conf, |
| 488 | .i2c_conf = &apq8064_back_cam_i2c_conf, |
| 489 | .csi_lane_params = &imx091_csi_lane_params, |
| 490 | }; |
| 491 | |
| 492 | static struct msm_camera_sensor_info msm_camera_sensor_imx091_data = { |
| 493 | .sensor_name = "imx091", |
| 494 | .pdata = &msm_camera_csi_device_data[0], |
| 495 | .flash_data = &flash_imx091, |
| 496 | .sensor_platform_info = &sensor_board_info_imx091, |
| 497 | .csi_if = 1, |
| 498 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame^] | 499 | .sensor_type = BAYER_SENSOR, |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 500 | }; |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 501 | |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 502 | static struct camera_vreg_t apq_8064_mt9m114_vreg[] = { |
| 503 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 504 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 505 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
| 506 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 507 | }; |
| 508 | |
| 509 | static struct msm_camera_sensor_flash_data flash_mt9m114 = { |
| 510 | .flash_type = MSM_CAMERA_FLASH_NONE |
| 511 | }; |
| 512 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 513 | static struct msm_camera_csi_lane_params mt9m114_csi_lane_params = { |
| 514 | .csi_lane_assign = 0xE4, |
| 515 | .csi_lane_mask = 0x1, |
| 516 | }; |
| 517 | |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 518 | static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = { |
| 519 | .mount_angle = 90, |
| 520 | .cam_vreg = apq_8064_mt9m114_vreg, |
| 521 | .num_vreg = ARRAY_SIZE(apq_8064_mt9m114_vreg), |
| 522 | .gpio_conf = &apq8064_front_cam_gpio_conf, |
| 523 | .i2c_conf = &apq8064_front_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 524 | .csi_lane_params = &mt9m114_csi_lane_params, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 525 | }; |
| 526 | |
| 527 | static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = { |
| 528 | .sensor_name = "mt9m114", |
| 529 | .pdata = &msm_camera_csi_device_data[1], |
| 530 | .flash_data = &flash_mt9m114, |
| 531 | .sensor_platform_info = &sensor_board_info_mt9m114, |
| 532 | .csi_if = 1, |
| 533 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame^] | 534 | .sensor_type = YUV_SENSOR, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 535 | }; |
| 536 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 537 | static struct msm_camera_sensor_flash_data flash_ov2720 = { |
| 538 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 539 | }; |
| 540 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 541 | static struct msm_camera_csi_lane_params ov2720_csi_lane_params = { |
| 542 | .csi_lane_assign = 0xE4, |
| 543 | .csi_lane_mask = 0x3, |
| 544 | }; |
| 545 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 546 | static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = { |
| 547 | .mount_angle = 0, |
| 548 | .cam_vreg = apq_8064_front_cam_vreg, |
| 549 | .num_vreg = ARRAY_SIZE(apq_8064_front_cam_vreg), |
| 550 | .gpio_conf = &apq8064_front_cam_gpio_conf, |
| 551 | .i2c_conf = &apq8064_front_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 552 | .csi_lane_params = &ov2720_csi_lane_params, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 553 | }; |
| 554 | |
| 555 | static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = { |
| 556 | .sensor_name = "ov2720", |
| 557 | .pdata = &msm_camera_csi_device_data[1], |
| 558 | .flash_data = &flash_ov2720, |
| 559 | .sensor_platform_info = &sensor_board_info_ov2720, |
| 560 | .csi_if = 1, |
| 561 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame^] | 562 | .sensor_type = BAYER_SENSOR, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 563 | }; |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 564 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 565 | void __init apq8064_init_cam(void) |
| 566 | { |
| 567 | msm_gpiomux_install(apq8064_cam_common_configs, |
| 568 | ARRAY_SIZE(apq8064_cam_common_configs)); |
| 569 | |
Jignesh Mehta | bfb1aa3 | 2012-03-16 17:23:23 -0700 | [diff] [blame] | 570 | if (machine_is_apq8064_cdp()) |
Sreesudhan Ramakrish Ramkumar | 3f06a1b | 2012-03-15 18:44:56 -0700 | [diff] [blame] | 571 | sensor_board_info_imx074.mount_angle = 0; |
Jignesh Mehta | bfb1aa3 | 2012-03-16 17:23:23 -0700 | [diff] [blame] | 572 | else if (machine_is_apq8064_liquid()) |
| 573 | sensor_board_info_imx074.mount_angle = 180; |
Sreesudhan Ramakrish Ramkumar | 3f06a1b | 2012-03-15 18:44:56 -0700 | [diff] [blame] | 574 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 575 | platform_device_register(&msm8960_device_i2c_mux_gsbi4); |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 576 | platform_device_register(&msm8960_device_csiphy0); |
| 577 | platform_device_register(&msm8960_device_csiphy1); |
| 578 | platform_device_register(&msm8960_device_csid0); |
| 579 | platform_device_register(&msm8960_device_csid1); |
| 580 | platform_device_register(&msm8960_device_ispif); |
| 581 | platform_device_register(&msm8960_device_vfe); |
| 582 | platform_device_register(&msm8960_device_vpe); |
| 583 | } |
| 584 | |
| 585 | #ifdef CONFIG_I2C |
| 586 | static struct i2c_board_info apq8064_camera_i2c_boardinfo[] = { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 587 | { |
| 588 | I2C_BOARD_INFO("imx074", 0x1A), |
| 589 | .platform_data = &msm_camera_sensor_imx074_data, |
| 590 | }, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 591 | { |
| 592 | I2C_BOARD_INFO("mt9m114", 0x48), |
| 593 | .platform_data = &msm_camera_sensor_mt9m114_data, |
| 594 | }, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 595 | { |
| 596 | I2C_BOARD_INFO("ov2720", 0x6C), |
| 597 | .platform_data = &msm_camera_sensor_ov2720_data, |
| 598 | }, |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 599 | { |
| 600 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 601 | }, |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 602 | { |
| 603 | I2C_BOARD_INFO("imx091", 0x34), |
| 604 | .platform_data = &msm_camera_sensor_imx091_data, |
| 605 | }, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 606 | }; |
| 607 | |
| 608 | struct msm_camera_board_info apq8064_camera_board_info = { |
| 609 | .board_info = apq8064_camera_i2c_boardinfo, |
| 610 | .num_i2c_board_info = ARRAY_SIZE(apq8064_camera_i2c_boardinfo), |
| 611 | }; |
| 612 | #endif |
| 613 | #endif |