blob: da395daf5c2aa81e845f7a0eeadf103f9477ba70 [file] [log] [blame]
Jeyaprakash Soundrapandiana7203372013-01-21 17:57:41 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Kevin Chan412e9f92012-01-24 10:45:23 -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
Kevin Chan412e9f92012-01-24 10:45:23 -080014#include <linux/i2c.h>
Kevin Chaneb6b6072012-01-17 11:54:54 -080015#include <linux/gpio.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016
17#include <asm/mach-types.h>
18
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -080019#include <mach/camera.h>
Kevin Chan412e9f92012-01-24 10:45:23 -080020#include <mach/msm_bus_board.h>
Kevin Chan412e9f92012-01-24 10:45:23 -080021#include <mach/gpiomux.h>
Punit Soni831bfab2013-03-06 15:49:36 -080022#include <mach/socinfo.h>
Kevin Chan412e9f92012-01-24 10:45:23 -080023
24#include "devices.h"
25#include "board-8064.h"
26
Steve Mucklef132c6c2012-06-06 18:30:57 -070027#ifdef CONFIG_MSM_CAMERA
28
Kevin Chan412e9f92012-01-24 10:45:23 -080029static struct gpiomux_setting cam_settings[] = {
30 {
31 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
32 .drv = GPIOMUX_DRV_2MA,
33 .pull = GPIOMUX_PULL_DOWN,
34 },
35
36 {
37 .func = GPIOMUX_FUNC_1, /*active 1*/
38 .drv = GPIOMUX_DRV_2MA,
39 .pull = GPIOMUX_PULL_NONE,
40 },
41
42 {
43 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
44 .drv = GPIOMUX_DRV_2MA,
45 .pull = GPIOMUX_PULL_NONE,
46 },
47
48 {
Kevin Chand07220e2012-02-13 15:52:22 -080049 .func = GPIOMUX_FUNC_2, /*active 3*/
50 .drv = GPIOMUX_DRV_2MA,
Kevin Chan412e9f92012-01-24 10:45:23 -080051 .pull = GPIOMUX_PULL_NONE,
52 },
53
54 {
55 .func = GPIOMUX_FUNC_5, /*active 4*/
56 .drv = GPIOMUX_DRV_8MA,
57 .pull = GPIOMUX_PULL_UP,
58 },
59
60 {
61 .func = GPIOMUX_FUNC_6, /*active 5*/
62 .drv = GPIOMUX_DRV_8MA,
63 .pull = GPIOMUX_PULL_UP,
64 },
65
66 {
67 .func = GPIOMUX_FUNC_2, /*active 6*/
68 .drv = GPIOMUX_DRV_2MA,
69 .pull = GPIOMUX_PULL_UP,
70 },
71
72 {
73 .func = GPIOMUX_FUNC_3, /*active 7*/
74 .drv = GPIOMUX_DRV_8MA,
75 .pull = GPIOMUX_PULL_UP,
76 },
77
78 {
79 .func = GPIOMUX_FUNC_GPIO, /*i2c suspend*/
80 .drv = GPIOMUX_DRV_2MA,
81 .pull = GPIOMUX_PULL_KEEPER,
82 },
83
Kevin Chand07220e2012-02-13 15:52:22 -080084 {
85 .func = GPIOMUX_FUNC_9, /*active 9*/
86 .drv = GPIOMUX_DRV_8MA,
87 .pull = GPIOMUX_PULL_NONE,
88 },
89 {
90 .func = GPIOMUX_FUNC_A, /*active 10*/
91 .drv = GPIOMUX_DRV_8MA,
92 .pull = GPIOMUX_PULL_NONE,
93 },
94 {
95 .func = GPIOMUX_FUNC_6, /*active 11*/
96 .drv = GPIOMUX_DRV_8MA,
97 .pull = GPIOMUX_PULL_NONE,
98 },
99 {
100 .func = GPIOMUX_FUNC_4, /*active 12*/
101 .drv = GPIOMUX_DRV_2MA,
102 .pull = GPIOMUX_PULL_NONE,
103 },
104
Kevin Chan412e9f92012-01-24 10:45:23 -0800105};
106
Kevin Chan412e9f92012-01-24 10:45:23 -0800107static struct msm_gpiomux_config apq8064_cam_common_configs[] = {
108 {
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800109 .gpio = 1,
110 .settings = {
111 [GPIOMUX_ACTIVE] = &cam_settings[2],
112 [GPIOMUX_SUSPENDED] = &cam_settings[0],
113 },
114 },
115 {
Kevin Chan412e9f92012-01-24 10:45:23 -0800116 .gpio = 2,
117 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800118 [GPIOMUX_ACTIVE] = &cam_settings[12],
Kevin Chan412e9f92012-01-24 10:45:23 -0800119 [GPIOMUX_SUSPENDED] = &cam_settings[0],
120 },
121 },
122 {
123 .gpio = 3,
124 .settings = {
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800125 [GPIOMUX_ACTIVE] = &cam_settings[2],
Kevin Chan412e9f92012-01-24 10:45:23 -0800126 [GPIOMUX_SUSPENDED] = &cam_settings[0],
127 },
128 },
129 {
130 .gpio = 4,
131 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800132 [GPIOMUX_ACTIVE] = &cam_settings[3],
Kevin Chan412e9f92012-01-24 10:45:23 -0800133 [GPIOMUX_SUSPENDED] = &cam_settings[0],
134 },
135 },
136 {
137 .gpio = 5,
138 .settings = {
139 [GPIOMUX_ACTIVE] = &cam_settings[1],
140 [GPIOMUX_SUSPENDED] = &cam_settings[0],
141 },
142 },
143 {
Kevin Chand07220e2012-02-13 15:52:22 -0800144 .gpio = 34,
Kevin Chan412e9f92012-01-24 10:45:23 -0800145 .settings = {
146 [GPIOMUX_ACTIVE] = &cam_settings[2],
147 [GPIOMUX_SUSPENDED] = &cam_settings[0],
148 },
149 },
150 {
151 .gpio = 107,
152 .settings = {
153 [GPIOMUX_ACTIVE] = &cam_settings[2],
154 [GPIOMUX_SUSPENDED] = &cam_settings[0],
155 },
156 },
Kevin Chan412e9f92012-01-24 10:45:23 -0800157 {
158 .gpio = 10,
159 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800160 [GPIOMUX_ACTIVE] = &cam_settings[9],
Kevin Chan412e9f92012-01-24 10:45:23 -0800161 [GPIOMUX_SUSPENDED] = &cam_settings[8],
162 },
163 },
164 {
165 .gpio = 11,
166 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800167 [GPIOMUX_ACTIVE] = &cam_settings[10],
Kevin Chan412e9f92012-01-24 10:45:23 -0800168 [GPIOMUX_SUSPENDED] = &cam_settings[8],
169 },
170 },
171 {
172 .gpio = 12,
173 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800174 [GPIOMUX_ACTIVE] = &cam_settings[11],
Kevin Chan412e9f92012-01-24 10:45:23 -0800175 [GPIOMUX_SUSPENDED] = &cam_settings[8],
176 },
177 },
178 {
179 .gpio = 13,
180 .settings = {
Kevin Chand07220e2012-02-13 15:52:22 -0800181 [GPIOMUX_ACTIVE] = &cam_settings[11],
Kevin Chan412e9f92012-01-24 10:45:23 -0800182 [GPIOMUX_SUSPENDED] = &cam_settings[8],
183 },
184 },
185};
186
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800187
188#define VFE_CAMIF_TIMER1_GPIO 3
189#define VFE_CAMIF_TIMER2_GPIO 1
190
191static struct msm_camera_sensor_flash_src msm_flash_src = {
192 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
193 ._fsrc.ext_driver_src.led_en = VFE_CAMIF_TIMER1_GPIO,
194 ._fsrc.ext_driver_src.led_flash_en = VFE_CAMIF_TIMER2_GPIO,
Jeyaprakash Soundrapandian85099fe2012-05-15 17:09:51 -0700195 ._fsrc.ext_driver_src.flash_id = MAM_CAMERA_EXT_LED_FLASH_SC628A,
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800196};
197
Kevin Chand07220e2012-02-13 15:52:22 -0800198static struct msm_gpiomux_config apq8064_cam_2d_configs[] = {
199};
200
Kevin Chan412e9f92012-01-24 10:45:23 -0800201static struct msm_bus_vectors cam_init_vectors[] = {
202 {
203 .src = MSM_BUS_MASTER_VFE,
204 .dst = MSM_BUS_SLAVE_EBI_CH0,
205 .ab = 0,
206 .ib = 0,
207 },
208 {
209 .src = MSM_BUS_MASTER_VPE,
210 .dst = MSM_BUS_SLAVE_EBI_CH0,
211 .ab = 0,
212 .ib = 0,
213 },
214 {
215 .src = MSM_BUS_MASTER_JPEG_ENC,
216 .dst = MSM_BUS_SLAVE_EBI_CH0,
217 .ab = 0,
218 .ib = 0,
219 },
220};
221
222static struct msm_bus_vectors cam_preview_vectors[] = {
223 {
224 .src = MSM_BUS_MASTER_VFE,
225 .dst = MSM_BUS_SLAVE_EBI_CH0,
226 .ab = 27648000,
Kiran Kumar H N4c3da4d2013-02-02 12:39:51 -0800227 .ib = 2656000000UL,
Kevin Chan412e9f92012-01-24 10:45:23 -0800228 },
229 {
230 .src = MSM_BUS_MASTER_VPE,
231 .dst = MSM_BUS_SLAVE_EBI_CH0,
232 .ab = 0,
233 .ib = 0,
234 },
235 {
236 .src = MSM_BUS_MASTER_JPEG_ENC,
237 .dst = MSM_BUS_SLAVE_EBI_CH0,
238 .ab = 0,
239 .ib = 0,
240 },
241};
242
243static struct msm_bus_vectors cam_video_vectors[] = {
244 {
245 .src = MSM_BUS_MASTER_VFE,
246 .dst = MSM_BUS_SLAVE_EBI_CH0,
Kiran Kumar H N4c3da4d2013-02-02 12:39:51 -0800247 .ab = 600000000,
248 .ib = 2656000000UL,
Kevin Chan412e9f92012-01-24 10:45:23 -0800249 },
250 {
251 .src = MSM_BUS_MASTER_VPE,
252 .dst = MSM_BUS_SLAVE_EBI_CH0,
253 .ab = 206807040,
254 .ib = 488816640,
255 },
256 {
257 .src = MSM_BUS_MASTER_JPEG_ENC,
258 .dst = MSM_BUS_SLAVE_EBI_CH0,
259 .ab = 0,
260 .ib = 0,
261 },
262};
263
264static struct msm_bus_vectors cam_snapshot_vectors[] = {
265 {
266 .src = MSM_BUS_MASTER_VFE,
267 .dst = MSM_BUS_SLAVE_EBI_CH0,
Kiran Kumar H N4c3da4d2013-02-02 12:39:51 -0800268 .ab = 600000000,
269 .ib = 2656000000UL,
Kevin Chan412e9f92012-01-24 10:45:23 -0800270 },
271 {
272 .src = MSM_BUS_MASTER_VPE,
273 .dst = MSM_BUS_SLAVE_EBI_CH0,
274 .ab = 0,
275 .ib = 0,
276 },
277 {
278 .src = MSM_BUS_MASTER_JPEG_ENC,
279 .dst = MSM_BUS_SLAVE_EBI_CH0,
280 .ab = 540000000,
281 .ib = 1350000000,
282 },
283};
284
285static struct msm_bus_vectors cam_zsl_vectors[] = {
286 {
287 .src = MSM_BUS_MASTER_VFE,
288 .dst = MSM_BUS_SLAVE_EBI_CH0,
Kiran Kumar H N4c3da4d2013-02-02 12:39:51 -0800289 .ab = 600000000,
290 .ib = 2656000000UL,
Kevin Chan412e9f92012-01-24 10:45:23 -0800291 },
292 {
293 .src = MSM_BUS_MASTER_VPE,
294 .dst = MSM_BUS_SLAVE_EBI_CH0,
295 .ab = 0,
296 .ib = 0,
297 },
298 {
299 .src = MSM_BUS_MASTER_JPEG_ENC,
300 .dst = MSM_BUS_SLAVE_EBI_CH0,
301 .ab = 540000000,
302 .ib = 1350000000,
303 },
304};
305
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700306static struct msm_bus_vectors cam_video_ls_vectors[] = {
307 {
308 .src = MSM_BUS_MASTER_VFE,
309 .dst = MSM_BUS_SLAVE_EBI_CH0,
310 .ab = 348192000,
311 .ib = 617103360,
312 },
313 {
314 .src = MSM_BUS_MASTER_VPE,
315 .dst = MSM_BUS_SLAVE_EBI_CH0,
316 .ab = 206807040,
317 .ib = 488816640,
318 },
319 {
320 .src = MSM_BUS_MASTER_JPEG_ENC,
321 .dst = MSM_BUS_SLAVE_EBI_CH0,
322 .ab = 540000000,
323 .ib = 1350000000,
324 },
325};
326
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800327static struct msm_bus_vectors cam_dual_vectors[] = {
328 {
329 .src = MSM_BUS_MASTER_VFE,
330 .dst = MSM_BUS_SLAVE_EBI_CH0,
Kiran Kumar H N4c3da4d2013-02-02 12:39:51 -0800331 .ab = 600000000,
332 .ib = 2656000000UL,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800333 },
334 {
335 .src = MSM_BUS_MASTER_VPE,
336 .dst = MSM_BUS_SLAVE_EBI_CH0,
337 .ab = 206807040,
338 .ib = 488816640,
339 },
340 {
341 .src = MSM_BUS_MASTER_JPEG_ENC,
342 .dst = MSM_BUS_SLAVE_EBI_CH0,
343 .ab = 540000000,
344 .ib = 1350000000,
345 },
346 {
347 .src = MSM_BUS_MASTER_JPEG_ENC,
348 .dst = MSM_BUS_SLAVE_MM_IMEM,
349 .ab = 43200000,
350 .ib = 69120000,
351 },
352 {
353 .src = MSM_BUS_MASTER_VFE,
354 .dst = MSM_BUS_SLAVE_MM_IMEM,
355 .ab = 43200000,
356 .ib = 69120000,
357 },
358};
359
Nishant Panditd74a62d2012-12-13 14:22:31 +0530360static struct msm_bus_vectors cam_low_power_vectors[] = {
361 {
362 .src = MSM_BUS_MASTER_VFE,
363 .dst = MSM_BUS_SLAVE_EBI_CH0,
364 .ab = 1451520,
365 .ib = 3870720,
366 },
367 {
368 .src = MSM_BUS_MASTER_VPE,
369 .dst = MSM_BUS_SLAVE_EBI_CH0,
370 .ab = 0,
371 .ib = 0,
372 },
373 {
374 .src = MSM_BUS_MASTER_JPEG_ENC,
375 .dst = MSM_BUS_SLAVE_EBI_CH0,
376 .ab = 0,
377 .ib = 0,
378 },
379};
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800380
Kevin Chan412e9f92012-01-24 10:45:23 -0800381static struct msm_bus_paths cam_bus_client_config[] = {
382 {
383 ARRAY_SIZE(cam_init_vectors),
384 cam_init_vectors,
385 },
386 {
387 ARRAY_SIZE(cam_preview_vectors),
388 cam_preview_vectors,
389 },
390 {
391 ARRAY_SIZE(cam_video_vectors),
392 cam_video_vectors,
393 },
394 {
395 ARRAY_SIZE(cam_snapshot_vectors),
396 cam_snapshot_vectors,
397 },
398 {
399 ARRAY_SIZE(cam_zsl_vectors),
400 cam_zsl_vectors,
401 },
Kiran Kumar H N1d1d3072012-07-05 13:40:13 -0700402 {
403 ARRAY_SIZE(cam_video_ls_vectors),
404 cam_video_ls_vectors,
405 },
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800406 {
407 ARRAY_SIZE(cam_dual_vectors),
408 cam_dual_vectors,
409 },
Nishant Panditd74a62d2012-12-13 14:22:31 +0530410 {
411 ARRAY_SIZE(cam_low_power_vectors),
412 cam_low_power_vectors,
413 },
Kevin Chan412e9f92012-01-24 10:45:23 -0800414};
415
416static struct msm_bus_scale_pdata cam_bus_client_pdata = {
417 cam_bus_client_config,
418 ARRAY_SIZE(cam_bus_client_config),
419 .name = "msm_camera",
420};
421
422static struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
423 {
Kevin Chan412e9f92012-01-24 10:45:23 -0800424 .csid_core = 0,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800425 .is_vpe = 1,
Kevin Chan412e9f92012-01-24 10:45:23 -0800426 .cam_bus_scale_table = &cam_bus_client_pdata,
427 },
428 {
Kevin Chan412e9f92012-01-24 10:45:23 -0800429 .csid_core = 1,
Kevin Chaneb6b6072012-01-17 11:54:54 -0800430 .is_vpe = 1,
Kevin Chan412e9f92012-01-24 10:45:23 -0800431 .cam_bus_scale_table = &cam_bus_client_pdata,
432 },
433};
434
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800435static struct camera_vreg_t apq_8064_cam_vreg[] = {
Kevin Chaneb6b6072012-01-17 11:54:54 -0800436 {"cam_vdig", REG_LDO, 1200000, 1200000, 105000},
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800437 {"cam_vio", REG_VS, 0, 0, 0},
438 {"cam_vana", REG_LDO, 2800000, 2850000, 85600},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800439 {"cam_vaf", REG_LDO, 2800000, 2850000, 300000},
440};
441
Kevin Chand07220e2012-02-13 15:52:22 -0800442#define CAML_RSTN PM8921_GPIO_PM_TO_SYS(28)
443#define CAMR_RSTN 34
444
Kevin Chaneb6b6072012-01-17 11:54:54 -0800445static struct gpio apq8064_common_cam_gpio[] = {
Kevin Chaneb6b6072012-01-17 11:54:54 -0800446};
447
448static struct gpio apq8064_back_cam_gpio[] = {
Kevin Chand07220e2012-02-13 15:52:22 -0800449 {5, GPIOF_DIR_IN, "CAMIF_MCLK"},
450 {CAML_RSTN, GPIOF_DIR_OUT, "CAM_RESET"},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800451};
452
453static struct msm_gpio_set_tbl apq8064_back_cam_gpio_set_tbl[] = {
Kevin Chand07220e2012-02-13 15:52:22 -0800454 {CAML_RSTN, GPIOF_OUT_INIT_LOW, 10000},
455 {CAML_RSTN, GPIOF_OUT_INIT_HIGH, 10000},
Kevin Chaneb6b6072012-01-17 11:54:54 -0800456};
457
458static struct msm_camera_gpio_conf apq8064_back_cam_gpio_conf = {
459 .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs,
460 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs),
461 .cam_gpio_common_tbl = apq8064_common_cam_gpio,
462 .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio),
463 .cam_gpio_req_tbl = apq8064_back_cam_gpio,
464 .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio),
465 .cam_gpio_set_tbl = apq8064_back_cam_gpio_set_tbl,
466 .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_back_cam_gpio_set_tbl),
467};
468
Kevin Chand07220e2012-02-13 15:52:22 -0800469static struct gpio apq8064_front_cam_gpio[] = {
470 {4, GPIOF_DIR_IN, "CAMIF_MCLK"},
471 {12, GPIOF_DIR_IN, "CAMIF_I2C_DATA"},
472 {13, GPIOF_DIR_IN, "CAMIF_I2C_CLK"},
473 {CAMR_RSTN, GPIOF_DIR_OUT, "CAM_RESET"},
474};
475
476static struct msm_gpio_set_tbl apq8064_front_cam_gpio_set_tbl[] = {
477 {CAMR_RSTN, GPIOF_OUT_INIT_LOW, 10000},
478 {CAMR_RSTN, GPIOF_OUT_INIT_HIGH, 10000},
479};
480
481static struct msm_camera_gpio_conf apq8064_front_cam_gpio_conf = {
482 .cam_gpiomux_conf_tbl = apq8064_cam_2d_configs,
483 .cam_gpiomux_conf_tbl_size = ARRAY_SIZE(apq8064_cam_2d_configs),
484 .cam_gpio_common_tbl = apq8064_common_cam_gpio,
485 .cam_gpio_common_tbl_size = ARRAY_SIZE(apq8064_common_cam_gpio),
486 .cam_gpio_req_tbl = apq8064_front_cam_gpio,
487 .cam_gpio_req_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio),
488 .cam_gpio_set_tbl = apq8064_front_cam_gpio_set_tbl,
489 .cam_gpio_set_tbl_size = ARRAY_SIZE(apq8064_front_cam_gpio_set_tbl),
490};
491
492static struct msm_camera_i2c_conf apq8064_back_cam_i2c_conf = {
493 .use_i2c_mux = 1,
494 .mux_dev = &msm8960_device_i2c_mux_gsbi4,
495 .i2c_mux_mode = MODE_L,
496};
497
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800498static struct i2c_board_info msm_act_main_cam_i2c_info = {
499 I2C_BOARD_INFO("msm_actuator", 0x11),
Jignesh Mehta33394572012-02-21 19:57:41 -0800500};
501
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800502static struct msm_actuator_info msm_act_main_cam_0_info = {
503 .board_info = &msm_act_main_cam_i2c_info,
504 .cam_name = MSM_ACTUATOR_MAIN_CAM_0,
Jignesh Mehta33394572012-02-21 19:57:41 -0800505 .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID,
506 .vcm_pwd = 0,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800507 .vcm_enable = 0,
Jignesh Mehta33394572012-02-21 19:57:41 -0800508};
509
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700510static struct i2c_board_info msm_act_main_cam1_i2c_info = {
511 I2C_BOARD_INFO("msm_actuator", 0x18),
512};
513
514static struct msm_actuator_info msm_act_main_cam_1_info = {
515 .board_info = &msm_act_main_cam1_i2c_info,
516 .cam_name = MSM_ACTUATOR_MAIN_CAM_1,
517 .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID,
518 .vcm_pwd = 0,
519 .vcm_enable = 0,
520};
521
522
Kevin Chand07220e2012-02-13 15:52:22 -0800523static struct msm_camera_i2c_conf apq8064_front_cam_i2c_conf = {
524 .use_i2c_mux = 1,
525 .mux_dev = &msm8960_device_i2c_mux_gsbi4,
526 .i2c_mux_mode = MODE_L,
527};
528
Jeyaprakash Soundrapandiana7203372013-01-21 17:57:41 -0800529static struct msm_camera_sensor_flash_data flash_imx135 = {
530 .flash_type = MSM_CAMERA_FLASH_NONE,
531};
532
533static struct msm_camera_csi_lane_params imx135_csi_lane_params = {
534 .csi_lane_assign = 0xE4,
535 .csi_lane_mask = 0xF,
536};
537
538static struct msm_camera_sensor_platform_info sensor_board_info_imx135 = {
539 .mount_angle = 90,
540 .cam_vreg = apq_8064_cam_vreg,
541 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
542 .gpio_conf = &apq8064_back_cam_gpio_conf,
543 .i2c_conf = &apq8064_back_cam_i2c_conf,
544 .csi_lane_params = &imx135_csi_lane_params,
545};
546
547static struct msm_camera_sensor_info msm_camera_sensor_imx135_data = {
548 .sensor_name = "imx135",
549 .pdata = &msm_camera_csi_device_data[0],
550 .flash_data = &flash_imx135,
551 .sensor_platform_info = &sensor_board_info_imx135,
552 .csi_if = 1,
553 .camera_type = BACK_CAMERA_2D,
554 .sensor_type = BAYER_SENSOR,
555 .actuator_info = &msm_act_main_cam_1_info,
556};
557
Kevin Chan412e9f92012-01-24 10:45:23 -0800558static struct msm_camera_sensor_flash_data flash_imx074 = {
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800559 .flash_type = MSM_CAMERA_FLASH_LED,
560 .flash_src = &msm_flash_src
Kevin Chan412e9f92012-01-24 10:45:23 -0800561};
562
Hody Hung9ba65cf2012-01-17 17:34:51 -0800563static struct msm_camera_csi_lane_params imx074_csi_lane_params = {
564 .csi_lane_assign = 0xE4,
565 .csi_lane_mask = 0xF,
566};
567
Kevin Chan412e9f92012-01-24 10:45:23 -0800568static struct msm_camera_sensor_platform_info sensor_board_info_imx074 = {
569 .mount_angle = 90,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800570 .cam_vreg = apq_8064_cam_vreg,
571 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
Kevin Chaneb6b6072012-01-17 11:54:54 -0800572 .gpio_conf = &apq8064_back_cam_gpio_conf,
Kevin Chand07220e2012-02-13 15:52:22 -0800573 .i2c_conf = &apq8064_back_cam_i2c_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800574 .csi_lane_params = &imx074_csi_lane_params,
Kevin Chan412e9f92012-01-24 10:45:23 -0800575};
576
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700577static struct i2c_board_info imx074_eeprom_i2c_info = {
578 I2C_BOARD_INFO("imx074_eeprom", 0x34 << 1),
579};
580
581static struct msm_eeprom_info imx074_eeprom_info = {
582 .board_info = &imx074_eeprom_i2c_info,
583 .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID,
584};
585
Kevin Chan412e9f92012-01-24 10:45:23 -0800586static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
587 .sensor_name = "imx074",
588 .pdata = &msm_camera_csi_device_data[0],
589 .flash_data = &flash_imx074,
590 .sensor_platform_info = &sensor_board_info_imx074,
Kevin Chan412e9f92012-01-24 10:45:23 -0800591 .csi_if = 1,
592 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530593 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800594 .actuator_info = &msm_act_main_cam_0_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700595 .eeprom_info = &imx074_eeprom_info,
Kevin Chan412e9f92012-01-24 10:45:23 -0800596};
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700597
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800598static struct msm_camera_csi_lane_params imx091_csi_lane_params = {
599 .csi_lane_assign = 0xE4,
600 .csi_lane_mask = 0xF,
601};
602
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800603static struct msm_camera_sensor_flash_data flash_imx091 = {
604 .flash_type = MSM_CAMERA_FLASH_NONE,
605};
606
607static struct msm_camera_sensor_platform_info sensor_board_info_imx091 = {
608 .mount_angle = 0,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800609 .cam_vreg = apq_8064_cam_vreg,
610 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800611 .gpio_conf = &apq8064_back_cam_gpio_conf,
612 .i2c_conf = &apq8064_back_cam_i2c_conf,
613 .csi_lane_params = &imx091_csi_lane_params,
614};
615
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700616static struct i2c_board_info imx091_eeprom_i2c_info = {
617 I2C_BOARD_INFO("imx091_eeprom", 0x21),
618};
619
620static struct msm_eeprom_info imx091_eeprom_info = {
621 .board_info = &imx091_eeprom_i2c_info,
622 .bus_id = APQ_8064_GSBI4_QUP_I2C_BUS_ID,
623};
624
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800625static struct msm_camera_sensor_info msm_camera_sensor_imx091_data = {
626 .sensor_name = "imx091",
627 .pdata = &msm_camera_csi_device_data[0],
628 .flash_data = &flash_imx091,
629 .sensor_platform_info = &sensor_board_info_imx091,
630 .csi_if = 1,
631 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530632 .sensor_type = BAYER_SENSOR,
Jeyaprakash Soundrapandian3040c032012-04-21 01:13:29 -0700633 .actuator_info = &msm_act_main_cam_1_info,
Jeyaprakash Soundrapandian734476b2012-05-03 20:08:15 -0700634 .eeprom_info = &imx091_eeprom_info,
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800635};
Kevin Chan412e9f92012-01-24 10:45:23 -0800636
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -0700637static struct msm_camera_sensor_flash_data flash_s5k3l1yx = {
638 .flash_type = MSM_CAMERA_FLASH_NONE,
639};
640
641static struct msm_camera_csi_lane_params s5k3l1yx_csi_lane_params = {
642 .csi_lane_assign = 0xE4,
643 .csi_lane_mask = 0xF,
644};
645
646static struct msm_camera_sensor_platform_info sensor_board_info_s5k3l1yx = {
647 .mount_angle = 90,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800648 .cam_vreg = apq_8064_cam_vreg,
649 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -0700650 .gpio_conf = &apq8064_back_cam_gpio_conf,
651 .i2c_conf = &apq8064_back_cam_i2c_conf,
652 .csi_lane_params = &s5k3l1yx_csi_lane_params,
653};
654
655static struct msm_camera_sensor_info msm_camera_sensor_s5k3l1yx_data = {
656 .sensor_name = "s5k3l1yx",
657 .pdata = &msm_camera_csi_device_data[0],
658 .flash_data = &flash_s5k3l1yx,
659 .sensor_platform_info = &sensor_board_info_s5k3l1yx,
660 .csi_if = 1,
661 .camera_type = BACK_CAMERA_2D,
662 .sensor_type = BAYER_SENSOR,
663};
664
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800665static struct msm_camera_sensor_flash_data flash_mt9m114 = {
666 .flash_type = MSM_CAMERA_FLASH_NONE
667};
668
Hody Hung9ba65cf2012-01-17 17:34:51 -0800669static struct msm_camera_csi_lane_params mt9m114_csi_lane_params = {
670 .csi_lane_assign = 0xE4,
671 .csi_lane_mask = 0x1,
672};
673
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800674static struct msm_camera_sensor_platform_info sensor_board_info_mt9m114 = {
675 .mount_angle = 90,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800676 .cam_vreg = apq_8064_cam_vreg,
677 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800678 .gpio_conf = &apq8064_front_cam_gpio_conf,
679 .i2c_conf = &apq8064_front_cam_i2c_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800680 .csi_lane_params = &mt9m114_csi_lane_params,
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800681};
682
683static struct msm_camera_sensor_info msm_camera_sensor_mt9m114_data = {
684 .sensor_name = "mt9m114",
685 .pdata = &msm_camera_csi_device_data[1],
686 .flash_data = &flash_mt9m114,
687 .sensor_platform_info = &sensor_board_info_mt9m114,
688 .csi_if = 1,
689 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530690 .sensor_type = YUV_SENSOR,
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800691};
692
Kevin Chand07220e2012-02-13 15:52:22 -0800693static struct msm_camera_sensor_flash_data flash_ov2720 = {
694 .flash_type = MSM_CAMERA_FLASH_NONE,
695};
696
Hody Hung9ba65cf2012-01-17 17:34:51 -0800697static struct msm_camera_csi_lane_params ov2720_csi_lane_params = {
698 .csi_lane_assign = 0xE4,
699 .csi_lane_mask = 0x3,
700};
701
Kevin Chand07220e2012-02-13 15:52:22 -0800702static struct msm_camera_sensor_platform_info sensor_board_info_ov2720 = {
703 .mount_angle = 0,
Azam Sadiq Pasha Kapatrala Syed92fa99c2012-11-28 18:56:19 -0800704 .cam_vreg = apq_8064_cam_vreg,
705 .num_vreg = ARRAY_SIZE(apq_8064_cam_vreg),
Kevin Chand07220e2012-02-13 15:52:22 -0800706 .gpio_conf = &apq8064_front_cam_gpio_conf,
707 .i2c_conf = &apq8064_front_cam_i2c_conf,
Hody Hung9ba65cf2012-01-17 17:34:51 -0800708 .csi_lane_params = &ov2720_csi_lane_params,
Kevin Chand07220e2012-02-13 15:52:22 -0800709};
710
711static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
712 .sensor_name = "ov2720",
713 .pdata = &msm_camera_csi_device_data[1],
714 .flash_data = &flash_ov2720,
715 .sensor_platform_info = &sensor_board_info_ov2720,
716 .csi_if = 1,
717 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530718 .sensor_type = BAYER_SENSOR,
Kevin Chand07220e2012-02-13 15:52:22 -0800719};
Kevin Chand07220e2012-02-13 15:52:22 -0800720
Kevin Chan94b4c832012-03-02 21:27:16 -0800721static struct platform_device msm_camera_server = {
722 .name = "msm_cam_server",
723 .id = 0,
724};
725
Kevin Chan412e9f92012-01-24 10:45:23 -0800726void __init apq8064_init_cam(void)
727{
Punit Soni831bfab2013-03-06 15:49:36 -0800728 /* for SGLTE2 platform, do not configure i2c/gpiomux gsbi4 is used for
729 * some other purpose */
730 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE2) {
731 msm_gpiomux_install(apq8064_cam_common_configs,
Kevin Chan412e9f92012-01-24 10:45:23 -0800732 ARRAY_SIZE(apq8064_cam_common_configs));
Punit Soni831bfab2013-03-06 15:49:36 -0800733 }
Kevin Chan412e9f92012-01-24 10:45:23 -0800734
Sreesudhan Ramakrish Ramkumar6f25eb92012-04-10 09:49:47 -0700735 if (machine_is_apq8064_cdp()) {
Sreesudhan Ramakrish Ramkumar3f06a1b2012-03-15 18:44:56 -0700736 sensor_board_info_imx074.mount_angle = 0;
Sreesudhan Ramakrish Ramkumar6f25eb92012-04-10 09:49:47 -0700737 sensor_board_info_mt9m114.mount_angle = 0;
738 } else if (machine_is_apq8064_liquid())
Jignesh Mehtabfb1aa32012-03-16 17:23:23 -0700739 sensor_board_info_imx074.mount_angle = 180;
Sreesudhan Ramakrish Ramkumar3f06a1b2012-03-15 18:44:56 -0700740
Kevin Chan94b4c832012-03-02 21:27:16 -0800741 platform_device_register(&msm_camera_server);
Punit Soni831bfab2013-03-06 15:49:36 -0800742 if (socinfo_get_platform_subtype() != PLATFORM_SUBTYPE_SGLTE2)
743 platform_device_register(&msm8960_device_i2c_mux_gsbi4);
Kevin Chan412e9f92012-01-24 10:45:23 -0800744 platform_device_register(&msm8960_device_csiphy0);
745 platform_device_register(&msm8960_device_csiphy1);
746 platform_device_register(&msm8960_device_csid0);
747 platform_device_register(&msm8960_device_csid1);
748 platform_device_register(&msm8960_device_ispif);
749 platform_device_register(&msm8960_device_vfe);
750 platform_device_register(&msm8960_device_vpe);
751}
752
753#ifdef CONFIG_I2C
754static struct i2c_board_info apq8064_camera_i2c_boardinfo[] = {
Kevin Chan412e9f92012-01-24 10:45:23 -0800755 {
756 I2C_BOARD_INFO("imx074", 0x1A),
757 .platform_data = &msm_camera_sensor_imx074_data,
758 },
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800759 {
Jeyaprakash Soundrapandiana7203372013-01-21 17:57:41 -0800760 I2C_BOARD_INFO("imx135", 0x10),
761 .platform_data = &msm_camera_sensor_imx135_data,
762 },
763 {
Sreesudhan Ramakrish Ramkumar6c6f57c2012-02-21 15:12:44 -0800764 I2C_BOARD_INFO("mt9m114", 0x48),
765 .platform_data = &msm_camera_sensor_mt9m114_data,
766 },
Kevin Chand07220e2012-02-13 15:52:22 -0800767 {
768 I2C_BOARD_INFO("ov2720", 0x6C),
769 .platform_data = &msm_camera_sensor_ov2720_data,
770 },
Jeyaprakash Soundrapandiana1b3c532012-02-29 20:33:30 -0800771 {
772 I2C_BOARD_INFO("sc628a", 0x6E),
773 },
Sreesudhan Ramakrish Ramkumar3381da72012-01-27 08:08:32 -0800774 {
775 I2C_BOARD_INFO("imx091", 0x34),
776 .platform_data = &msm_camera_sensor_imx091_data,
777 },
Sreesudhan Ramakrish Ramkumar8002a792012-04-09 17:42:58 -0700778 {
779 I2C_BOARD_INFO("s5k3l1yx", 0x20),
780 .platform_data = &msm_camera_sensor_s5k3l1yx_data,
781 },
Kevin Chan412e9f92012-01-24 10:45:23 -0800782};
783
784struct msm_camera_board_info apq8064_camera_board_info = {
785 .board_info = apq8064_camera_i2c_boardinfo,
786 .num_i2c_board_info = ARRAY_SIZE(apq8064_camera_i2c_boardinfo),
787};
788#endif
789#endif