blob: fbe223d7c3ae5d7ce8ead7cd9e21416c251b4e9e [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 },
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800414 {
415 .ioclk.mclk_clk_rate = 24000000,
416 .ioclk.vfe_clk_rate = 228570000,
417 .csid_core = 2,
418 .cam_bus_scale_table = &cam_bus_client_pdata,
419 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800420};
421
Kevin Chaneb6b6072012-01-17 11:54:54 -0800422static struct camera_vreg_t msm_8960_back_cam_vreg[] = {
423 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
424 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
425 {"cam_vio", REG_VS, 0, 0, 0},
426 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
427 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
428};
429
430static struct camera_vreg_t msm_8960_front_cam_vreg[] = {
431 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
432 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
433 {"cam_vio", REG_VS, 0, 0, 0},
434 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
435};
436
437static struct gpio msm8960_common_cam_gpio[] = {
438 {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
439 {20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
440 {21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
441};
442
443static struct gpio msm8960_front_cam_gpio[] = {
444 {76, GPIOF_DIR_OUT, "CAM_RESET"},
445};
446
447static struct gpio msm8960_back_cam_gpio[] = {
448 {107, GPIOF_DIR_OUT, "CAM_RESET"},
449};
450
451static struct msm_gpio_set_tbl msm8960_front_cam_gpio_set_tbl[] = {
452 {76, GPIOF_OUT_INIT_LOW, 1000},
453 {76, GPIOF_OUT_INIT_HIGH, 4000},
454};
455
456static struct msm_gpio_set_tbl msm8960_back_cam_gpio_set_tbl[] = {
457 {107, GPIOF_OUT_INIT_LOW, 1000},
458 {107, GPIOF_OUT_INIT_HIGH, 4000},
459};
460
461static struct msm_camera_gpio_conf msm_8960_front_cam_gpio_conf = {
462 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
463 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
464 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
465 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
466 .cam_gpio_req_tbl = msm8960_front_cam_gpio,
467 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio),
468 .cam_gpio_set_tbl = msm8960_front_cam_gpio_set_tbl,
469 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio_set_tbl),
470};
471
472static struct msm_camera_gpio_conf msm_8960_back_cam_gpio_conf = {
473 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
474 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
475 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
476 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
477 .cam_gpio_req_tbl = msm8960_back_cam_gpio,
478 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio),
479 .cam_gpio_set_tbl = msm8960_back_cam_gpio_set_tbl,
480 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio_set_tbl),
481};
482
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800483#ifdef CONFIG_IMX074_ACT
484static struct i2c_board_info imx074_actuator_i2c_info = {
485 I2C_BOARD_INFO("imx074_act", 0x11),
486};
487
488static struct msm_actuator_info imx074_actuator_info = {
489 .board_info = &imx074_actuator_i2c_info,
490 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
491 .vcm_pwd = 0,
492 .vcm_enable = 1,
493};
494#endif
495
496#ifdef CONFIG_IMX074
497static struct msm_camera_sensor_flash_data flash_imx074 = {
498 .flash_type = MSM_CAMERA_FLASH_LED,
499#ifdef CONFIG_MSM_CAMERA_FLASH
500 .flash_src = &msm_flash_src
501#endif
502};
503
504static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
505 .mount_angle = 90,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800506 .cam_vreg = msm_8960_back_cam_vreg,
507 .num_vreg = ARRAY_SIZE(msm_8960_back_cam_vreg),
508 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800509};
510
511static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
512 .sensor_name = "imx074",
513 .pdata = &msm_camera_csi_device_data[0],
514 .flash_data = &flash_imx074,
515 .strobe_flash_data = &strobe_flash_xenon,
516 .sensor_platform_info = &sensor_board_info_imx074,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800517 .csi_if = 1,
518 .camera_type = BACK_CAMERA_2D,
519#ifdef CONFIG_IMX074_ACT
520 .actuator_info = &imx074_actuator_info
521#endif
522};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800523#endif
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800524
525#ifdef CONFIG_MT9M114
526static struct msm_camera_sensor_flash_data flash_mt9m114 = {
527 .flash_type = MSM_CAMERA_FLASH_NONE
528};
529
530static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = {
531 .mount_angle = 90,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800532 .cam_vreg = msm_8960_back_cam_vreg,
533 .num_vreg = ARRAY_SIZE(msm_8960_back_cam_vreg),
534 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800535};
536
537static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = {
538 .sensor_name = "mt9m114",
539 .pdata = &msm_camera_csi_device_data[0],
540 .flash_data = &flash_mt9m114,
541 .sensor_platform_info = &sensor_board_info_mt9m114,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800542 .csi_if = 1,
543 .camera_type = BACK_CAMERA_2D,
544};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800545#endif
546
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800547#ifdef CONFIG_OV2720
548static struct msm_camera_sensor_flash_data flash_ov2720 = {
549 .flash_type = MSM_CAMERA_FLASH_NONE,
550};
551
552static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
553 .mount_angle = 0,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800554 .cam_vreg = msm_8960_front_cam_vreg,
555 .num_vreg = ARRAY_SIZE(msm_8960_front_cam_vreg),
556 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800557};
558
559static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
560 .sensor_name = "ov2720",
561 .pdata = &msm_camera_csi_device_data[1],
562 .flash_data = &flash_ov2720,
563 .sensor_platform_info = &sensor_board_info_ov2720,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800564 .csi_if = 1,
565 .camera_type = FRONT_CAMERA_2D,
566};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800567#endif
568
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800569static struct camera_vreg_t msm_8960_s5k3l1yx_vreg[] = {
570 {"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
571 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
572 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
573 {"cam_vio", REG_VS, 0, 0, 0},
574 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
575};
576
577static struct msm_camera_sensor_flash_data flash_s5k3l1yx = {
578 .flash_type = MSM_CAMERA_FLASH_NONE,
579};
580
581static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = {
582 .mount_angle = 0,
583 .cam_vreg = msm_8960_s5k3l1yx_vreg,
584 .num_vreg = ARRAY_SIZE(msm_8960_s5k3l1yx_vreg),
585 .gpio_conf = &msm_8960_back_cam_gpio_conf,
586};
587
588static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = {
589 .sensor_name = "s5k3l1yx",
590 .pdata = &msm_camera_csi_device_data[0],
591 .flash_data = &flash_s5k3l1yx,
592 .sensor_platform_info = &sensor_board_info_s5k3l1yx,
593 .csi_if = 1,
594 .camera_type = BACK_CAMERA_2D,
595};
596
Kevin Chaneb6b6072012-01-17 11:54:54 -0800597static struct pm8xxx_mpp_config_data privacy_light_on_config = {
598 .type = PM8XXX_MPP_TYPE_SINK,
599 .level = PM8XXX_MPP_CS_OUT_5MA,
600 .control = PM8XXX_MPP_CS_CTRL_MPP_LOW_EN,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800601};
602
Kevin Chaneb6b6072012-01-17 11:54:54 -0800603static struct pm8xxx_mpp_config_data privacy_light_off_config = {
604 .type = PM8XXX_MPP_TYPE_SINK,
605 .level = PM8XXX_MPP_CS_OUT_5MA,
606 .control = PM8XXX_MPP_CS_CTRL_DISABLE,
607};
608
609static int32_t msm_camera_8960_ext_power_ctrl(int enable)
610{
611 int rc = 0;
612 if (enable) {
613 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
614 &privacy_light_on_config);
615 } else {
616 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
617 &privacy_light_off_config);
618 }
619 return rc;
620}
621
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800622void __init msm8960_init_cam(void)
623{
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800624 msm_gpiomux_install(msm8960_cam_common_configs,
625 ARRAY_SIZE(msm8960_cam_common_configs));
626
Kevin Chancfab2f72011-12-02 13:05:51 -0800627 if (machine_is_msm8960_cdp()) {
628 msm_gpiomux_install(msm8960_cdp_flash_configs,
629 ARRAY_SIZE(msm8960_cdp_flash_configs));
630 msm_flash_src._fsrc.ext_driver_src.led_en =
631 GPIO_CAM_GP_LED_EN1;
632 msm_flash_src._fsrc.ext_driver_src.led_flash_en =
633 GPIO_CAM_GP_LED_EN2;
634 #if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
635 defined(CONFIG_GPIO_SX150X_MODULE))
636 msm_flash_src._fsrc.ext_driver_src.expander_info =
637 cam_expander_info;
638 #endif
639 }
640
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800641 if (machine_is_msm8960_liquid()) {
642 struct msm_camera_sensor_info *s_info;
Kevin Chan09f4e662011-12-16 08:17:02 -0800643 s_info = &msm_camera_sensor_imx074_data;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800644 s_info->sensor_platform_info->mount_angle = 180;
Kevin Chan09f4e662011-12-16 08:17:02 -0800645 s_info = &msm_camera_sensor_ov2720_data;
Kevin Chaneb6b6072012-01-17 11:54:54 -0800646 s_info->sensor_platform_info->ext_power_ctrl =
647 msm_camera_8960_ext_power_ctrl;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800648 }
649
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800650 platform_device_register(&msm8960_device_csiphy0);
651 platform_device_register(&msm8960_device_csiphy1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800652 platform_device_register(&msm8960_device_csiphy2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800653 platform_device_register(&msm8960_device_csid0);
654 platform_device_register(&msm8960_device_csid1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800655 platform_device_register(&msm8960_device_csid2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800656 platform_device_register(&msm8960_device_ispif);
657 platform_device_register(&msm8960_device_vfe);
658 platform_device_register(&msm8960_device_vpe);
659}
Kevin Chan09f4e662011-12-16 08:17:02 -0800660
661#ifdef CONFIG_I2C
662static struct i2c_board_info msm8960_camera_i2c_boardinfo[] = {
663#ifdef CONFIG_IMX074
664 {
665 I2C_BOARD_INFO("imx074", 0x1A),
666 .platform_data = &msm_camera_sensor_imx074_data,
667 },
668#endif
669#ifdef CONFIG_OV2720
670 {
671 I2C_BOARD_INFO("ov2720", 0x6C),
672 .platform_data = &msm_camera_sensor_ov2720_data,
673 },
674#endif
675 {
676 I2C_BOARD_INFO("mt9m114", 0x48),
677 .platform_data = &msm_camera_sensor_mt9m114_data,
678 },
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800679 {
680 I2C_BOARD_INFO("s5k3l1yx", 0x20),
681 .platform_data = &msm_camera_sensor_s5k3l1yx_data,
682 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800683#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
684 {
685 I2C_BOARD_INFO("sc628a", 0x6E),
686 },
687#endif
688};
689
690struct msm_camera_board_info msm8960_camera_board_info = {
691 .board_info = msm8960_camera_i2c_boardinfo,
692 .num_i2c_board_info = ARRAY_SIZE(msm8960_camera_i2c_boardinfo),
693};
694#endif
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800695#endif