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, |
Jeyaprakash Soundrapandian | 85099fe | 2012-05-15 17:09:51 -0700 | [diff] [blame^] | 191 | ._fsrc.ext_driver_src.flash_id = MAM_CAMERA_EXT_LED_FLASH_SC628A, |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 192 | }; |
| 193 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 194 | static struct msm_gpiomux_config apq8064_cam_2d_configs[] = { |
| 195 | }; |
| 196 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 197 | #ifdef CONFIG_MSM_CAMERA |
| 198 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 199 | static struct msm_bus_vectors cam_init_vectors[] = { |
| 200 | { |
| 201 | .src = MSM_BUS_MASTER_VFE, |
| 202 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 203 | .ab = 0, |
| 204 | .ib = 0, |
| 205 | }, |
| 206 | { |
| 207 | .src = MSM_BUS_MASTER_VPE, |
| 208 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 209 | .ab = 0, |
| 210 | .ib = 0, |
| 211 | }, |
| 212 | { |
| 213 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 214 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 215 | .ab = 0, |
| 216 | .ib = 0, |
| 217 | }, |
| 218 | }; |
| 219 | |
| 220 | static struct msm_bus_vectors cam_preview_vectors[] = { |
| 221 | { |
| 222 | .src = MSM_BUS_MASTER_VFE, |
| 223 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 224 | .ab = 27648000, |
| 225 | .ib = 110592000, |
| 226 | }, |
| 227 | { |
| 228 | .src = MSM_BUS_MASTER_VPE, |
| 229 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 230 | .ab = 0, |
| 231 | .ib = 0, |
| 232 | }, |
| 233 | { |
| 234 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 235 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 236 | .ab = 0, |
| 237 | .ib = 0, |
| 238 | }, |
| 239 | }; |
| 240 | |
| 241 | static struct msm_bus_vectors cam_video_vectors[] = { |
| 242 | { |
| 243 | .src = MSM_BUS_MASTER_VFE, |
| 244 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 245 | .ab = 140451840, |
| 246 | .ib = 561807360, |
| 247 | }, |
| 248 | { |
| 249 | .src = MSM_BUS_MASTER_VPE, |
| 250 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 251 | .ab = 206807040, |
| 252 | .ib = 488816640, |
| 253 | }, |
| 254 | { |
| 255 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 256 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 257 | .ab = 0, |
| 258 | .ib = 0, |
| 259 | }, |
| 260 | }; |
| 261 | |
| 262 | static struct msm_bus_vectors cam_snapshot_vectors[] = { |
| 263 | { |
| 264 | .src = MSM_BUS_MASTER_VFE, |
| 265 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 266 | .ab = 274423680, |
| 267 | .ib = 1097694720, |
| 268 | }, |
| 269 | { |
| 270 | .src = MSM_BUS_MASTER_VPE, |
| 271 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 272 | .ab = 0, |
| 273 | .ib = 0, |
| 274 | }, |
| 275 | { |
| 276 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 277 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 278 | .ab = 540000000, |
| 279 | .ib = 1350000000, |
| 280 | }, |
| 281 | }; |
| 282 | |
| 283 | static struct msm_bus_vectors cam_zsl_vectors[] = { |
| 284 | { |
| 285 | .src = MSM_BUS_MASTER_VFE, |
| 286 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 287 | .ab = 302071680, |
| 288 | .ib = 1208286720, |
| 289 | }, |
| 290 | { |
| 291 | .src = MSM_BUS_MASTER_VPE, |
| 292 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 293 | .ab = 0, |
| 294 | .ib = 0, |
| 295 | }, |
| 296 | { |
| 297 | .src = MSM_BUS_MASTER_JPEG_ENC, |
| 298 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 299 | .ab = 540000000, |
| 300 | .ib = 1350000000, |
| 301 | }, |
| 302 | }; |
| 303 | |
| 304 | static struct msm_bus_paths cam_bus_client_config[] = { |
| 305 | { |
| 306 | ARRAY_SIZE(cam_init_vectors), |
| 307 | cam_init_vectors, |
| 308 | }, |
| 309 | { |
| 310 | ARRAY_SIZE(cam_preview_vectors), |
| 311 | cam_preview_vectors, |
| 312 | }, |
| 313 | { |
| 314 | ARRAY_SIZE(cam_video_vectors), |
| 315 | cam_video_vectors, |
| 316 | }, |
| 317 | { |
| 318 | ARRAY_SIZE(cam_snapshot_vectors), |
| 319 | cam_snapshot_vectors, |
| 320 | }, |
| 321 | { |
| 322 | ARRAY_SIZE(cam_zsl_vectors), |
| 323 | cam_zsl_vectors, |
| 324 | }, |
| 325 | }; |
| 326 | |
| 327 | static struct msm_bus_scale_pdata cam_bus_client_pdata = { |
| 328 | cam_bus_client_config, |
| 329 | ARRAY_SIZE(cam_bus_client_config), |
| 330 | .name = "msm_camera", |
| 331 | }; |
| 332 | |
| 333 | static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = { |
| 334 | { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 335 | .csid_core = 0, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 336 | .is_csiphy = 1, |
| 337 | .is_csid = 1, |
| 338 | .is_ispif = 1, |
| 339 | .is_vpe = 1, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 340 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 341 | }, |
| 342 | { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 343 | .csid_core = 1, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 344 | .is_csiphy = 1, |
| 345 | .is_csid = 1, |
| 346 | .is_ispif = 1, |
| 347 | .is_vpe = 1, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 348 | .cam_bus_scale_table = &cam_bus_client_pdata, |
| 349 | }, |
| 350 | }; |
| 351 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 352 | static struct camera_vreg_t apq_8064_back_cam_vreg[] = { |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 353 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 354 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 355 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 356 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 357 | }; |
| 358 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 359 | static struct camera_vreg_t apq_8064_front_cam_vreg[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 360 | {"cam_vio", REG_VS, 0, 0, 0}, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 361 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 362 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 363 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 364 | }; |
| 365 | |
| 366 | #define CAML_RSTN PM8921_GPIO_PM_TO_SYS(28) |
| 367 | #define CAMR_RSTN 34 |
| 368 | |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 369 | static struct gpio apq8064_common_cam_gpio[] = { |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 370 | }; |
| 371 | |
| 372 | static struct gpio apq8064_back_cam_gpio[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 373 | {5, GPIOF_DIR_IN, "CAMIF_MCLK"}, |
| 374 | {CAML_RSTN, GPIOF_DIR_OUT, "CAM_RESET"}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 375 | }; |
| 376 | |
| 377 | static struct msm_gpio_set_tbl apq8064_back_cam_gpio_set_tbl[] = { |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 378 | {CAML_RSTN, GPIOF_OUT_INIT_LOW, 10000}, |
| 379 | {CAML_RSTN, GPIOF_OUT_INIT_HIGH, 10000}, |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 380 | }; |
| 381 | |
| 382 | static struct msm_camera_gpio_conf apq8064_back_cam_gpio_conf = { |
| 383 | .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs, |
| 384 | .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs), |
| 385 | .cam_gpio_common_tbl = apq8064_common_cam_gpio, |
| 386 | .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio), |
| 387 | .cam_gpio_req_tbl = apq8064_back_cam_gpio, |
| 388 | .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio), |
| 389 | .cam_gpio_set_tbl = apq8064_back_cam_gpio_set_tbl, |
| 390 | .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio_set_tbl), |
| 391 | }; |
| 392 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 393 | static struct gpio apq8064_front_cam_gpio[] = { |
| 394 | {4, GPIOF_DIR_IN, "CAMIF_MCLK"}, |
| 395 | {12, GPIOF_DIR_IN, "CAMIF_I2C_DATA"}, |
| 396 | {13, GPIOF_DIR_IN, "CAMIF_I2C_CLK"}, |
| 397 | {CAMR_RSTN, GPIOF_DIR_OUT, "CAM_RESET"}, |
| 398 | }; |
| 399 | |
| 400 | static struct msm_gpio_set_tbl apq8064_front_cam_gpio_set_tbl[] = { |
| 401 | {CAMR_RSTN, GPIOF_OUT_INIT_LOW, 10000}, |
| 402 | {CAMR_RSTN, GPIOF_OUT_INIT_HIGH, 10000}, |
| 403 | }; |
| 404 | |
| 405 | static struct msm_camera_gpio_conf apq8064_front_cam_gpio_conf = { |
| 406 | .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs, |
| 407 | .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs), |
| 408 | .cam_gpio_common_tbl = apq8064_common_cam_gpio, |
| 409 | .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio), |
| 410 | .cam_gpio_req_tbl = apq8064_front_cam_gpio, |
| 411 | .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio), |
| 412 | .cam_gpio_set_tbl = apq8064_front_cam_gpio_set_tbl, |
| 413 | .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio_set_tbl), |
| 414 | }; |
| 415 | |
| 416 | static struct msm_camera_i2c_conf apq8064_back_cam_i2c_conf = { |
| 417 | .use_i2c_mux = 1, |
| 418 | .mux_dev = &msm8960_device_i2c_mux_gsbi4, |
| 419 | .i2c_mux_mode = MODE_L, |
| 420 | }; |
| 421 | |
Rajakumar Govindaram | 6627b36 | 2012-01-29 19:00:30 -0800 | [diff] [blame] | 422 | static struct i2c_board_info msm_act_main_cam_i2c_info = { |
| 423 | I2C_BOARD_INFO("msm_actuator", 0x11), |
Jignesh Mehta | 3339457 | 2012-02-21 19:57:41 -0800 | [diff] [blame] | 424 | }; |
| 425 | |
Rajakumar Govindaram | 6627b36 | 2012-01-29 19:00:30 -0800 | [diff] [blame] | 426 | static struct msm_actuator_info msm_act_main_cam_0_info = { |
| 427 | .board_info = &msm_act_main_cam_i2c_info, |
| 428 | .cam_name = MSM_ACTUATOR_MAIN_CAM_0, |
Jignesh Mehta | 3339457 | 2012-02-21 19:57:41 -0800 | [diff] [blame] | 429 | .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 430 | .vcm_pwd = 0, |
Rajakumar Govindaram | 6627b36 | 2012-01-29 19:00:30 -0800 | [diff] [blame] | 431 | .vcm_enable = 0, |
Jignesh Mehta | 3339457 | 2012-02-21 19:57:41 -0800 | [diff] [blame] | 432 | }; |
| 433 | |
Jeyaprakash Soundrapandian | 3040c03 | 2012-04-21 01:13:29 -0700 | [diff] [blame] | 434 | static struct i2c_board_info msm_act_main_cam1_i2c_info = { |
| 435 | I2C_BOARD_INFO("msm_actuator", 0x18), |
| 436 | }; |
| 437 | |
| 438 | static struct msm_actuator_info msm_act_main_cam_1_info = { |
| 439 | .board_info = &msm_act_main_cam1_i2c_info, |
| 440 | .cam_name = MSM_ACTUATOR_MAIN_CAM_1, |
| 441 | .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 442 | .vcm_pwd = 0, |
| 443 | .vcm_enable = 0, |
| 444 | }; |
| 445 | |
| 446 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 447 | static struct msm_camera_i2c_conf apq8064_front_cam_i2c_conf = { |
| 448 | .use_i2c_mux = 1, |
| 449 | .mux_dev = &msm8960_device_i2c_mux_gsbi4, |
| 450 | .i2c_mux_mode = MODE_L, |
| 451 | }; |
| 452 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 453 | static struct msm_camera_sensor_flash_data flash_imx074 = { |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 454 | .flash_type = MSM_CAMERA_FLASH_LED, |
| 455 | .flash_src = &msm_flash_src |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 456 | }; |
| 457 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 458 | static struct msm_camera_csi_lane_params imx074_csi_lane_params = { |
| 459 | .csi_lane_assign = 0xE4, |
| 460 | .csi_lane_mask = 0xF, |
| 461 | }; |
| 462 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 463 | static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = { |
| 464 | .mount_angle = 90, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 465 | .cam_vreg = apq_8064_back_cam_vreg, |
| 466 | .num_vreg = ARRAY_SIZE(apq_8064_back_cam_vreg), |
Kevin Chan | eb6b607 | 2012-01-17 11:54:54 -0800 | [diff] [blame] | 467 | .gpio_conf = &apq8064_back_cam_gpio_conf, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 468 | .i2c_conf = &apq8064_back_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 469 | .csi_lane_params = &imx074_csi_lane_params, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 470 | }; |
| 471 | |
Jeyaprakash Soundrapandian | 734476b | 2012-05-03 20:08:15 -0700 | [diff] [blame] | 472 | static struct i2c_board_info imx074_eeprom_i2c_info = { |
| 473 | I2C_BOARD_INFO("imx074_eeprom", 0x34 << 1), |
| 474 | }; |
| 475 | |
| 476 | static struct msm_eeprom_info imx074_eeprom_info = { |
| 477 | .board_info = &imx074_eeprom_i2c_info, |
| 478 | .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 479 | }; |
| 480 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 481 | static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = { |
| 482 | .sensor_name = "imx074", |
| 483 | .pdata = &msm_camera_csi_device_data[0], |
| 484 | .flash_data = &flash_imx074, |
| 485 | .sensor_platform_info = &sensor_board_info_imx074, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 486 | .csi_if = 1, |
| 487 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 488 | .sensor_type = BAYER_SENSOR, |
Rajakumar Govindaram | 6627b36 | 2012-01-29 19:00:30 -0800 | [diff] [blame] | 489 | .actuator_info = &msm_act_main_cam_0_info, |
Jeyaprakash Soundrapandian | 734476b | 2012-05-03 20:08:15 -0700 | [diff] [blame] | 490 | .eeprom_info = &imx074_eeprom_info, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 491 | }; |
Jeyaprakash Soundrapandian | 734476b | 2012-05-03 20:08:15 -0700 | [diff] [blame] | 492 | |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 493 | static struct msm_camera_csi_lane_params imx091_csi_lane_params = { |
| 494 | .csi_lane_assign = 0xE4, |
| 495 | .csi_lane_mask = 0xF, |
| 496 | }; |
| 497 | |
| 498 | static struct camera_vreg_t apq_8064_imx091_vreg[] = { |
| 499 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
| 500 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 501 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 502 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 503 | }; |
| 504 | |
| 505 | static struct msm_camera_sensor_flash_data flash_imx091 = { |
| 506 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 507 | }; |
| 508 | |
| 509 | static struct msm_camera_sensor_platform_info sensor_board_info_imx091 = { |
| 510 | .mount_angle = 0, |
| 511 | .cam_vreg = apq_8064_imx091_vreg, |
| 512 | .num_vreg = ARRAY_SIZE(apq_8064_imx091_vreg), |
| 513 | .gpio_conf = &apq8064_back_cam_gpio_conf, |
| 514 | .i2c_conf = &apq8064_back_cam_i2c_conf, |
| 515 | .csi_lane_params = &imx091_csi_lane_params, |
| 516 | }; |
| 517 | |
Jeyaprakash Soundrapandian | 734476b | 2012-05-03 20:08:15 -0700 | [diff] [blame] | 518 | static struct i2c_board_info imx091_eeprom_i2c_info = { |
| 519 | I2C_BOARD_INFO("imx091_eeprom", 0x21), |
| 520 | }; |
| 521 | |
| 522 | static struct msm_eeprom_info imx091_eeprom_info = { |
| 523 | .board_info = &imx091_eeprom_i2c_info, |
| 524 | .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 525 | }; |
| 526 | |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 527 | static struct msm_camera_sensor_info msm_camera_sensor_imx091_data = { |
| 528 | .sensor_name = "imx091", |
| 529 | .pdata = &msm_camera_csi_device_data[0], |
| 530 | .flash_data = &flash_imx091, |
| 531 | .sensor_platform_info = &sensor_board_info_imx091, |
| 532 | .csi_if = 1, |
| 533 | .camera_type = BACK_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 534 | .sensor_type = BAYER_SENSOR, |
Jeyaprakash Soundrapandian | 3040c03 | 2012-04-21 01:13:29 -0700 | [diff] [blame] | 535 | .actuator_info = &msm_act_main_cam_1_info, |
Jeyaprakash Soundrapandian | 734476b | 2012-05-03 20:08:15 -0700 | [diff] [blame] | 536 | .eeprom_info = &imx091_eeprom_info, |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 537 | }; |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 538 | |
Sreesudhan Ramakrish Ramkumar | 8002a79 | 2012-04-09 17:42:58 -0700 | [diff] [blame] | 539 | static struct camera_vreg_t apq_8064_s5k3l1yx_vreg[] = { |
| 540 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 541 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
| 542 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 543 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 544 | }; |
| 545 | |
| 546 | static struct msm_camera_sensor_flash_data flash_s5k3l1yx = { |
| 547 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 548 | }; |
| 549 | |
| 550 | static struct msm_camera_csi_lane_params s5k3l1yx_csi_lane_params = { |
| 551 | .csi_lane_assign = 0xE4, |
| 552 | .csi_lane_mask = 0xF, |
| 553 | }; |
| 554 | |
| 555 | static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = { |
| 556 | .mount_angle = 90, |
| 557 | .cam_vreg = apq_8064_s5k3l1yx_vreg, |
| 558 | .num_vreg = ARRAY_SIZE(apq_8064_s5k3l1yx_vreg), |
| 559 | .gpio_conf = &apq8064_back_cam_gpio_conf, |
| 560 | .i2c_conf = &apq8064_back_cam_i2c_conf, |
| 561 | .csi_lane_params = &s5k3l1yx_csi_lane_params, |
| 562 | }; |
| 563 | |
| 564 | static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = { |
| 565 | .sensor_name = "s5k3l1yx", |
| 566 | .pdata = &msm_camera_csi_device_data[0], |
| 567 | .flash_data = &flash_s5k3l1yx, |
| 568 | .sensor_platform_info = &sensor_board_info_s5k3l1yx, |
| 569 | .csi_if = 1, |
| 570 | .camera_type = BACK_CAMERA_2D, |
| 571 | .sensor_type = BAYER_SENSOR, |
| 572 | }; |
| 573 | |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 574 | static struct camera_vreg_t apq_8064_mt9m114_vreg[] = { |
| 575 | {"cam_vio", REG_VS, 0, 0, 0}, |
| 576 | {"cam_vdig", REG_LDO, 1200000, 1200000, 105000}, |
| 577 | {"cam_vana", REG_LDO, 2800000, 2850000, 85600}, |
| 578 | {"cam_vaf", REG_LDO, 2800000, 2850000, 300000}, |
| 579 | }; |
| 580 | |
| 581 | static struct msm_camera_sensor_flash_data flash_mt9m114 = { |
| 582 | .flash_type = MSM_CAMERA_FLASH_NONE |
| 583 | }; |
| 584 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 585 | static struct msm_camera_csi_lane_params mt9m114_csi_lane_params = { |
| 586 | .csi_lane_assign = 0xE4, |
| 587 | .csi_lane_mask = 0x1, |
| 588 | }; |
| 589 | |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 590 | static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = { |
| 591 | .mount_angle = 90, |
| 592 | .cam_vreg = apq_8064_mt9m114_vreg, |
| 593 | .num_vreg = ARRAY_SIZE(apq_8064_mt9m114_vreg), |
| 594 | .gpio_conf = &apq8064_front_cam_gpio_conf, |
| 595 | .i2c_conf = &apq8064_front_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 596 | .csi_lane_params = &mt9m114_csi_lane_params, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 597 | }; |
| 598 | |
| 599 | static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = { |
| 600 | .sensor_name = "mt9m114", |
| 601 | .pdata = &msm_camera_csi_device_data[1], |
| 602 | .flash_data = &flash_mt9m114, |
| 603 | .sensor_platform_info = &sensor_board_info_mt9m114, |
| 604 | .csi_if = 1, |
| 605 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 606 | .sensor_type = YUV_SENSOR, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 607 | }; |
| 608 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 609 | static struct msm_camera_sensor_flash_data flash_ov2720 = { |
| 610 | .flash_type = MSM_CAMERA_FLASH_NONE, |
| 611 | }; |
| 612 | |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 613 | static struct msm_camera_csi_lane_params ov2720_csi_lane_params = { |
| 614 | .csi_lane_assign = 0xE4, |
| 615 | .csi_lane_mask = 0x3, |
| 616 | }; |
| 617 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 618 | static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = { |
| 619 | .mount_angle = 0, |
| 620 | .cam_vreg = apq_8064_front_cam_vreg, |
| 621 | .num_vreg = ARRAY_SIZE(apq_8064_front_cam_vreg), |
| 622 | .gpio_conf = &apq8064_front_cam_gpio_conf, |
| 623 | .i2c_conf = &apq8064_front_cam_i2c_conf, |
Hody Hung | 9ba65cf | 2012-01-17 17:34:51 -0800 | [diff] [blame] | 624 | .csi_lane_params = &ov2720_csi_lane_params, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 625 | }; |
| 626 | |
| 627 | static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = { |
| 628 | .sensor_name = "ov2720", |
| 629 | .pdata = &msm_camera_csi_device_data[1], |
| 630 | .flash_data = &flash_ov2720, |
| 631 | .sensor_platform_info = &sensor_board_info_ov2720, |
| 632 | .csi_if = 1, |
| 633 | .camera_type = FRONT_CAMERA_2D, |
Raju P.L.S.S.S.N | 3f4b302 | 2012-03-29 10:09:01 +0530 | [diff] [blame] | 634 | .sensor_type = BAYER_SENSOR, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 635 | }; |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 636 | |
Kevin Chan | 94b4c83 | 2012-03-02 21:27:16 -0800 | [diff] [blame] | 637 | static struct platform_device msm_camera_server = { |
| 638 | .name = "msm_cam_server", |
| 639 | .id = 0, |
| 640 | }; |
| 641 | |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 642 | void __init apq8064_init_cam(void) |
| 643 | { |
| 644 | msm_gpiomux_install(apq8064_cam_common_configs, |
| 645 | ARRAY_SIZE(apq8064_cam_common_configs)); |
| 646 | |
Sreesudhan Ramakrish Ramkumar | 6f25eb9 | 2012-04-10 09:49:47 -0700 | [diff] [blame] | 647 | if (machine_is_apq8064_cdp()) { |
Sreesudhan Ramakrish Ramkumar | 3f06a1b | 2012-03-15 18:44:56 -0700 | [diff] [blame] | 648 | sensor_board_info_imx074.mount_angle = 0; |
Sreesudhan Ramakrish Ramkumar | 6f25eb9 | 2012-04-10 09:49:47 -0700 | [diff] [blame] | 649 | sensor_board_info_mt9m114.mount_angle = 0; |
| 650 | } else if (machine_is_apq8064_liquid()) |
Jignesh Mehta | bfb1aa3 | 2012-03-16 17:23:23 -0700 | [diff] [blame] | 651 | sensor_board_info_imx074.mount_angle = 180; |
Sreesudhan Ramakrish Ramkumar | 3f06a1b | 2012-03-15 18:44:56 -0700 | [diff] [blame] | 652 | |
Kevin Chan | 94b4c83 | 2012-03-02 21:27:16 -0800 | [diff] [blame] | 653 | platform_device_register(&msm_camera_server); |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 654 | platform_device_register(&msm8960_device_i2c_mux_gsbi4); |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 655 | platform_device_register(&msm8960_device_csiphy0); |
| 656 | platform_device_register(&msm8960_device_csiphy1); |
| 657 | platform_device_register(&msm8960_device_csid0); |
| 658 | platform_device_register(&msm8960_device_csid1); |
| 659 | platform_device_register(&msm8960_device_ispif); |
| 660 | platform_device_register(&msm8960_device_vfe); |
| 661 | platform_device_register(&msm8960_device_vpe); |
| 662 | } |
| 663 | |
| 664 | #ifdef CONFIG_I2C |
| 665 | static struct i2c_board_info apq8064_camera_i2c_boardinfo[] = { |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 666 | { |
| 667 | I2C_BOARD_INFO("imx074", 0x1A), |
| 668 | .platform_data = &msm_camera_sensor_imx074_data, |
| 669 | }, |
Sreesudhan Ramakrish Ramkumar | 6c6f57c | 2012-02-21 15:12:44 -0800 | [diff] [blame] | 670 | { |
| 671 | I2C_BOARD_INFO("mt9m114", 0x48), |
| 672 | .platform_data = &msm_camera_sensor_mt9m114_data, |
| 673 | }, |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 674 | { |
| 675 | I2C_BOARD_INFO("ov2720", 0x6C), |
| 676 | .platform_data = &msm_camera_sensor_ov2720_data, |
| 677 | }, |
Jeyaprakash Soundrapandian | a1b3c53 | 2012-02-29 20:33:30 -0800 | [diff] [blame] | 678 | { |
| 679 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 680 | }, |
Sreesudhan Ramakrish Ramkumar | 3381da7 | 2012-01-27 08:08:32 -0800 | [diff] [blame] | 681 | { |
| 682 | I2C_BOARD_INFO("imx091", 0x34), |
| 683 | .platform_data = &msm_camera_sensor_imx091_data, |
| 684 | }, |
Sreesudhan Ramakrish Ramkumar | 8002a79 | 2012-04-09 17:42:58 -0700 | [diff] [blame] | 685 | { |
| 686 | I2C_BOARD_INFO("s5k3l1yx", 0x20), |
| 687 | .platform_data = &msm_camera_sensor_s5k3l1yx_data, |
| 688 | }, |
Kevin Chan | 412e9f9 | 2012-01-24 10:45:23 -0800 | [diff] [blame] | 689 | }; |
| 690 | |
| 691 | struct msm_camera_board_info apq8064_camera_board_info = { |
| 692 | .board_info = apq8064_camera_i2c_boardinfo, |
| 693 | .num_i2c_board_info = ARRAY_SIZE(apq8064_camera_i2c_boardinfo), |
| 694 | }; |
| 695 | #endif |
| 696 | #endif |