blob: 23c49287a142a0ef377fbb9b6b187e1c726988c1 [file] [log] [blame]
Suresh Vankadara8df2c752012-01-18 00:18:03 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -08002 *
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
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080014#include <asm/mach-types.h>
Kevin Chaneb6b6072012-01-17 11:54:54 -080015#include <linux/gpio.h>
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080016#include <mach/board.h>
17#include <mach/msm_bus_board.h>
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080018#include <mach/gpiomux.h>
19#include "devices.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080020#include "board-8960.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080021
22#if (defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)) && \
23 defined(CONFIG_I2C)
24
25static struct i2c_board_info cam_expander_i2c_info[] = {
26 {
27 I2C_BOARD_INFO("sx1508q", 0x22),
28 .platform_data = &msm8960_sx150x_data[SX150X_CAM]
29 },
30};
31
32static struct msm_cam_expander_info cam_expander_info[] = {
33 {
34 cam_expander_i2c_info,
35 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
36 },
37};
38#endif
39
40static struct gpiomux_setting cam_settings[] = {
41 {
42 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
43 .drv = GPIOMUX_DRV_2MA,
44 .pull = GPIOMUX_PULL_DOWN,
45 },
46
47 {
48 .func = GPIOMUX_FUNC_1, /*active 1*/
49 .drv = GPIOMUX_DRV_2MA,
50 .pull = GPIOMUX_PULL_NONE,
51 },
52
53 {
54 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
55 .drv = GPIOMUX_DRV_2MA,
56 .pull = GPIOMUX_PULL_NONE,
57 },
58
59 {
60 .func = GPIOMUX_FUNC_1, /*active 3*/
61 .drv = GPIOMUX_DRV_8MA,
62 .pull = GPIOMUX_PULL_NONE,
63 },
64
65 {
66 .func = GPIOMUX_FUNC_5, /*active 4*/
67 .drv = GPIOMUX_DRV_8MA,
68 .pull = GPIOMUX_PULL_UP,
69 },
70
71 {
72 .func = GPIOMUX_FUNC_6, /*active 5*/
73 .drv = GPIOMUX_DRV_8MA,
74 .pull = GPIOMUX_PULL_UP,
75 },
76
77 {
78 .func = GPIOMUX_FUNC_2, /*active 6*/
79 .drv = GPIOMUX_DRV_2MA,
80 .pull = GPIOMUX_PULL_UP,
81 },
82
83 {
84 .func = GPIOMUX_FUNC_3, /*active 7*/
85 .drv = GPIOMUX_DRV_8MA,
86 .pull = GPIOMUX_PULL_UP,
87 },
88
89 {
90 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
91 .drv = GPIOMUX_DRV_2MA,
92 .pull = GPIOMUX_PULL_KEEPER,
93 },
94
95};
96
Kevin Chancfab2f72011-12-02 13:05:51 -080097static struct msm_gpiomux_config msm8960_cdp_flash_configs[] = {
98 {
99 .gpio = 3,
100 .settings = {
101 [GPIOMUX_ACTIVE] = &cam_settings[1],
102 [GPIOMUX_SUSPENDED] = &cam_settings[0],
103 },
104 },
105};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800106
107static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
108 {
109 .gpio = 2,
110 .settings = {
111 [GPIOMUX_ACTIVE] = &cam_settings[2],
112 [GPIOMUX_SUSPENDED] = &cam_settings[0],
113 },
114 },
115 {
116 .gpio = 3,
117 .settings = {
Kevin Chancfab2f72011-12-02 13:05:51 -0800118 [GPIOMUX_ACTIVE] = &cam_settings[2],
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800119 [GPIOMUX_SUSPENDED] = &cam_settings[0],
120 },
121 },
122 {
123 .gpio = 4,
124 .settings = {
125 [GPIOMUX_ACTIVE] = &cam_settings[1],
126 [GPIOMUX_SUSPENDED] = &cam_settings[0],
127 },
128 },
129 {
130 .gpio = 5,
131 .settings = {
Rajakumar Govindaram7fb409e2011-11-23 13:58:36 -0800132 [GPIOMUX_ACTIVE] = &cam_settings[3],
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800133 [GPIOMUX_SUSPENDED] = &cam_settings[0],
134 },
135 },
136 {
137 .gpio = 76,
138 .settings = {
139 [GPIOMUX_ACTIVE] = &cam_settings[2],
140 [GPIOMUX_SUSPENDED] = &cam_settings[0],
141 },
142 },
143 {
144 .gpio = 107,
145 .settings = {
146 [GPIOMUX_ACTIVE] = &cam_settings[2],
147 [GPIOMUX_SUSPENDED] = &cam_settings[0],
148 },
149 },
150};
151
152static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
153 {
154 .gpio = 18,
155 .settings = {
156 [GPIOMUX_ACTIVE] = &cam_settings[3],
157 [GPIOMUX_SUSPENDED] = &cam_settings[8],
158 },
159 },
160 {
161 .gpio = 19,
162 .settings = {
163 [GPIOMUX_ACTIVE] = &cam_settings[3],
164 [GPIOMUX_SUSPENDED] = &cam_settings[8],
165 },
166 },
167 {
168 .gpio = 20,
169 .settings = {
170 [GPIOMUX_ACTIVE] = &cam_settings[3],
171 [GPIOMUX_SUSPENDED] = &cam_settings[8],
172 },
173 },
174 {
175 .gpio = 21,
176 .settings = {
177 [GPIOMUX_ACTIVE] = &cam_settings[3],
178 [GPIOMUX_SUSPENDED] = &cam_settings[8],
179 },
180 },
181};
182
183#ifdef CONFIG_MSM_CAMERA
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800184#define VFE_CAMIF_TIMER1_GPIO 2
185#define VFE_CAMIF_TIMER2_GPIO 3
186#define VFE_CAMIF_TIMER3_GPIO_INT 4
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800187static struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800188 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
189 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
190 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
191 .flash_recharge_duration = 50000,
192 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
193};
194
195#ifdef CONFIG_MSM_CAMERA_FLASH
196static struct msm_camera_sensor_flash_src msm_flash_src = {
197 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
Kevin Chancfab2f72011-12-02 13:05:51 -0800198 ._fsrc.ext_driver_src.led_en = VFE_CAMIF_TIMER1_GPIO,
199 ._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800200};
201#endif
202
203static struct msm_bus_vectors cam_init_vectors[] = {
204 {
205 .src = MSM_BUS_MASTER_VFE,
206 .dst = MSM_BUS_SLAVE_EBI_CH0,
207 .ab = 0,
208 .ib = 0,
209 },
210 {
211 .src = MSM_BUS_MASTER_VPE,
212 .dst = MSM_BUS_SLAVE_EBI_CH0,
213 .ab = 0,
214 .ib = 0,
215 },
216 {
217 .src = MSM_BUS_MASTER_JPEG_ENC,
218 .dst = MSM_BUS_SLAVE_EBI_CH0,
219 .ab = 0,
220 .ib = 0,
221 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800222 {
223 .src = MSM_BUS_MASTER_JPEG_ENC,
224 .dst = MSM_BUS_SLAVE_MM_IMEM,
225 .ab = 0,
226 .ib = 0,
227 },
228 {
229 .src = MSM_BUS_MASTER_VFE,
230 .dst = MSM_BUS_SLAVE_MM_IMEM,
231 .ab = 0,
232 .ib = 0,
233 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800234};
235
236static struct msm_bus_vectors cam_preview_vectors[] = {
237 {
238 .src = MSM_BUS_MASTER_VFE,
239 .dst = MSM_BUS_SLAVE_EBI_CH0,
240 .ab = 27648000,
241 .ib = 110592000,
242 },
243 {
244 .src = MSM_BUS_MASTER_VPE,
245 .dst = MSM_BUS_SLAVE_EBI_CH0,
246 .ab = 0,
247 .ib = 0,
248 },
249 {
250 .src = MSM_BUS_MASTER_JPEG_ENC,
251 .dst = MSM_BUS_SLAVE_EBI_CH0,
252 .ab = 0,
253 .ib = 0,
254 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800255 {
256 .src = MSM_BUS_MASTER_JPEG_ENC,
257 .dst = MSM_BUS_SLAVE_MM_IMEM,
258 .ab = 0,
259 .ib = 0,
260 },
261 {
262 .src = MSM_BUS_MASTER_VFE,
263 .dst = MSM_BUS_SLAVE_MM_IMEM,
264 .ab = 0,
265 .ib = 0,
266 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800267};
268
269static struct msm_bus_vectors cam_video_vectors[] = {
270 {
271 .src = MSM_BUS_MASTER_VFE,
272 .dst = MSM_BUS_SLAVE_EBI_CH0,
Mingcheng Zhud5ec60e2011-12-16 23:02:53 -0800273 .ab = 154275840,
274 .ib = 617103360,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800275 },
276 {
277 .src = MSM_BUS_MASTER_VPE,
278 .dst = MSM_BUS_SLAVE_EBI_CH0,
279 .ab = 206807040,
280 .ib = 488816640,
281 },
282 {
283 .src = MSM_BUS_MASTER_JPEG_ENC,
284 .dst = MSM_BUS_SLAVE_EBI_CH0,
285 .ab = 0,
286 .ib = 0,
287 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800288 {
289 .src = MSM_BUS_MASTER_JPEG_ENC,
290 .dst = MSM_BUS_SLAVE_MM_IMEM,
291 .ab = 0,
292 .ib = 0,
293 },
294 {
295 .src = MSM_BUS_MASTER_VFE,
296 .dst = MSM_BUS_SLAVE_MM_IMEM,
297 .ab = 0,
298 .ib = 0,
299 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800300};
301
302static struct msm_bus_vectors cam_snapshot_vectors[] = {
303 {
304 .src = MSM_BUS_MASTER_VFE,
305 .dst = MSM_BUS_SLAVE_EBI_CH0,
306 .ab = 274423680,
307 .ib = 1097694720,
308 },
309 {
310 .src = MSM_BUS_MASTER_VPE,
311 .dst = MSM_BUS_SLAVE_EBI_CH0,
312 .ab = 0,
313 .ib = 0,
314 },
315 {
316 .src = MSM_BUS_MASTER_JPEG_ENC,
317 .dst = MSM_BUS_SLAVE_EBI_CH0,
318 .ab = 540000000,
319 .ib = 1350000000,
320 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800321 {
322 .src = MSM_BUS_MASTER_JPEG_ENC,
323 .dst = MSM_BUS_SLAVE_MM_IMEM,
324 .ab = 43200000,
325 .ib = 69120000,
326 },
327 {
328 .src = MSM_BUS_MASTER_VFE,
329 .dst = MSM_BUS_SLAVE_MM_IMEM,
330 .ab = 43200000,
331 .ib = 69120000,
332 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800333};
334
335static struct msm_bus_vectors cam_zsl_vectors[] = {
336 {
337 .src = MSM_BUS_MASTER_VFE,
338 .dst = MSM_BUS_SLAVE_EBI_CH0,
339 .ab = 302071680,
340 .ib = 1208286720,
341 },
342 {
343 .src = MSM_BUS_MASTER_VPE,
344 .dst = MSM_BUS_SLAVE_EBI_CH0,
345 .ab = 0,
346 .ib = 0,
347 },
348 {
349 .src = MSM_BUS_MASTER_JPEG_ENC,
350 .dst = MSM_BUS_SLAVE_EBI_CH0,
351 .ab = 540000000,
352 .ib = 1350000000,
353 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800354 {
355 .src = MSM_BUS_MASTER_JPEG_ENC,
356 .dst = MSM_BUS_SLAVE_MM_IMEM,
357 .ab = 43200000,
358 .ib = 69120000,
359 },
360 {
361 .src = MSM_BUS_MASTER_VFE,
362 .dst = MSM_BUS_SLAVE_MM_IMEM,
363 .ab = 43200000,
364 .ib = 69120000,
365 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800366};
367
368static struct msm_bus_paths cam_bus_client_config[] = {
369 {
370 ARRAY_SIZE(cam_init_vectors),
371 cam_init_vectors,
372 },
373 {
374 ARRAY_SIZE(cam_preview_vectors),
375 cam_preview_vectors,
376 },
377 {
378 ARRAY_SIZE(cam_video_vectors),
379 cam_video_vectors,
380 },
381 {
382 ARRAY_SIZE(cam_snapshot_vectors),
383 cam_snapshot_vectors,
384 },
385 {
386 ARRAY_SIZE(cam_zsl_vectors),
387 cam_zsl_vectors,
388 },
389};
390
391static struct msm_bus_scale_pdata cam_bus_client_pdata = {
392 cam_bus_client_config,
393 ARRAY_SIZE(cam_bus_client_config),
394 .name = "msm_camera",
395};
396
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800397static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800398 {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800399 .csid_core = 0,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530400 .is_csiphy = 1,
401 .is_csid = 1,
402 .is_ispif = 1,
403 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800404 .cam_bus_scale_table = &cam_bus_client_pdata,
405 },
406 {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800407 .csid_core = 1,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530408 .is_csiphy = 1,
409 .is_csid = 1,
410 .is_ispif = 1,
411 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800412 .cam_bus_scale_table = &cam_bus_client_pdata,
413 },
414};
415
Kevin Chaneb6b6072012-01-17 11:54:54 -0800416static struct camera_vreg_t msm_8960_back_cam_vreg[] = {
417 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
418 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
419 {"cam_vio", REG_VS, 0, 0, 0},
420 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
421 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
422};
423
424static struct camera_vreg_t msm_8960_front_cam_vreg[] = {
425 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
426 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
427 {"cam_vio", REG_VS, 0, 0, 0},
428 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
429};
430
431static struct gpio msm8960_common_cam_gpio[] = {
432 {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
433 {20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
434 {21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
435};
436
437static struct gpio msm8960_front_cam_gpio[] = {
438 {76, GPIOF_DIR_OUT, "CAM_RESET"},
439};
440
441static struct gpio msm8960_back_cam_gpio[] = {
442 {107, GPIOF_DIR_OUT, "CAM_RESET"},
443};
444
445static struct msm_gpio_set_tbl msm8960_front_cam_gpio_set_tbl[] = {
446 {76, GPIOF_OUT_INIT_LOW, 1000},
447 {76, GPIOF_OUT_INIT_HIGH, 4000},
448};
449
450static struct msm_gpio_set_tbl msm8960_back_cam_gpio_set_tbl[] = {
451 {107, GPIOF_OUT_INIT_LOW, 1000},
452 {107, GPIOF_OUT_INIT_HIGH, 4000},
453};
454
455static struct msm_camera_gpio_conf msm_8960_front_cam_gpio_conf = {
456 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
457 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
458 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
459 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
460 .cam_gpio_req_tbl = msm8960_front_cam_gpio,
461 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio),
462 .cam_gpio_set_tbl = msm8960_front_cam_gpio_set_tbl,
463 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio_set_tbl),
464};
465
466static struct msm_camera_gpio_conf msm_8960_back_cam_gpio_conf = {
467 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
468 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
469 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
470 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
471 .cam_gpio_req_tbl = msm8960_back_cam_gpio,
472 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio),
473 .cam_gpio_set_tbl = msm8960_back_cam_gpio_set_tbl,
474 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio_set_tbl),
475};
476
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800477#ifdef CONFIG_IMX074_ACT
478static struct i2c_board_info imx074_actuator_i2c_info = {
479 I2C_BOARD_INFO("imx074_act", 0x11),
480};
481
482static struct msm_actuator_info imx074_actuator_info = {
483 .board_info = &imx074_actuator_i2c_info,
484 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
485 .vcm_pwd = 0,
486 .vcm_enable = 1,
487};
488#endif
489
490#ifdef CONFIG_IMX074
491static struct msm_camera_sensor_flash_data flash_imx074 = {
492 .flash_type = MSM_CAMERA_FLASH_LED,
493#ifdef CONFIG_MSM_CAMERA_FLASH
494 .flash_src = &msm_flash_src
495#endif
496};
497
498static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
499 .mount_angle = 90,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800500 .cam_vreg = msm_8960_back_cam_vreg,
501 .num_vreg = ARRAY_SIZE(msm_8960_back_cam_vreg),
502 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800503};
504
505static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
506 .sensor_name = "imx074",
507 .pdata = &msm_camera_csi_device_data[0],
508 .flash_data = &flash_imx074,
509 .strobe_flash_data = &strobe_flash_xenon,
510 .sensor_platform_info = &sensor_board_info_imx074,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800511 .csi_if = 1,
512 .camera_type = BACK_CAMERA_2D,
513#ifdef CONFIG_IMX074_ACT
514 .actuator_info = &imx074_actuator_info
515#endif
516};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800517#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800518
519#ifdef CONFIG_MT9M114
520static struct msm_camera_sensor_flash_data flash_mt9m114 = {
521 .flash_type = MSM_CAMERA_FLASH_NONE
522};
523
524static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = {
525 .mount_angle = 90,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800526 .cam_vreg = msm_8960_back_cam_vreg,
527 .num_vreg = ARRAY_SIZE(msm_8960_back_cam_vreg),
528 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800529};
530
531static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = {
532 .sensor_name = "mt9m114",
533 .pdata = &msm_camera_csi_device_data[0],
534 .flash_data = &flash_mt9m114,
535 .sensor_platform_info = &sensor_board_info_mt9m114,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800536 .csi_if = 1,
537 .camera_type = BACK_CAMERA_2D,
538};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800539#endif
540
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800541#ifdef CONFIG_OV2720
542static struct msm_camera_sensor_flash_data flash_ov2720 = {
543 .flash_type = MSM_CAMERA_FLASH_NONE,
544};
545
546static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
547 .mount_angle = 0,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800548 .cam_vreg = msm_8960_front_cam_vreg,
549 .num_vreg = ARRAY_SIZE(msm_8960_front_cam_vreg),
550 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800551};
552
553static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
554 .sensor_name = "ov2720",
555 .pdata = &msm_camera_csi_device_data[1],
556 .flash_data = &flash_ov2720,
557 .sensor_platform_info = &sensor_board_info_ov2720,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800558 .csi_if = 1,
559 .camera_type = FRONT_CAMERA_2D,
560};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800561#endif
562
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800563static struct camera_vreg_t msm_8960_s5k3l1yx_vreg[] = {
564 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
565 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
566 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
567 {"cam_vio", REG_VS, 0, 0, 0},
568 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
569};
570
571static struct msm_camera_sensor_flash_data flash_s5k3l1yx = {
572 .flash_type = MSM_CAMERA_FLASH_NONE,
573};
574
575static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = {
576 .mount_angle = 0,
577 .cam_vreg = msm_8960_s5k3l1yx_vreg,
578 .num_vreg = ARRAY_SIZE(msm_8960_s5k3l1yx_vreg),
579 .gpio_conf = &msm_8960_back_cam_gpio_conf,
580};
581
582static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = {
583 .sensor_name = "s5k3l1yx",
584 .pdata = &msm_camera_csi_device_data[0],
585 .flash_data = &flash_s5k3l1yx,
586 .sensor_platform_info = &sensor_board_info_s5k3l1yx,
587 .csi_if = 1,
588 .camera_type = BACK_CAMERA_2D,
589};
590
Kevin Chaneb6b6072012-01-17 11:54:54 -0800591static struct pm8xxx_mpp_config_data privacy_light_on_config = {
592 .type = PM8XXX_MPP_TYPE_SINK,
593 .level = PM8XXX_MPP_CS_OUT_5MA,
594 .control = PM8XXX_MPP_CS_CTRL_MPP_LOW_EN,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800595};
596
Kevin Chaneb6b6072012-01-17 11:54:54 -0800597static struct pm8xxx_mpp_config_data privacy_light_off_config = {
598 .type = PM8XXX_MPP_TYPE_SINK,
599 .level = PM8XXX_MPP_CS_OUT_5MA,
600 .control = PM8XXX_MPP_CS_CTRL_DISABLE,
601};
602
603static int32_t msm_camera_8960_ext_power_ctrl(int enable)
604{
605 int rc = 0;
606 if (enable) {
607 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
608 &privacy_light_on_config);
609 } else {
610 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
611 &privacy_light_off_config);
612 }
613 return rc;
614}
615
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800616void __init msm8960_init_cam(void)
617{
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800618 msm_gpiomux_install(msm8960_cam_common_configs,
619 ARRAY_SIZE(msm8960_cam_common_configs));
620
Kevin Chancfab2f72011-12-02 13:05:51 -0800621 if (machine_is_msm8960_cdp()) {
622 msm_gpiomux_install(msm8960_cdp_flash_configs,
623 ARRAY_SIZE(msm8960_cdp_flash_configs));
624 msm_flash_src._fsrc.ext_driver_src.led_en =
625 GPIO_CAM_GP_LED_EN1;
626 msm_flash_src._fsrc.ext_driver_src.led_flash_en =
627 GPIO_CAM_GP_LED_EN2;
628 #if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
629 defined(CONFIG_GPIO_SX150X_MODULE))
630 msm_flash_src._fsrc.ext_driver_src.expander_info =
631 cam_expander_info;
632 #endif
633 }
634
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800635 if (machine_is_msm8960_liquid()) {
636 struct msm_camera_sensor_info *s_info;
Kevin Chan09f4e662011-12-16 08:17:02 -0800637 s_info = &msm_camera_sensor_imx074_data;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800638 s_info->sensor_platform_info->mount_angle = 180;
Kevin Chan09f4e662011-12-16 08:17:02 -0800639 s_info = &msm_camera_sensor_ov2720_data;
Kevin Chaneb6b6072012-01-17 11:54:54 -0800640 s_info->sensor_platform_info->ext_power_ctrl =
641 msm_camera_8960_ext_power_ctrl;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800642 }
643
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800644 platform_device_register(&msm8960_device_csiphy0);
645 platform_device_register(&msm8960_device_csiphy1);
646 platform_device_register(&msm8960_device_csid0);
647 platform_device_register(&msm8960_device_csid1);
648 platform_device_register(&msm8960_device_ispif);
649 platform_device_register(&msm8960_device_vfe);
650 platform_device_register(&msm8960_device_vpe);
651}
Kevin Chan09f4e662011-12-16 08:17:02 -0800652
653#ifdef CONFIG_I2C
654static struct i2c_board_info msm8960_camera_i2c_boardinfo[] = {
655#ifdef CONFIG_IMX074
656 {
657 I2C_BOARD_INFO("imx074", 0x1A),
658 .platform_data = &msm_camera_sensor_imx074_data,
659 },
660#endif
661#ifdef CONFIG_OV2720
662 {
663 I2C_BOARD_INFO("ov2720", 0x6C),
664 .platform_data = &msm_camera_sensor_ov2720_data,
665 },
666#endif
667 {
668 I2C_BOARD_INFO("mt9m114", 0x48),
669 .platform_data = &msm_camera_sensor_mt9m114_data,
670 },
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800671 {
672 I2C_BOARD_INFO("s5k3l1yx", 0x20),
673 .platform_data = &msm_camera_sensor_s5k3l1yx_data,
674 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800675#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
676 {
677 I2C_BOARD_INFO("sc628a", 0x6E),
678 },
679#endif
680};
681
682struct msm_camera_board_info msm8960_camera_board_info = {
683 .board_info = msm8960_camera_i2c_boardinfo,
684 .num_i2c_board_info = ARRAY_SIZE(msm8960_camera_i2c_boardinfo),
685};
686#endif
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800687#endif