blob: b6c03a4270cc0907f58ee9af0de039a72c2f421e [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
Steve Mucklef132c6c2012-06-06 18:30:57 -070022#ifdef CONFIG_MSM_CAMERA
23
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080024#if (defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)) && \
25 defined(CONFIG_I2C)
26
27static struct i2c_board_info cam_expander_i2c_info[] = {
28 {
29 I2C_BOARD_INFO("sx1508q", 0x22),
30 .platform_data = &msm8960_sx150x_data[SX150X_CAM]
31 },
32};
33
34static struct msm_cam_expander_info cam_expander_info[] = {
35 {
36 cam_expander_i2c_info,
37 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
38 },
39};
40#endif
41
42static struct gpiomux_setting cam_settings[] = {
43 {
44 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
45 .drv = GPIOMUX_DRV_2MA,
46 .pull = GPIOMUX_PULL_DOWN,
47 },
48
49 {
50 .func = GPIOMUX_FUNC_1, /*active 1*/
51 .drv = GPIOMUX_DRV_2MA,
52 .pull = GPIOMUX_PULL_NONE,
53 },
54
55 {
56 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
57 .drv = GPIOMUX_DRV_2MA,
58 .pull = GPIOMUX_PULL_NONE,
59 },
60
61 {
62 .func = GPIOMUX_FUNC_1, /*active 3*/
63 .drv = GPIOMUX_DRV_8MA,
64 .pull = GPIOMUX_PULL_NONE,
65 },
66
67 {
68 .func = GPIOMUX_FUNC_5, /*active 4*/
69 .drv = GPIOMUX_DRV_8MA,
70 .pull = GPIOMUX_PULL_UP,
71 },
72
73 {
74 .func = GPIOMUX_FUNC_6, /*active 5*/
75 .drv = GPIOMUX_DRV_8MA,
76 .pull = GPIOMUX_PULL_UP,
77 },
78
79 {
80 .func = GPIOMUX_FUNC_2, /*active 6*/
81 .drv = GPIOMUX_DRV_2MA,
82 .pull = GPIOMUX_PULL_UP,
83 },
84
85 {
86 .func = GPIOMUX_FUNC_3, /*active 7*/
87 .drv = GPIOMUX_DRV_8MA,
88 .pull = GPIOMUX_PULL_UP,
89 },
90
91 {
92 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
93 .drv = GPIOMUX_DRV_2MA,
94 .pull = GPIOMUX_PULL_KEEPER,
95 },
96
97};
98
Kevin Chancfab2f72011-12-02 13:05:51 -080099static struct msm_gpiomux_config msm8960_cdp_flash_configs[] = {
100 {
101 .gpio = 3,
102 .settings = {
103 [GPIOMUX_ACTIVE] = &cam_settings[1],
104 [GPIOMUX_SUSPENDED] = &cam_settings[0],
105 },
106 },
107};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800108
109static struct msm_gpiomux_config msm8960_cam_common_configs[] = {
110 {
111 .gpio = 2,
112 .settings = {
113 [GPIOMUX_ACTIVE] = &cam_settings[2],
114 [GPIOMUX_SUSPENDED] = &cam_settings[0],
115 },
116 },
117 {
118 .gpio = 3,
119 .settings = {
Kevin Chancfab2f72011-12-02 13:05:51 -0800120 [GPIOMUX_ACTIVE] = &cam_settings[2],
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800121 [GPIOMUX_SUSPENDED] = &cam_settings[0],
122 },
123 },
124 {
125 .gpio = 4,
126 .settings = {
127 [GPIOMUX_ACTIVE] = &cam_settings[1],
128 [GPIOMUX_SUSPENDED] = &cam_settings[0],
129 },
130 },
131 {
132 .gpio = 5,
133 .settings = {
Rajakumar Govindaram7fb409e2011-11-23 13:58:36 -0800134 [GPIOMUX_ACTIVE] = &cam_settings[3],
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800135 [GPIOMUX_SUSPENDED] = &cam_settings[0],
136 },
137 },
138 {
139 .gpio = 76,
140 .settings = {
141 [GPIOMUX_ACTIVE] = &cam_settings[2],
142 [GPIOMUX_SUSPENDED] = &cam_settings[0],
143 },
144 },
145 {
146 .gpio = 107,
147 .settings = {
148 [GPIOMUX_ACTIVE] = &cam_settings[2],
149 [GPIOMUX_SUSPENDED] = &cam_settings[0],
150 },
151 },
152};
153
154static struct msm_gpiomux_config msm8960_cam_2d_configs[] = {
155 {
156 .gpio = 18,
157 .settings = {
158 [GPIOMUX_ACTIVE] = &cam_settings[3],
159 [GPIOMUX_SUSPENDED] = &cam_settings[8],
160 },
161 },
162 {
163 .gpio = 19,
164 .settings = {
165 [GPIOMUX_ACTIVE] = &cam_settings[3],
166 [GPIOMUX_SUSPENDED] = &cam_settings[8],
167 },
168 },
169 {
170 .gpio = 20,
171 .settings = {
172 [GPIOMUX_ACTIVE] = &cam_settings[3],
173 [GPIOMUX_SUSPENDED] = &cam_settings[8],
174 },
175 },
176 {
177 .gpio = 21,
178 .settings = {
179 [GPIOMUX_ACTIVE] = &cam_settings[3],
180 [GPIOMUX_SUSPENDED] = &cam_settings[8],
181 },
182 },
183};
184
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800185#define VFE_CAMIF_TIMER1_GPIO 2
186#define VFE_CAMIF_TIMER2_GPIO 3
187#define VFE_CAMIF_TIMER3_GPIO_INT 4
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800188static struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800189 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
190 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
191 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
192 .flash_recharge_duration = 50000,
193 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
194};
195
196#ifdef CONFIG_MSM_CAMERA_FLASH
197static struct msm_camera_sensor_flash_src msm_flash_src = {
198 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
Kevin Chancfab2f72011-12-02 13:05:51 -0800199 ._fsrc.ext_driver_src.led_en = VFE_CAMIF_TIMER1_GPIO,
200 ._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO,
Jeyaprakash Soundrapandian85099fe2012-05-15 17:09:51 -0700201 ._fsrc.ext_driver_src.flash_id = MAM_CAMERA_EXT_LED_FLASH_SC628A,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800202};
203#endif
204
205static struct msm_bus_vectors cam_init_vectors[] = {
206 {
207 .src = MSM_BUS_MASTER_VFE,
208 .dst = MSM_BUS_SLAVE_EBI_CH0,
209 .ab = 0,
210 .ib = 0,
211 },
212 {
213 .src = MSM_BUS_MASTER_VPE,
214 .dst = MSM_BUS_SLAVE_EBI_CH0,
215 .ab = 0,
216 .ib = 0,
217 },
218 {
219 .src = MSM_BUS_MASTER_JPEG_ENC,
220 .dst = MSM_BUS_SLAVE_EBI_CH0,
221 .ab = 0,
222 .ib = 0,
223 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800224 {
225 .src = MSM_BUS_MASTER_JPEG_ENC,
226 .dst = MSM_BUS_SLAVE_MM_IMEM,
227 .ab = 0,
228 .ib = 0,
229 },
230 {
231 .src = MSM_BUS_MASTER_VFE,
232 .dst = MSM_BUS_SLAVE_MM_IMEM,
233 .ab = 0,
234 .ib = 0,
235 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800236};
237
238static struct msm_bus_vectors cam_preview_vectors[] = {
239 {
240 .src = MSM_BUS_MASTER_VFE,
241 .dst = MSM_BUS_SLAVE_EBI_CH0,
242 .ab = 27648000,
243 .ib = 110592000,
244 },
245 {
246 .src = MSM_BUS_MASTER_VPE,
247 .dst = MSM_BUS_SLAVE_EBI_CH0,
248 .ab = 0,
249 .ib = 0,
250 },
251 {
252 .src = MSM_BUS_MASTER_JPEG_ENC,
253 .dst = MSM_BUS_SLAVE_EBI_CH0,
254 .ab = 0,
255 .ib = 0,
256 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800257 {
258 .src = MSM_BUS_MASTER_JPEG_ENC,
259 .dst = MSM_BUS_SLAVE_MM_IMEM,
260 .ab = 0,
261 .ib = 0,
262 },
263 {
264 .src = MSM_BUS_MASTER_VFE,
265 .dst = MSM_BUS_SLAVE_MM_IMEM,
266 .ab = 0,
267 .ib = 0,
268 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800269};
270
271static struct msm_bus_vectors cam_video_vectors[] = {
272 {
273 .src = MSM_BUS_MASTER_VFE,
274 .dst = MSM_BUS_SLAVE_EBI_CH0,
Mingcheng Zhud5ec60e2011-12-16 23:02:53 -0800275 .ab = 154275840,
276 .ib = 617103360,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800277 },
278 {
279 .src = MSM_BUS_MASTER_VPE,
280 .dst = MSM_BUS_SLAVE_EBI_CH0,
281 .ab = 206807040,
282 .ib = 488816640,
283 },
284 {
285 .src = MSM_BUS_MASTER_JPEG_ENC,
286 .dst = MSM_BUS_SLAVE_EBI_CH0,
287 .ab = 0,
288 .ib = 0,
289 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800290 {
291 .src = MSM_BUS_MASTER_JPEG_ENC,
292 .dst = MSM_BUS_SLAVE_MM_IMEM,
293 .ab = 0,
294 .ib = 0,
295 },
296 {
297 .src = MSM_BUS_MASTER_VFE,
298 .dst = MSM_BUS_SLAVE_MM_IMEM,
299 .ab = 0,
300 .ib = 0,
301 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800302};
303
304static struct msm_bus_vectors cam_snapshot_vectors[] = {
305 {
306 .src = MSM_BUS_MASTER_VFE,
307 .dst = MSM_BUS_SLAVE_EBI_CH0,
308 .ab = 274423680,
309 .ib = 1097694720,
310 },
311 {
312 .src = MSM_BUS_MASTER_VPE,
313 .dst = MSM_BUS_SLAVE_EBI_CH0,
314 .ab = 0,
315 .ib = 0,
316 },
317 {
318 .src = MSM_BUS_MASTER_JPEG_ENC,
319 .dst = MSM_BUS_SLAVE_EBI_CH0,
320 .ab = 540000000,
321 .ib = 1350000000,
322 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800323 {
324 .src = MSM_BUS_MASTER_JPEG_ENC,
325 .dst = MSM_BUS_SLAVE_MM_IMEM,
326 .ab = 43200000,
327 .ib = 69120000,
328 },
329 {
330 .src = MSM_BUS_MASTER_VFE,
331 .dst = MSM_BUS_SLAVE_MM_IMEM,
332 .ab = 43200000,
333 .ib = 69120000,
334 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800335};
336
337static struct msm_bus_vectors cam_zsl_vectors[] = {
338 {
339 .src = MSM_BUS_MASTER_VFE,
340 .dst = MSM_BUS_SLAVE_EBI_CH0,
341 .ab = 302071680,
342 .ib = 1208286720,
343 },
344 {
345 .src = MSM_BUS_MASTER_VPE,
346 .dst = MSM_BUS_SLAVE_EBI_CH0,
347 .ab = 0,
348 .ib = 0,
349 },
350 {
351 .src = MSM_BUS_MASTER_JPEG_ENC,
352 .dst = MSM_BUS_SLAVE_EBI_CH0,
353 .ab = 540000000,
354 .ib = 1350000000,
355 },
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800356 {
357 .src = MSM_BUS_MASTER_JPEG_ENC,
358 .dst = MSM_BUS_SLAVE_MM_IMEM,
359 .ab = 43200000,
360 .ib = 69120000,
361 },
362 {
363 .src = MSM_BUS_MASTER_VFE,
364 .dst = MSM_BUS_SLAVE_MM_IMEM,
365 .ab = 43200000,
366 .ib = 69120000,
367 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800368};
369
370static struct msm_bus_paths cam_bus_client_config[] = {
371 {
372 ARRAY_SIZE(cam_init_vectors),
373 cam_init_vectors,
374 },
375 {
376 ARRAY_SIZE(cam_preview_vectors),
377 cam_preview_vectors,
378 },
379 {
380 ARRAY_SIZE(cam_video_vectors),
381 cam_video_vectors,
382 },
383 {
384 ARRAY_SIZE(cam_snapshot_vectors),
385 cam_snapshot_vectors,
386 },
387 {
388 ARRAY_SIZE(cam_zsl_vectors),
389 cam_zsl_vectors,
390 },
391};
392
393static struct msm_bus_scale_pdata cam_bus_client_pdata = {
394 cam_bus_client_config,
395 ARRAY_SIZE(cam_bus_client_config),
396 .name = "msm_camera",
397};
398
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800399static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800400 {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800401 .csid_core = 0,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530402 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800403 .cam_bus_scale_table = &cam_bus_client_pdata,
404 },
405 {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800406 .csid_core = 1,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530407 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800408 .cam_bus_scale_table = &cam_bus_client_pdata,
409 },
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800410 {
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800411 .csid_core = 2,
Sreesudhan Ramakrish Ramkumar0ce73bc2012-04-17 09:59:29 -0700412 .is_vpe = 1,
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800413 .cam_bus_scale_table = &cam_bus_client_pdata,
414 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800415};
416
Kevin Chaneb6b6072012-01-17 11:54:54 -0800417static struct camera_vreg_t msm_8960_back_cam_vreg[] = {
Kevin Chaneb6b6072012-01-17 11:54:54 -0800418 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800419 {"cam_vio", REG_VS, 0, 0, 0},
420 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800421 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
422};
423
424static struct camera_vreg_t msm_8960_front_cam_vreg[] = {
Kevin Chaneb6b6072012-01-17 11:54:54 -0800425 {"cam_vio", REG_VS, 0, 0, 0},
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800426 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800427 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
428};
429
430static struct gpio msm8960_common_cam_gpio[] = {
431 {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
432 {20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
433 {21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
434};
435
436static struct gpio msm8960_front_cam_gpio[] = {
437 {76, GPIOF_DIR_OUT, "CAM_RESET"},
438};
439
440static struct gpio msm8960_back_cam_gpio[] = {
441 {107, GPIOF_DIR_OUT, "CAM_RESET"},
442};
443
444static struct msm_gpio_set_tbl msm8960_front_cam_gpio_set_tbl[] = {
445 {76, GPIOF_OUT_INIT_LOW, 1000},
446 {76, GPIOF_OUT_INIT_HIGH, 4000},
447};
448
449static struct msm_gpio_set_tbl msm8960_back_cam_gpio_set_tbl[] = {
450 {107, GPIOF_OUT_INIT_LOW, 1000},
451 {107, GPIOF_OUT_INIT_HIGH, 4000},
452};
453
454static struct msm_camera_gpio_conf msm_8960_front_cam_gpio_conf = {
455 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
456 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
457 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
458 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
459 .cam_gpio_req_tbl = msm8960_front_cam_gpio,
460 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio),
461 .cam_gpio_set_tbl = msm8960_front_cam_gpio_set_tbl,
462 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio_set_tbl),
463};
464
465static struct msm_camera_gpio_conf msm_8960_back_cam_gpio_conf = {
466 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
467 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
468 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
469 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
470 .cam_gpio_req_tbl = msm8960_back_cam_gpio,
471 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio),
472 .cam_gpio_set_tbl = msm8960_back_cam_gpio_set_tbl,
473 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio_set_tbl),
474};
475
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800476static struct i2c_board_info msm_act_main_cam_i2c_info = {
477 I2C_BOARD_INFO("msm_actuator", 0x11),
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800478};
479
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800480static struct msm_actuator_info msm_act_main_cam_0_info = {
481 .board_info = &msm_act_main_cam_i2c_info,
482 .cam_name = MSM_ACTUATOR_MAIN_CAM_0,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800483 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
484 .vcm_pwd = 0,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800485 .vcm_enable = 0,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800486};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800487
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700488static struct i2c_board_info msm_act_main_cam1_i2c_info = {
489 I2C_BOARD_INFO("msm_actuator", 0x18),
490};
491
492static struct msm_actuator_info msm_act_main_cam_1_info = {
493 .board_info = &msm_act_main_cam1_i2c_info,
494 .cam_name = MSM_ACTUATOR_MAIN_CAM_1,
495 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
496 .vcm_pwd = 0,
497 .vcm_enable = 0,
498};
499
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800500static struct msm_camera_sensor_flash_data flash_imx074 = {
501 .flash_type = MSM_CAMERA_FLASH_LED,
502#ifdef CONFIG_MSM_CAMERA_FLASH
503 .flash_src = &msm_flash_src
504#endif
505};
506
Hody Hung9ba65cf2012-01-17 17:34:51 -0800507static struct msm_camera_csi_lane_params imx074_csi_lane_params = {
508 .csi_lane_assign = 0xE4,
509 .csi_lane_mask = 0xF,
510};
511
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800512static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
513 .mount_angle = 90,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800514 .cam_vreg = msm_8960_back_cam_vreg,
515 .num_vreg = ARRAY_SIZE(msm_8960_back_cam_vreg),
516 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800517 .csi_lane_params = &imx074_csi_lane_params,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800518};
519
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700520static struct i2c_board_info imx074_eeprom_i2c_info = {
521 I2C_BOARD_INFO("imx074_eeprom", 0x34 << 1),
522};
523
524static struct msm_eeprom_info imx074_eeprom_info = {
525 .board_info = &imx074_eeprom_i2c_info,
526 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
527};
528
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800529static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
530 .sensor_name = "imx074",
531 .pdata = &msm_camera_csi_device_data[0],
532 .flash_data = &flash_imx074,
533 .strobe_flash_data = &strobe_flash_xenon,
534 .sensor_platform_info = &sensor_board_info_imx074,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800535 .csi_if = 1,
536 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530537 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800538 .actuator_info = &msm_act_main_cam_0_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700539 .eeprom_info = &imx074_eeprom_info,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800540};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800541
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800542static struct camera_vreg_t msm_8960_mt9m114_vreg[] = {
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800543 {"cam_vio", REG_VS, 0, 0, 0},
544 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
545 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
546 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
547};
548
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800549static struct msm_camera_sensor_flash_data flash_mt9m114 = {
550 .flash_type = MSM_CAMERA_FLASH_NONE
551};
552
Hody Hung9ba65cf2012-01-17 17:34:51 -0800553static struct msm_camera_csi_lane_params mt9m114_csi_lane_params = {
554 .csi_lane_assign = 0xE4,
555 .csi_lane_mask = 0x1,
556};
557
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800558static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = {
559 .mount_angle = 90,
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800560 .cam_vreg = msm_8960_mt9m114_vreg,
561 .num_vreg = ARRAY_SIZE(msm_8960_mt9m114_vreg),
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800562 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800563 .csi_lane_params = &mt9m114_csi_lane_params,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800564};
565
566static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = {
567 .sensor_name = "mt9m114",
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800568 .pdata = &msm_camera_csi_device_data[1],
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800569 .flash_data = &flash_mt9m114,
570 .sensor_platform_info = &sensor_board_info_mt9m114,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800571 .csi_if = 1,
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800572 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530573 .sensor_type = YUV_SENSOR,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800574};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800575
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800576static struct msm_camera_sensor_flash_data flash_ov2720 = {
577 .flash_type = MSM_CAMERA_FLASH_NONE,
578};
579
Hody Hung9ba65cf2012-01-17 17:34:51 -0800580static struct msm_camera_csi_lane_params ov2720_csi_lane_params = {
581 .csi_lane_assign = 0xE4,
582 .csi_lane_mask = 0x3,
583};
584
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800585static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
586 .mount_angle = 0,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800587 .cam_vreg = msm_8960_front_cam_vreg,
588 .num_vreg = ARRAY_SIZE(msm_8960_front_cam_vreg),
589 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800590 .csi_lane_params = &ov2720_csi_lane_params,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800591};
592
593static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
594 .sensor_name = "ov2720",
595 .pdata = &msm_camera_csi_device_data[1],
596 .flash_data = &flash_ov2720,
597 .sensor_platform_info = &sensor_board_info_ov2720,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800598 .csi_if = 1,
599 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530600 .sensor_type = BAYER_SENSOR,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800601};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800602
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800603static struct camera_vreg_t msm_8960_s5k3l1yx_vreg[] = {
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800604 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
605 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
606 {"cam_vio", REG_VS, 0, 0, 0},
607 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
608};
609
610static struct msm_camera_sensor_flash_data flash_s5k3l1yx = {
611 .flash_type = MSM_CAMERA_FLASH_NONE,
612};
613
Hody Hung9ba65cf2012-01-17 17:34:51 -0800614static struct msm_camera_csi_lane_params s5k3l1yx_csi_lane_params = {
615 .csi_lane_assign = 0xE4,
616 .csi_lane_mask = 0xF,
617};
618
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800619static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = {
620 .mount_angle = 0,
621 .cam_vreg = msm_8960_s5k3l1yx_vreg,
622 .num_vreg = ARRAY_SIZE(msm_8960_s5k3l1yx_vreg),
623 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800624 .csi_lane_params = &s5k3l1yx_csi_lane_params,
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800625};
626
Rajakumar Govindaram18ef38e2012-04-23 10:45:21 -0700627static struct msm_actuator_info msm_act_main_cam_2_info = {
628 .board_info = &msm_act_main_cam_i2c_info,
629 .cam_name = MSM_ACTUATOR_MAIN_CAM_2,
630 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
631 .vcm_pwd = 0,
632 .vcm_enable = 0,
633};
634
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800635static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = {
636 .sensor_name = "s5k3l1yx",
637 .pdata = &msm_camera_csi_device_data[0],
638 .flash_data = &flash_s5k3l1yx,
639 .sensor_platform_info = &sensor_board_info_s5k3l1yx,
640 .csi_if = 1,
641 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530642 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram18ef38e2012-04-23 10:45:21 -0700643 .actuator_info = &msm_act_main_cam_2_info,
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800644};
645
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800646static struct msm_camera_csi_lane_params imx091_csi_lane_params = {
647 .csi_lane_assign = 0xE4,
648 .csi_lane_mask = 0xF,
649};
650
651static struct camera_vreg_t msm_8960_imx091_vreg[] = {
652 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
653 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
654 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
655 {"cam_vio", REG_VS, 0, 0, 0},
656};
657
658static struct msm_camera_sensor_flash_data flash_imx091 = {
Sreesudhan Ramakrish Ramkumar6c56b612012-04-17 18:14:13 -0700659 .flash_type = MSM_CAMERA_FLASH_LED,
660#ifdef CONFIG_MSM_CAMERA_FLASH
661 .flash_src = &msm_flash_src
662#endif
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800663};
664
665static struct msm_camera_sensor_platform_info sensor_board_info_imx091 = {
666 .mount_angle = 0,
667 .cam_vreg = msm_8960_imx091_vreg,
668 .num_vreg = ARRAY_SIZE(msm_8960_imx091_vreg),
669 .gpio_conf = &msm_8960_back_cam_gpio_conf,
670 .csi_lane_params = &imx091_csi_lane_params,
671};
672
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700673static struct i2c_board_info imx091_eeprom_i2c_info = {
674 I2C_BOARD_INFO("imx091_eeprom", 0x21),
675};
676
677static struct msm_eeprom_info imx091_eeprom_info = {
678 .board_info = &imx091_eeprom_i2c_info,
679 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
680};
681
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800682static struct msm_camera_sensor_info msm_camera_sensor_imx091_data = {
683 .sensor_name = "imx091",
684 .pdata = &msm_camera_csi_device_data[0],
685 .flash_data = &flash_imx091,
686 .sensor_platform_info = &sensor_board_info_imx091,
687 .csi_if = 1,
688 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530689 .sensor_type = BAYER_SENSOR,
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700690 .actuator_info = &msm_act_main_cam_1_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700691 .eeprom_info = &imx091_eeprom_info,
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800692};
693
Kevin Chaneb6b6072012-01-17 11:54:54 -0800694static struct pm8xxx_mpp_config_data privacy_light_on_config = {
695 .type = PM8XXX_MPP_TYPE_SINK,
696 .level = PM8XXX_MPP_CS_OUT_5MA,
697 .control = PM8XXX_MPP_CS_CTRL_MPP_LOW_EN,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800698};
699
Kevin Chaneb6b6072012-01-17 11:54:54 -0800700static struct pm8xxx_mpp_config_data privacy_light_off_config = {
701 .type = PM8XXX_MPP_TYPE_SINK,
702 .level = PM8XXX_MPP_CS_OUT_5MA,
703 .control = PM8XXX_MPP_CS_CTRL_DISABLE,
704};
705
706static int32_t msm_camera_8960_ext_power_ctrl(int enable)
707{
708 int rc = 0;
709 if (enable) {
710 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
711 &privacy_light_on_config);
712 } else {
713 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
714 &privacy_light_off_config);
715 }
716 return rc;
717}
718
Kevin Chan94b4c832012-03-02 21:27:16 -0800719static struct platform_device msm_camera_server = {
720 .name = "msm_cam_server",
721 .id = 0,
722};
723
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800724void __init msm8960_init_cam(void)
725{
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800726 msm_gpiomux_install(msm8960_cam_common_configs,
727 ARRAY_SIZE(msm8960_cam_common_configs));
728
Kevin Chancfab2f72011-12-02 13:05:51 -0800729 if (machine_is_msm8960_cdp()) {
730 msm_gpiomux_install(msm8960_cdp_flash_configs,
731 ARRAY_SIZE(msm8960_cdp_flash_configs));
732 msm_flash_src._fsrc.ext_driver_src.led_en =
733 GPIO_CAM_GP_LED_EN1;
734 msm_flash_src._fsrc.ext_driver_src.led_flash_en =
735 GPIO_CAM_GP_LED_EN2;
736 #if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
737 defined(CONFIG_GPIO_SX150X_MODULE))
738 msm_flash_src._fsrc.ext_driver_src.expander_info =
739 cam_expander_info;
740 #endif
741 }
742
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800743 if (machine_is_msm8960_liquid()) {
744 struct msm_camera_sensor_info *s_info;
Kevin Chan09f4e662011-12-16 08:17:02 -0800745 s_info = &msm_camera_sensor_imx074_data;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800746 s_info->sensor_platform_info->mount_angle = 180;
Kevin Chan09f4e662011-12-16 08:17:02 -0800747 s_info = &msm_camera_sensor_ov2720_data;
Kevin Chaneb6b6072012-01-17 11:54:54 -0800748 s_info->sensor_platform_info->ext_power_ctrl =
749 msm_camera_8960_ext_power_ctrl;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800750 }
751
Sreesudhan Ramakrish Ramkumar51f8df12012-05-01 22:21:48 -0700752 if (machine_is_msm8960_fluid()) {
753 msm_camera_sensor_imx091_data.sensor_platform_info->
754 mount_angle = 270;
755 }
756
Kevin Chan94b4c832012-03-02 21:27:16 -0800757 platform_device_register(&msm_camera_server);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800758 platform_device_register(&msm8960_device_csiphy0);
759 platform_device_register(&msm8960_device_csiphy1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800760 platform_device_register(&msm8960_device_csiphy2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800761 platform_device_register(&msm8960_device_csid0);
762 platform_device_register(&msm8960_device_csid1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800763 platform_device_register(&msm8960_device_csid2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800764 platform_device_register(&msm8960_device_ispif);
765 platform_device_register(&msm8960_device_vfe);
766 platform_device_register(&msm8960_device_vpe);
767}
Kevin Chan09f4e662011-12-16 08:17:02 -0800768
769#ifdef CONFIG_I2C
770static struct i2c_board_info msm8960_camera_i2c_boardinfo[] = {
Kevin Chan09f4e662011-12-16 08:17:02 -0800771 {
772 I2C_BOARD_INFO("imx074", 0x1A),
773 .platform_data = &msm_camera_sensor_imx074_data,
774 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800775 {
776 I2C_BOARD_INFO("ov2720", 0x6C),
777 .platform_data = &msm_camera_sensor_ov2720_data,
778 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800779 {
780 I2C_BOARD_INFO("mt9m114", 0x48),
781 .platform_data = &msm_camera_sensor_mt9m114_data,
782 },
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800783 {
784 I2C_BOARD_INFO("s5k3l1yx", 0x20),
785 .platform_data = &msm_camera_sensor_s5k3l1yx_data,
786 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800787#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
788 {
789 I2C_BOARD_INFO("sc628a", 0x6E),
790 },
791#endif
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800792 {
793 I2C_BOARD_INFO("imx091", 0x34),
794 .platform_data = &msm_camera_sensor_imx091_data,
795 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800796};
797
798struct msm_camera_board_info msm8960_camera_board_info = {
799 .board_info = msm8960_camera_i2c_boardinfo,
800 .num_i2c_board_info = ARRAY_SIZE(msm8960_camera_i2c_boardinfo),
801};
802#endif
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800803#endif