blob: 9bb6e0931b0f378d9342fd430164559e97206967 [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>
Jack Wangb88c8c22012-07-26 11:33:36 -070016#include <mach/camera.h>
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080017#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,
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700275 .ab = 274406400,
Mingcheng Zhud5ec60e2011-12-16 23:02:53 -0800276 .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
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700370static struct msm_bus_vectors cam_video_ls_vectors[] = {
371 {
372 .src = MSM_BUS_MASTER_VFE,
373 .dst = MSM_BUS_SLAVE_EBI_CH0,
374 .ab = 348192000,
375 .ib = 617103360,
376 },
377 {
378 .src = MSM_BUS_MASTER_VPE,
379 .dst = MSM_BUS_SLAVE_EBI_CH0,
380 .ab = 206807040,
381 .ib = 488816640,
382 },
383 {
384 .src = MSM_BUS_MASTER_JPEG_ENC,
385 .dst = MSM_BUS_SLAVE_EBI_CH0,
386 .ab = 540000000,
387 .ib = 1350000000,
388 },
389 {
390 .src = MSM_BUS_MASTER_JPEG_ENC,
391 .dst = MSM_BUS_SLAVE_MM_IMEM,
392 .ab = 0,
393 .ib = 0,
394 },
395 {
396 .src = MSM_BUS_MASTER_VFE,
397 .dst = MSM_BUS_SLAVE_MM_IMEM,
398 .ab = 0,
399 .ib = 0,
400 },
401};
402
Nishant Pandit221a9482012-09-03 05:36:04 +0530403static struct msm_bus_vectors cam_dual_vectors[] = {
404 {
405 .src = MSM_BUS_MASTER_VFE,
406 .dst = MSM_BUS_SLAVE_EBI_CH0,
407 .ab = 348192000,
408 .ib = 1208286720,
409 },
410 {
411 .src = MSM_BUS_MASTER_VPE,
412 .dst = MSM_BUS_SLAVE_EBI_CH0,
413 .ab = 206807040,
414 .ib = 488816640,
415 },
416 {
417 .src = MSM_BUS_MASTER_JPEG_ENC,
418 .dst = MSM_BUS_SLAVE_EBI_CH0,
419 .ab = 540000000,
420 .ib = 1350000000,
421 },
422 {
423 .src = MSM_BUS_MASTER_JPEG_ENC,
424 .dst = MSM_BUS_SLAVE_MM_IMEM,
425 .ab = 43200000,
426 .ib = 69120000,
427 },
428 {
429 .src = MSM_BUS_MASTER_VFE,
430 .dst = MSM_BUS_SLAVE_MM_IMEM,
431 .ab = 43200000,
432 .ib = 69120000,
433 },
434};
435
436
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700437
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800438static struct msm_bus_paths cam_bus_client_config[] = {
439 {
440 ARRAY_SIZE(cam_init_vectors),
441 cam_init_vectors,
442 },
443 {
444 ARRAY_SIZE(cam_preview_vectors),
445 cam_preview_vectors,
446 },
447 {
448 ARRAY_SIZE(cam_video_vectors),
449 cam_video_vectors,
450 },
451 {
452 ARRAY_SIZE(cam_snapshot_vectors),
453 cam_snapshot_vectors,
454 },
455 {
456 ARRAY_SIZE(cam_zsl_vectors),
457 cam_zsl_vectors,
458 },
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700459 {
460 ARRAY_SIZE(cam_video_ls_vectors),
461 cam_video_ls_vectors,
462 },
Nishant Pandit221a9482012-09-03 05:36:04 +0530463 {
464 ARRAY_SIZE(cam_dual_vectors),
465 cam_dual_vectors,
466 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800467};
468
469static struct msm_bus_scale_pdata cam_bus_client_pdata = {
470 cam_bus_client_config,
471 ARRAY_SIZE(cam_bus_client_config),
472 .name = "msm_camera",
473};
474
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800475static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800476 {
Sreesudhan Ramakrish Ramkumar5ad18cd2012-09-07 23:22:34 -0700477 .csiphy_core = 0,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800478 .csid_core = 0,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530479 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800480 .cam_bus_scale_table = &cam_bus_client_pdata,
481 },
482 {
Sreesudhan Ramakrish Ramkumar5ad18cd2012-09-07 23:22:34 -0700483 .csiphy_core = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800484 .csid_core = 1,
Suresh Vankadara8df2c752012-01-18 00:18:03 +0530485 .is_vpe = 1,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800486 .cam_bus_scale_table = &cam_bus_client_pdata,
487 },
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800488 {
Sreesudhan Ramakrish Ramkumar5ad18cd2012-09-07 23:22:34 -0700489 .csiphy_core = 2,
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800490 .csid_core = 2,
Sreesudhan Ramakrish Ramkumar0ce73bc2012-04-17 09:59:29 -0700491 .is_vpe = 1,
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800492 .cam_bus_scale_table = &cam_bus_client_pdata,
493 },
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800494};
495
Sreesudhan Ramakrish Ramkumar923fbad2012-07-26 17:31:42 -0700496static struct camera_vreg_t msm_8960_cam_vreg[] = {
Kevin Chaneb6b6072012-01-17 11:54:54 -0800497 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
Sreesudhan Ramakrish Ramkumarec27a6e2012-02-11 20:41:19 -0800498 {"cam_vio", REG_VS, 0, 0, 0},
499 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800500 {"cam_vaf", REG_LDO, 2800000, 2800000, 300000},
501};
502
Kevin Chaneb6b6072012-01-17 11:54:54 -0800503static struct gpio msm8960_common_cam_gpio[] = {
504 {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
505 {20, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
506 {21, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
507};
508
509static struct gpio msm8960_front_cam_gpio[] = {
510 {76, GPIOF_DIR_OUT, "CAM_RESET"},
511};
512
513static struct gpio msm8960_back_cam_gpio[] = {
514 {107, GPIOF_DIR_OUT, "CAM_RESET"},
515};
516
517static struct msm_gpio_set_tbl msm8960_front_cam_gpio_set_tbl[] = {
518 {76, GPIOF_OUT_INIT_LOW, 1000},
519 {76, GPIOF_OUT_INIT_HIGH, 4000},
520};
521
522static struct msm_gpio_set_tbl msm8960_back_cam_gpio_set_tbl[] = {
523 {107, GPIOF_OUT_INIT_LOW, 1000},
524 {107, GPIOF_OUT_INIT_HIGH, 4000},
525};
526
527static struct msm_camera_gpio_conf msm_8960_front_cam_gpio_conf = {
528 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
529 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
530 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
531 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
532 .cam_gpio_req_tbl = msm8960_front_cam_gpio,
533 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio),
534 .cam_gpio_set_tbl = msm8960_front_cam_gpio_set_tbl,
535 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_front_cam_gpio_set_tbl),
536};
537
538static struct msm_camera_gpio_conf msm_8960_back_cam_gpio_conf = {
539 .cam_gpiomux_conf_tbl = msm8960_cam_2d_configs,
540 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(msm8960_cam_2d_configs),
541 .cam_gpio_common_tbl = msm8960_common_cam_gpio,
542 .cam_gpio_common_tbl_size = ARRAY_SIZE(msm8960_common_cam_gpio),
543 .cam_gpio_req_tbl = msm8960_back_cam_gpio,
544 .cam_gpio_req_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio),
545 .cam_gpio_set_tbl = msm8960_back_cam_gpio_set_tbl,
546 .cam_gpio_set_tbl_size = ARRAY_SIZE(msm8960_back_cam_gpio_set_tbl),
547};
548
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800549static struct i2c_board_info msm_act_main_cam_i2c_info = {
550 I2C_BOARD_INFO("msm_actuator", 0x11),
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800551};
552
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800553static struct msm_actuator_info msm_act_main_cam_0_info = {
554 .board_info = &msm_act_main_cam_i2c_info,
555 .cam_name = MSM_ACTUATOR_MAIN_CAM_0,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800556 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
557 .vcm_pwd = 0,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800558 .vcm_enable = 0,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800559};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800560
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700561static struct i2c_board_info msm_act_main_cam1_i2c_info = {
562 I2C_BOARD_INFO("msm_actuator", 0x18),
563};
564
565static struct msm_actuator_info msm_act_main_cam_1_info = {
566 .board_info = &msm_act_main_cam1_i2c_info,
567 .cam_name = MSM_ACTUATOR_MAIN_CAM_1,
568 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
569 .vcm_pwd = 0,
570 .vcm_enable = 0,
571};
572
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800573static struct msm_camera_sensor_flash_data flash_imx074 = {
574 .flash_type = MSM_CAMERA_FLASH_LED,
575#ifdef CONFIG_MSM_CAMERA_FLASH
576 .flash_src = &msm_flash_src
577#endif
578};
579
Hody Hung9ba65cf2012-01-17 17:34:51 -0800580static struct msm_camera_csi_lane_params imx074_csi_lane_params = {
581 .csi_lane_assign = 0xE4,
582 .csi_lane_mask = 0xF,
583};
584
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800585static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
586 .mount_angle = 90,
Sreesudhan Ramakrish Ramkumar923fbad2012-07-26 17:31:42 -0700587 .cam_vreg = msm_8960_cam_vreg,
588 .num_vreg = ARRAY_SIZE(msm_8960_cam_vreg),
Kevin Chaneb6b6072012-01-17 11:54:54 -0800589 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800590 .csi_lane_params = &imx074_csi_lane_params,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800591};
592
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700593static struct i2c_board_info imx074_eeprom_i2c_info = {
594 I2C_BOARD_INFO("imx074_eeprom", 0x34 << 1),
595};
596
597static struct msm_eeprom_info imx074_eeprom_info = {
598 .board_info = &imx074_eeprom_i2c_info,
599 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
600};
601
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800602static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
603 .sensor_name = "imx074",
604 .pdata = &msm_camera_csi_device_data[0],
605 .flash_data = &flash_imx074,
606 .strobe_flash_data = &strobe_flash_xenon,
607 .sensor_platform_info = &sensor_board_info_imx074,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800608 .csi_if = 1,
609 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530610 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800611 .actuator_info = &msm_act_main_cam_0_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700612 .eeprom_info = &imx074_eeprom_info,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800613};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800614
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800615static struct msm_camera_sensor_flash_data flash_mt9m114 = {
616 .flash_type = MSM_CAMERA_FLASH_NONE
617};
618
Hody Hung9ba65cf2012-01-17 17:34:51 -0800619static struct msm_camera_csi_lane_params mt9m114_csi_lane_params = {
620 .csi_lane_assign = 0xE4,
621 .csi_lane_mask = 0x1,
622};
623
Jack Wangb88c8c22012-07-26 11:33:36 -0700624static struct camera_vreg_t mt9m114_cam_vreg[] = {
625 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000, 50},
626 {"cam_vio", REG_VS, 0, 0, 0, 50},
627 {"cam_vana", REG_LDO, 2800000, 2850000, 85600, 50},
628};
629
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800630static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = {
631 .mount_angle = 90,
Jack Wangb88c8c22012-07-26 11:33:36 -0700632 .cam_vreg = mt9m114_cam_vreg,
633 .num_vreg = ARRAY_SIZE(mt9m114_cam_vreg),
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800634 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800635 .csi_lane_params = &mt9m114_csi_lane_params,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800636};
637
638static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = {
639 .sensor_name = "mt9m114",
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800640 .pdata = &msm_camera_csi_device_data[1],
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800641 .flash_data = &flash_mt9m114,
642 .sensor_platform_info = &sensor_board_info_mt9m114,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800643 .csi_if = 1,
Sreesudhan Ramakrish Ramkumar61c877d2012-02-23 22:22:19 -0800644 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530645 .sensor_type = YUV_SENSOR,
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800646};
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800647
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800648static struct msm_camera_sensor_flash_data flash_ov2720 = {
649 .flash_type = MSM_CAMERA_FLASH_NONE,
650};
651
Hody Hung9ba65cf2012-01-17 17:34:51 -0800652static struct msm_camera_csi_lane_params ov2720_csi_lane_params = {
653 .csi_lane_assign = 0xE4,
654 .csi_lane_mask = 0x3,
655};
656
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800657static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
658 .mount_angle = 0,
Sreesudhan Ramakrish Ramkumar923fbad2012-07-26 17:31:42 -0700659 .cam_vreg = msm_8960_cam_vreg,
660 .num_vreg = ARRAY_SIZE(msm_8960_cam_vreg),
Kevin Chaneb6b6072012-01-17 11:54:54 -0800661 .gpio_conf = &msm_8960_front_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800662 .csi_lane_params = &ov2720_csi_lane_params,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800663};
664
665static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
666 .sensor_name = "ov2720",
667 .pdata = &msm_camera_csi_device_data[1],
668 .flash_data = &flash_ov2720,
669 .sensor_platform_info = &sensor_board_info_ov2720,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800670 .csi_if = 1,
671 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530672 .sensor_type = BAYER_SENSOR,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800673};
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800674
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800675static struct msm_camera_sensor_flash_data flash_s5k3l1yx = {
676 .flash_type = MSM_CAMERA_FLASH_NONE,
677};
678
Hody Hung9ba65cf2012-01-17 17:34:51 -0800679static struct msm_camera_csi_lane_params s5k3l1yx_csi_lane_params = {
680 .csi_lane_assign = 0xE4,
681 .csi_lane_mask = 0xF,
682};
683
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800684static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = {
685 .mount_angle = 0,
Sreesudhan Ramakrish Ramkumar923fbad2012-07-26 17:31:42 -0700686 .cam_vreg = msm_8960_cam_vreg,
687 .num_vreg = ARRAY_SIZE(msm_8960_cam_vreg),
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800688 .gpio_conf = &msm_8960_back_cam_gpio_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800689 .csi_lane_params = &s5k3l1yx_csi_lane_params,
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800690};
691
Rajakumar Govindaram18ef38e2012-04-23 10:45:21 -0700692static struct msm_actuator_info msm_act_main_cam_2_info = {
693 .board_info = &msm_act_main_cam_i2c_info,
694 .cam_name = MSM_ACTUATOR_MAIN_CAM_2,
695 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
696 .vcm_pwd = 0,
697 .vcm_enable = 0,
698};
699
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800700static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = {
701 .sensor_name = "s5k3l1yx",
702 .pdata = &msm_camera_csi_device_data[0],
703 .flash_data = &flash_s5k3l1yx,
704 .sensor_platform_info = &sensor_board_info_s5k3l1yx,
705 .csi_if = 1,
706 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530707 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram18ef38e2012-04-23 10:45:21 -0700708 .actuator_info = &msm_act_main_cam_2_info,
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800709};
710
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800711static struct msm_camera_csi_lane_params imx091_csi_lane_params = {
712 .csi_lane_assign = 0xE4,
713 .csi_lane_mask = 0xF,
714};
715
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800716static struct msm_camera_sensor_flash_data flash_imx091 = {
Sreesudhan Ramakrish Ramkumar6c56b612012-04-17 18:14:13 -0700717 .flash_type = MSM_CAMERA_FLASH_LED,
718#ifdef CONFIG_MSM_CAMERA_FLASH
719 .flash_src = &msm_flash_src
720#endif
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800721};
722
723static struct msm_camera_sensor_platform_info sensor_board_info_imx091 = {
724 .mount_angle = 0,
Sreesudhan Ramakrish Ramkumar923fbad2012-07-26 17:31:42 -0700725 .cam_vreg = msm_8960_cam_vreg,
726 .num_vreg = ARRAY_SIZE(msm_8960_cam_vreg),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800727 .gpio_conf = &msm_8960_back_cam_gpio_conf,
728 .csi_lane_params = &imx091_csi_lane_params,
729};
730
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700731static struct i2c_board_info imx091_eeprom_i2c_info = {
732 I2C_BOARD_INFO("imx091_eeprom", 0x21),
733};
734
735static struct msm_eeprom_info imx091_eeprom_info = {
736 .board_info = &imx091_eeprom_i2c_info,
737 .bus_id = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
Jack Wangb88c8c22012-07-26 11:33:36 -0700738 .eeprom_i2c_slave_addr = 0xA1,
739 .eeprom_reg_addr = 0x05,
740 .eeprom_read_length = 6,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700741};
742
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800743static struct msm_camera_sensor_info msm_camera_sensor_imx091_data = {
744 .sensor_name = "imx091",
745 .pdata = &msm_camera_csi_device_data[0],
746 .flash_data = &flash_imx091,
747 .sensor_platform_info = &sensor_board_info_imx091,
748 .csi_if = 1,
749 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530750 .sensor_type = BAYER_SENSOR,
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700751 .actuator_info = &msm_act_main_cam_1_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700752 .eeprom_info = &imx091_eeprom_info,
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800753};
754
Kevin Chaneb6b6072012-01-17 11:54:54 -0800755static struct pm8xxx_mpp_config_data privacy_light_on_config = {
756 .type = PM8XXX_MPP_TYPE_SINK,
757 .level = PM8XXX_MPP_CS_OUT_5MA,
758 .control = PM8XXX_MPP_CS_CTRL_MPP_LOW_EN,
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800759};
760
Kevin Chaneb6b6072012-01-17 11:54:54 -0800761static struct pm8xxx_mpp_config_data privacy_light_off_config = {
762 .type = PM8XXX_MPP_TYPE_SINK,
763 .level = PM8XXX_MPP_CS_OUT_5MA,
764 .control = PM8XXX_MPP_CS_CTRL_DISABLE,
765};
766
767static int32_t msm_camera_8960_ext_power_ctrl(int enable)
768{
769 int rc = 0;
770 if (enable) {
771 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
772 &privacy_light_on_config);
773 } else {
774 rc = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(12),
775 &privacy_light_off_config);
776 }
777 return rc;
778}
779
Kevin Chan94b4c832012-03-02 21:27:16 -0800780static struct platform_device msm_camera_server = {
781 .name = "msm_cam_server",
782 .id = 0,
783};
784
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800785void __init msm8960_init_cam(void)
786{
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800787 msm_gpiomux_install(msm8960_cam_common_configs,
788 ARRAY_SIZE(msm8960_cam_common_configs));
789
Kevin Chancfab2f72011-12-02 13:05:51 -0800790 if (machine_is_msm8960_cdp()) {
791 msm_gpiomux_install(msm8960_cdp_flash_configs,
792 ARRAY_SIZE(msm8960_cdp_flash_configs));
793 msm_flash_src._fsrc.ext_driver_src.led_en =
794 GPIO_CAM_GP_LED_EN1;
795 msm_flash_src._fsrc.ext_driver_src.led_flash_en =
796 GPIO_CAM_GP_LED_EN2;
797 #if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
798 defined(CONFIG_GPIO_SX150X_MODULE))
799 msm_flash_src._fsrc.ext_driver_src.expander_info =
800 cam_expander_info;
801 #endif
802 }
803
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800804 if (machine_is_msm8960_liquid()) {
805 struct msm_camera_sensor_info *s_info;
Kevin Chan09f4e662011-12-16 08:17:02 -0800806 s_info = &msm_camera_sensor_imx074_data;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800807 s_info->sensor_platform_info->mount_angle = 180;
Kevin Chan09f4e662011-12-16 08:17:02 -0800808 s_info = &msm_camera_sensor_ov2720_data;
Kevin Chaneb6b6072012-01-17 11:54:54 -0800809 s_info->sensor_platform_info->ext_power_ctrl =
810 msm_camera_8960_ext_power_ctrl;
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800811 }
812
Sreesudhan Ramakrish Ramkumar51f8df12012-05-01 22:21:48 -0700813 if (machine_is_msm8960_fluid()) {
814 msm_camera_sensor_imx091_data.sensor_platform_info->
815 mount_angle = 270;
816 }
817
Kevin Chan94b4c832012-03-02 21:27:16 -0800818 platform_device_register(&msm_camera_server);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800819 platform_device_register(&msm8960_device_csiphy0);
820 platform_device_register(&msm8960_device_csiphy1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800821 platform_device_register(&msm8960_device_csiphy2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800822 platform_device_register(&msm8960_device_csid0);
823 platform_device_register(&msm8960_device_csid1);
Sreesudhan Ramakrish Ramkumarb1edcd02012-01-17 11:33:05 -0800824 platform_device_register(&msm8960_device_csid2);
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800825 platform_device_register(&msm8960_device_ispif);
826 platform_device_register(&msm8960_device_vfe);
827 platform_device_register(&msm8960_device_vpe);
828}
Kevin Chan09f4e662011-12-16 08:17:02 -0800829
830#ifdef CONFIG_I2C
831static struct i2c_board_info msm8960_camera_i2c_boardinfo[] = {
Kevin Chan09f4e662011-12-16 08:17:02 -0800832 {
833 I2C_BOARD_INFO("imx074", 0x1A),
834 .platform_data = &msm_camera_sensor_imx074_data,
835 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800836 {
837 I2C_BOARD_INFO("ov2720", 0x6C),
838 .platform_data = &msm_camera_sensor_ov2720_data,
839 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800840 {
841 I2C_BOARD_INFO("mt9m114", 0x48),
842 .platform_data = &msm_camera_sensor_mt9m114_data,
843 },
Sreesudhan Ramakrish Ramkumar8f11b8b2012-01-04 17:09:05 -0800844 {
845 I2C_BOARD_INFO("s5k3l1yx", 0x20),
846 .platform_data = &msm_camera_sensor_s5k3l1yx_data,
847 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800848#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
849 {
850 I2C_BOARD_INFO("sc628a", 0x6E),
851 },
852#endif
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800853 {
854 I2C_BOARD_INFO("imx091", 0x34),
855 .platform_data = &msm_camera_sensor_imx091_data,
856 },
Kevin Chan09f4e662011-12-16 08:17:02 -0800857};
858
859struct msm_camera_board_info msm8960_camera_board_info = {
860 .board_info = msm8960_camera_i2c_boardinfo,
861 .num_i2c_board_info = ARRAY_SIZE(msm8960_camera_i2c_boardinfo),
862};
863#endif
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800864#endif