blob: 2873fc02d5f1356463631a74e1d1fa2376e0b99d [file] [log] [blame]
Chintan Pandya40762702011-12-06 13:47:06 +05301/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
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#include <linux/i2c.h>
14#include <linux/i2c/sx150x.h>
15#include <linux/gpio.h>
16#include <linux/regulator/consumer.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070019#include <linux/module.h>
Chintan Pandya40762702011-12-06 13:47:06 +053020#include <asm/mach-types.h>
21#include <mach/msm_iomap.h>
22#include <mach/board.h>
23#include <mach/irqs-7xxx.h>
24#include "devices-msm7x2xa.h"
25#include "board-msm7627a.h"
Su Liuaca04702012-02-14 02:27:32 +053026#include <mach/vreg.h>
Chintan Pandya40762702011-12-06 13:47:06 +053027
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +053028#define GPIO_SKU1_CAM_VGA_SHDN 18
29#define GPIO_SKU1_CAM_VGA_RESET_N 29
30#define GPIO_SKU3_CAM_5MP_SHDN_N 5 /* PWDN */
31#define GPIO_SKU3_CAM_5MP_CAMIF_RESET 6 /* (board_is(EVT))?123:121 RESET */
32#define GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN 30
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +053033#define GPIO_SKU7_CAM_VGA_SHDN 91
34#define GPIO_SKU7_CAM_5MP_SHDN_N 93 /* PWDN */
35#define GPIO_SKU7_CAM_5MP_CAMIF_RESET 23 /* (board_is(EVT))?123:121 RESET */
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +053036
Suresh Vankadara87e195b2012-01-18 00:42:58 +053037#ifdef CONFIG_MSM_CAMERA_V4L2
38static uint32_t camera_off_gpio_table[] = {
39 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
40};
41
42static uint32_t camera_on_gpio_table[] = {
43 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
44};
45
Sandeep Kodimelac6f78672012-03-07 10:44:04 +053046static struct gpio s5k4e1_cam_req_gpio[] = {
47 {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_DIR_OUT, "CAM_RESET"},
48};
49
50static struct msm_gpio_set_tbl s5k4e1_cam_gpio_set_tbl[] = {
51 {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_OUT_INIT_LOW, 1000},
52 {GPIO_CAM_GP_CAMIF_RESET_N, GPIOF_OUT_INIT_HIGH, 4000},
53};
54
55static struct msm_camera_gpio_conf gpio_conf_s5k4e1 = {
56 .camera_off_table = camera_off_gpio_table,
57 .camera_off_table_size = ARRAY_SIZE(camera_off_gpio_table),
58 .camera_on_table = camera_on_gpio_table,
59 .camera_on_table_size = ARRAY_SIZE(camera_on_gpio_table),
60 .cam_gpio_req_tbl = s5k4e1_cam_req_gpio,
61 .cam_gpio_req_tbl_size = ARRAY_SIZE(s5k4e1_cam_req_gpio),
62 .cam_gpio_set_tbl = s5k4e1_cam_gpio_set_tbl,
63 .cam_gpio_set_tbl_size = ARRAY_SIZE(s5k4e1_cam_gpio_set_tbl),
64 .gpio_no_mux = 1,
65};
66
67static struct msm_camera_gpio_conf gpio_conf_mt9e013 = {
68 .camera_off_table = camera_off_gpio_table,
69 .camera_on_table = camera_on_gpio_table,
70 .gpio_no_mux = 1,
71};
72
73static struct msm_camera_gpio_conf gpio_conf_ov9726 = {
74 .camera_off_table = camera_off_gpio_table,
75 .camera_on_table = camera_on_gpio_table,
76 .gpio_no_mux = 1,
77};
78
Sreesudhan Ramakrish Ramkumarcfdfa0e2012-05-15 15:56:05 -070079#ifdef CONFIG_OV7692
Sreesudhan Ramakrish Ramkumar9719a992012-04-16 15:28:05 -070080static struct gpio ov7692_cam_req_gpio[] = {
81 {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_DIR_OUT, "CAM_VGA_SHDN"},
82 {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_DIR_OUT, "CAM_VGA_RESET"},
83};
84
85static struct msm_gpio_set_tbl ov7692_cam_gpio_set_tbl[] = {
86 {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_OUT_INIT_HIGH, 5000},
87 {GPIO_SKU1_CAM_VGA_SHDN, GPIOF_OUT_INIT_LOW, 5000},
88 {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_OUT_INIT_HIGH, 5000},
89 {GPIO_SKU1_CAM_VGA_RESET_N, GPIOF_OUT_INIT_LOW, 5000},
Sreesudhan Ramakrish Ramkumar9719a992012-04-16 15:28:05 -070090};
91
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +053092static struct msm_camera_gpio_conf gpio_conf_ov7692 = {
Sreesudhan Ramakrish Ramkumar9719a992012-04-16 15:28:05 -070093 .cam_gpio_req_tbl = ov7692_cam_req_gpio,
94 .cam_gpio_req_tbl_size = ARRAY_SIZE(ov7692_cam_req_gpio),
95 .cam_gpio_set_tbl = ov7692_cam_gpio_set_tbl,
96 .cam_gpio_set_tbl_size = ARRAY_SIZE(ov7692_cam_gpio_set_tbl),
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +053097 .gpio_no_mux = 1,
98};
99#endif
100
101#ifdef CONFIG_OV5647
102static struct msm_camera_gpio_conf gpio_conf_ov5647 = {
103 .camera_off_table = camera_off_gpio_table,
104 .camera_on_table = camera_on_gpio_table,
105 .gpio_no_mux = 1,
106};
107#endif
108
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530109#ifdef CONFIG_MSM_CAMERA_FLASH
110static struct msm_camera_sensor_flash_src msm_flash_src = {
111 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
112 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
113 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
114};
115#endif
116
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530117static struct camera_vreg_t msm_cam_vreg[] = {
118 {"msme1", REG_LDO, 1800000, 1800000, 0},
119 {"gp2", REG_LDO, 2850000, 2850000, 0},
120 {"usb2", REG_LDO, 1800000, 1800000, 0},
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530121};
122
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530123static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data;
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530124
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530125struct msm_camera_device_platform_data msm_camera_device_data_csi1[] = {
126 {
127 .csid_core = 1,
128 .is_csic = 1,
129 .ioclk = {
130 .vfe_clk_rate = 192000000,
131 },
132 },
133 {
134 .csid_core = 1,
135 .is_csic = 1,
136 .ioclk = {
137 .vfe_clk_rate = 266667000,
138 },
139 },
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530140};
141
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530142struct msm_camera_device_platform_data msm_camera_device_data_csi0[] = {
143 {
144 .csid_core = 0,
145 .is_csic = 1,
146 .ioclk = {
147 .vfe_clk_rate = 192000000,
148 },
149 },
150 {
151 .csid_core = 0,
152 .is_csic = 1,
153 .ioclk = {
154 .vfe_clk_rate = 266667000,
155 },
156 },
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530157};
158
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800159static struct i2c_board_info msm_act_main_cam_i2c_info = {
160 I2C_BOARD_INFO("msm_actuator", 0x11),
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530161};
162
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800163static struct msm_actuator_info msm_act_main_cam_4_info = {
164 .board_info = &msm_act_main_cam_i2c_info,
165 .cam_name = MSM_ACTUATOR_MAIN_CAM_4,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530166 .bus_id = MSM_GSBI0_QUP_I2C_BUS_ID,
167 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
168 .vcm_enable = 1,
169};
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530170
171#ifdef CONFIG_S5K4E1
172static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
173 .flash_type = MSM_CAMERA_FLASH_LED,
174 .flash_src = &msm_flash_src
175};
176
177static struct msm_camera_sensor_platform_info sensor_board_info_s5k4e1 = {
178 .mount_angle = 90,
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530179 .cam_vreg = msm_cam_vreg,
180 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
181 .gpio_conf = &gpio_conf_s5k4e1,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530182};
183
184static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
185 .sensor_name = "s5k4e1",
186 .sensor_reset_enable = 1,
Su Liuaca04702012-02-14 02:27:32 +0530187 .pmic_gpio_enable = 0,
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530188 .pdata = &msm_camera_device_data_csi1[0],
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530189 .flash_data = &flash_s5k4e1,
190 .sensor_platform_info = &sensor_board_info_s5k4e1,
191 .csi_if = 1,
192 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530193 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800194 .actuator_info = &msm_act_main_cam_4_info,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530195};
196#endif
197
Sreesudhan Ramakrish Ramkumarcfdfa0e2012-05-15 15:56:05 -0700198#ifdef CONFIG_OV7692
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530199static struct msm_camera_sensor_platform_info sensor_board_info_ov7692 = {
200 .mount_angle = 90,
201 .cam_vreg = msm_cam_vreg,
202 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
203 .gpio_conf = &gpio_conf_ov7692,
204};
205
206static struct msm_camera_sensor_flash_data flash_ov7692 = {
207 .flash_type = MSM_CAMERA_FLASH_NONE,
208};
209
210static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
211 .sensor_name = "ov7692",
212 .sensor_reset_enable = 0,
213 .pmic_gpio_enable = 1,
Raju P.L.S.S.S.Nce5c5c22012-05-17 23:10:08 +0530214 .sensor_lcd_gpio_onoff = lcd_camera_power_onoff,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530215 .sensor_reset = GPIO_SKU1_CAM_VGA_RESET_N,
216 .sensor_pwd = GPIO_SKU1_CAM_VGA_SHDN,
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530217 .pdata = &msm_camera_device_data_csi0[0],
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530218 .flash_data = &flash_ov7692,
219 .sensor_platform_info = &sensor_board_info_ov7692,
220 .csi_if = 1,
221 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530222 .sensor_type = YUV_SENSOR,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530223};
224#endif
225
226#ifdef CONFIG_OV5647
227
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800228static struct msm_actuator_info msm_act_main_cam_5_info = {
229 .board_info = &msm_act_main_cam_i2c_info,
230 .cam_name = MSM_ACTUATOR_MAIN_CAM_5,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530231 .bus_id = MSM_GSBI0_QUP_I2C_BUS_ID,
232 .vcm_pwd = GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN,
233 .vcm_enable = 1,
234};
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530235
236static struct msm_camera_sensor_platform_info sensor_board_info_ov5647 = {
237 .mount_angle = 90,
238 .cam_vreg = msm_cam_vreg,
239 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
240 .gpio_conf = &gpio_conf_ov5647,
241};
242
243static struct msm_camera_sensor_flash_src msm_flash_src_ov5647 = {
Raju P.L.S.S.S.Nbf3faff2012-04-05 14:33:36 +0530244 .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED1,
245 ._fsrc.ext_driver_src.led_en = 13,
246 ._fsrc.ext_driver_src.led_flash_en = 32,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530247};
248
249static struct msm_camera_sensor_flash_data flash_ov5647 = {
250 .flash_type = MSM_CAMERA_FLASH_LED,
251 .flash_src = &msm_flash_src_ov5647,
252};
253
254static struct msm_camera_sensor_info msm_camera_sensor_ov5647_data = {
255 .sensor_name = "ov5647",
256 .sensor_reset_enable = 1,
257 .pmic_gpio_enable = 1,
Raju P.L.S.S.S.Nce5c5c22012-05-17 23:10:08 +0530258 .sensor_lcd_gpio_onoff = lcd_camera_power_onoff,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530259 .sensor_reset = GPIO_SKU3_CAM_5MP_CAMIF_RESET,
260 .sensor_pwd = GPIO_SKU3_CAM_5MP_SHDN_N,
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530261 .pdata = &msm_camera_device_data_csi1[0],
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530262 .flash_data = &flash_ov5647,
263 .sensor_platform_info = &sensor_board_info_ov5647,
264 .csi_if = 1,
265 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530266 .sensor_type = BAYER_SENSOR,
Rajakumar Govindaram6627b362012-01-29 19:00:30 -0800267 .actuator_info = &msm_act_main_cam_5_info,
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530268};
269
270#endif
Katta Santhisindhu16746f62012-06-08 13:35:07 +0530271
272static struct msm_camera_gpio_conf gpio_conf_ov8825 = {
273 .camera_off_table = camera_off_gpio_table,
274 .camera_on_table = camera_on_gpio_table,
275 .gpio_no_mux = 1,
276};
277
278static struct msm_camera_sensor_flash_data flash_ov8825 = {
279 .flash_type = MSM_CAMERA_FLASH_NONE,
280};
281
282static struct msm_camera_sensor_platform_info sensor_board_info_ov8825 = {
283 .mount_angle = 90,
284 .cam_vreg = msm_cam_vreg,
285 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
286 .gpio_conf = &gpio_conf_ov8825,
287};
288
289static struct msm_camera_sensor_info msm_camera_sensor_ov8825_data = {
290 .sensor_name = "ov8825",
291 .sensor_reset_enable = 1,
292 .pmic_gpio_enable = 1,
293 .sensor_reset = GPIO_SKU3_CAM_5MP_CAMIF_RESET,
294 .sensor_pwd = GPIO_SKU3_CAM_5MP_SHDN_N,
295 .pdata = &msm_camera_device_data_csi1[1],
296 .flash_data = &flash_ov8825,
297 .sensor_platform_info = &sensor_board_info_ov8825,
298 .csi_if = 1,
299 .camera_type = BACK_CAMERA_2D,
300};
301
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530302#ifdef CONFIG_MT9E013
303static struct msm_camera_sensor_flash_data flash_mt9e013 = {
304 .flash_type = MSM_CAMERA_FLASH_LED,
305 .flash_src = &msm_flash_src
306};
307
308static struct msm_camera_sensor_platform_info sensor_board_info_mt9e013 = {
309 .mount_angle = 90,
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530310 .cam_vreg = msm_cam_vreg,
311 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
312 .gpio_conf = &gpio_conf_mt9e013,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530313};
314
315static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
316 .sensor_name = "mt9e013",
317 .sensor_reset_enable = 1,
Su Liuaca04702012-02-14 02:27:32 +0530318 .pmic_gpio_enable = 0,
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530319 .pdata = &msm_camera_device_data_csi1[1],
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530320 .flash_data = &flash_mt9e013,
321 .sensor_platform_info = &sensor_board_info_mt9e013,
322 .csi_if = 1,
323 .camera_type = BACK_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530324 .sensor_type = BAYER_SENSOR,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530325};
326#endif
327
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530328#ifdef CONFIG_WEBCAM_OV9726
329static struct msm_camera_sensor_flash_data flash_ov9726 = {
330 .flash_type = MSM_CAMERA_FLASH_LED,
331 .flash_src = &msm_flash_src
332};
333
334static struct msm_camera_sensor_platform_info sensor_board_info_ov9726 = {
335 .mount_angle = 90,
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530336 .cam_vreg = msm_cam_vreg,
337 .num_vreg = ARRAY_SIZE(msm_cam_vreg),
338 .gpio_conf = &gpio_conf_ov9726,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530339};
340
341static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
342 .sensor_name = "ov9726",
343 .sensor_reset_enable = 0,
Su Liuaca04702012-02-14 02:27:32 +0530344 .pmic_gpio_enable = 0,
Raju P.L.S.S.S.Nabd2dc42012-05-07 21:28:45 +0530345 .pdata = &msm_camera_device_data_csi0[0],
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530346 .flash_data = &flash_ov9726,
347 .sensor_platform_info = &sensor_board_info_ov9726,
348 .csi_if = 1,
349 .camera_type = FRONT_CAMERA_2D,
Raju P.L.S.S.S.N3f4b3022012-03-29 10:09:01 +0530350 .sensor_type = BAYER_SENSOR,
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530351};
352#endif
353
Kevin Chan94b4c832012-03-02 21:27:16 -0800354static struct platform_device msm_camera_server = {
355 .name = "msm_cam_server",
356 .id = 0,
357};
358
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530359static void __init msm7x27a_init_cam(void)
360{
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530361 if (!(machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530362 || machine_is_msm7627a_qrd1()
363 || machine_is_msm8625_ffa())) {
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530364 sensor_board_info_s5k4e1.cam_vreg = NULL;
365 sensor_board_info_s5k4e1.num_vreg = 0;
366 sensor_board_info_mt9e013.cam_vreg = NULL;
367 sensor_board_info_mt9e013.num_vreg = 0;
368 sensor_board_info_ov9726.cam_vreg = NULL;
369 sensor_board_info_ov9726.num_vreg = 0;
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530370 sensor_board_info_ov7692.cam_vreg = NULL;
371 sensor_board_info_ov7692.num_vreg = 0;
372 sensor_board_info_ov5647.cam_vreg = NULL;
373 sensor_board_info_ov5647.num_vreg = 0;
Katta Santhisindhu16746f62012-06-08 13:35:07 +0530374 sensor_board_info_ov8825.cam_vreg = NULL;
375 sensor_board_info_ov8825.num_vreg = 0;
376
Sandeep Kodimelac6f78672012-03-07 10:44:04 +0530377 }
Kevin Chan94b4c832012-03-02 21:27:16 -0800378 platform_device_register(&msm_camera_server);
Aparna Mallavarapu5a326242012-05-09 19:49:02 +0530379 if (machine_is_msm8625_surf() || machine_is_msm8625_evb()
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530380 || machine_is_msm8625_evt()
381 || machine_is_msm8625_qrd7()) {
Raju P.L.S.S.S.N2b345012012-03-15 10:18:30 +0530382 platform_device_register(&msm8625_device_csic0);
383 platform_device_register(&msm8625_device_csic1);
384 } else {
385 platform_device_register(&msm7x27a_device_csic0);
386 platform_device_register(&msm7x27a_device_csic1);
387 }
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530388 if (machine_is_msm8625_evb()
389 || machine_is_msm8625_evt()
390 || machine_is_msm8625_qrd7())
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530391 *(int *) msm7x27a_device_clkctl.dev.platform_data = 1;
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530392 platform_device_register(&msm7x27a_device_clkctl);
393 platform_device_register(&msm7x27a_device_vfe);
394}
395
396static struct i2c_board_info i2c_camera_devices[] = {
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530397 {
398 I2C_BOARD_INFO("s5k4e1", 0x36),
399 .platform_data = &msm_camera_sensor_s5k4e1_data,
400 },
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530401 {
402 I2C_BOARD_INFO("ov9726", 0x10),
403 .platform_data = &msm_camera_sensor_ov9726_data,
404 },
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530405 {
406 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
407 .platform_data = &msm_camera_sensor_mt9e013_data,
408 },
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530409 {
410 I2C_BOARD_INFO("ov7692", 0x78),
411 .platform_data = &msm_camera_sensor_ov7692_data,
412 },
413 {
414 I2C_BOARD_INFO("ov5647", 0x36 << 1),
415 .platform_data = &msm_camera_sensor_ov5647_data,
416 },
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530417 {
Katta Santhisindhu16746f62012-06-08 13:35:07 +0530418 I2C_BOARD_INFO("ov8825", 0x6C >> 3),
419 .platform_data = &msm_camera_sensor_ov8825_data,
420 },
421 {
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530422 I2C_BOARD_INFO("sc628a", 0x6E),
423 },
424};
425#else
Chintan Pandya40762702011-12-06 13:47:06 +0530426static uint32_t camera_off_gpio_table[] = {
427 GPIO_CFG(15, 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
428};
429
430static uint32_t camera_on_gpio_table[] = {
431 GPIO_CFG(15, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
432};
433
434#ifdef CONFIG_MSM_CAMERA_FLASH
435static struct msm_camera_sensor_flash_src msm_flash_src = {
436 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
437 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
438 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
439};
440#endif
441
442static struct regulator_bulk_data regs_camera[] = {
443 { .supply = "msme1", .min_uV = 1800000, .max_uV = 1800000 },
444 { .supply = "gp2", .min_uV = 2850000, .max_uV = 2850000 },
445 { .supply = "usb2", .min_uV = 1800000, .max_uV = 1800000 },
446};
447
448static void qrd1_camera_gpio_cfg(void)
449{
450
451 int rc = 0;
452
453 rc = gpio_request(QRD_GPIO_CAM_5MP_SHDN_EN, "ov5640");
454 if (rc < 0)
455 pr_err("%s: gpio_request---GPIO_CAM_5MP_SHDN_EN failed!",
456 __func__);
457
458
459 rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_SHDN_EN, 0,
460 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
461 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
462 if (rc < 0) {
463 pr_err("%s: unable to enable Power Down gpio for main"
464 "camera!\n", __func__);
465 gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN);
466 }
467
468
469 rc = gpio_request(QRD_GPIO_CAM_5MP_RESET, "ov5640");
470 if (rc < 0) {
471 pr_err("%s: gpio_request---GPIO_CAM_5MP_RESET failed!",
472 __func__);
473 gpio_free(QRD_GPIO_CAM_5MP_SHDN_EN);
474 }
475
476
477 rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_5MP_RESET, 0,
478 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
479 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
480 if (rc < 0) {
481 pr_err("%s: unable to enable reset gpio for main camera!\n",
482 __func__);
483 gpio_free(QRD_GPIO_CAM_5MP_RESET);
484 }
485
486 rc = gpio_request(QRD_GPIO_CAM_3MP_PWDN, "ov7692");
487 if (rc < 0)
488 pr_err("%s: gpio_request---GPIO_CAM_3MP_PWDN failed!",
489 __func__);
490
491 rc = gpio_tlmm_config(GPIO_CFG(QRD_GPIO_CAM_3MP_PWDN, 0,
492 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP,
493 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
494 if (rc < 0) {
495 pr_err("%s: unable to enable Power Down gpio for front"
496 "camera!\n", __func__);
497 gpio_free(QRD_GPIO_CAM_3MP_PWDN);
498 }
499
500 gpio_direction_output(QRD_GPIO_CAM_5MP_SHDN_EN, 1);
501 gpio_direction_output(QRD_GPIO_CAM_5MP_RESET, 1);
502 gpio_direction_output(QRD_GPIO_CAM_3MP_PWDN, 1);
503}
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530504#endif
Su Liuaca04702012-02-14 02:27:32 +0530505
506static void evb_camera_gpio_cfg(void)
507{
508 int rc = 0;
509
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530510 rc = gpio_request(msm_camera_sensor_ov5647_data.sensor_pwd, "ov5647");
Su Liuaca04702012-02-14 02:27:32 +0530511 if (rc < 0)
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530512 pr_err("%s: gpio_request OV5647 sensor_pwd: %d failed!",
513 __func__, msm_camera_sensor_ov5647_data.sensor_pwd);
Su Liuaca04702012-02-14 02:27:32 +0530514
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530515 rc = gpio_tlmm_config(GPIO_CFG(msm_camera_sensor_ov5647_data.sensor_pwd,
516 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
517 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
Su Liuaca04702012-02-14 02:27:32 +0530518 if (rc < 0) {
519 pr_err("%s:unable to enable Powr Dwn gpio for main camera!\n",
520 __func__);
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530521 gpio_free(msm_camera_sensor_ov5647_data.sensor_pwd);
Su Liuaca04702012-02-14 02:27:32 +0530522 }
523
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530524 rc = gpio_direction_output(msm_camera_sensor_ov5647_data.sensor_pwd, 1);
Su Liuaca04702012-02-14 02:27:32 +0530525 if (rc < 0)
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530526 pr_err("%s: unable to set gpio: %d direction for ov5647 camera\n",
527 __func__, msm_camera_sensor_ov5647_data.sensor_pwd);
Su Liuaca04702012-02-14 02:27:32 +0530528
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530529 rc = gpio_request(msm_camera_sensor_ov5647_data.sensor_reset, "ov5647");
530 if (rc < 0)
531 pr_err("%s: gpio_request OV5647 sensor_reset: %d failed!",
532 __func__, msm_camera_sensor_ov5647_data.sensor_reset);
533
534 rc = gpio_tlmm_config(GPIO_CFG(
535 msm_camera_sensor_ov5647_data.sensor_reset,
536 0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
537 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
Su Liuaca04702012-02-14 02:27:32 +0530538 if (rc < 0) {
539 pr_err("%s: unable to enable reset gpio for main camera!\n",
540 __func__);
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530541 gpio_free(msm_camera_sensor_ov5647_data.sensor_reset);
Su Liuaca04702012-02-14 02:27:32 +0530542 }
543
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +0530544 rc = gpio_direction_output(
545 msm_camera_sensor_ov5647_data.sensor_reset, 1);
546 if (rc < 0)
547 pr_err("%s: unable to set gpio: %d direction for ov5647 camera\n",
548 __func__, msm_camera_sensor_ov5647_data.sensor_reset);
Su Liuaca04702012-02-14 02:27:32 +0530549
Su Liuaca04702012-02-14 02:27:32 +0530550}
551
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +0530552#ifndef CONFIG_MSM_CAMERA_V4L2
553
Chintan Pandya40762702011-12-06 13:47:06 +0530554static void msm_camera_vreg_config(int vreg_en)
555{
556 int rc = vreg_en ?
557 regulator_bulk_enable(ARRAY_SIZE(regs_camera), regs_camera) :
558 regulator_bulk_disable(ARRAY_SIZE(regs_camera), regs_camera);
559
560 if (rc)
561 pr_err("%s: could not %sable regulators: %d\n",
562 __func__, vreg_en ? "en" : "dis", rc);
563}
564
565static int config_gpio_table(uint32_t *table, int len)
566{
567 int rc = 0, i = 0;
568
569 for (i = 0; i < len; i++) {
570 rc = gpio_tlmm_config(table[i], GPIO_CFG_ENABLE);
571 if (rc) {
572 pr_err("%s not able to get gpio\n", __func__);
573 for (i--; i >= 0; i--)
574 gpio_tlmm_config(camera_off_gpio_table[i],
575 GPIO_CFG_ENABLE);
576 break;
577 }
578 }
579 return rc;
580}
581
582static int config_camera_on_gpios_rear(void)
583{
584 int rc = 0;
585
586 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530587 || machine_is_msm7627a_qrd1()
588 || machine_is_msm8625_ffa())
Chintan Pandya40762702011-12-06 13:47:06 +0530589 msm_camera_vreg_config(1);
590
591 rc = config_gpio_table(camera_on_gpio_table,
592 ARRAY_SIZE(camera_on_gpio_table));
593 if (rc < 0) {
594 pr_err("%s: CAMSENSOR gpio table request"
595 "failed\n", __func__);
596 return rc;
597 }
598
599 return rc;
600}
601
602static void config_camera_off_gpios_rear(void)
603{
604 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530605 || machine_is_msm7627a_qrd1()
606 || machine_is_msm8625_ffa())
Chintan Pandya40762702011-12-06 13:47:06 +0530607 msm_camera_vreg_config(0);
608
609 config_gpio_table(camera_off_gpio_table,
610 ARRAY_SIZE(camera_off_gpio_table));
611}
612
613static int config_camera_on_gpios_front(void)
614{
615 int rc = 0;
616
617 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530618 || machine_is_msm7627a_qrd1()
619 || machine_is_msm8625_ffa())
Chintan Pandya40762702011-12-06 13:47:06 +0530620 msm_camera_vreg_config(1);
621
622 rc = config_gpio_table(camera_on_gpio_table,
623 ARRAY_SIZE(camera_on_gpio_table));
624 if (rc < 0) {
625 pr_err("%s: CAMSENSOR gpio table request"
626 "failed\n", __func__);
627 return rc;
628 }
629
630 return rc;
631}
632
633static void config_camera_off_gpios_front(void)
634{
635 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530636 || machine_is_msm7627a_qrd1()
637 || machine_is_msm8625_ffa())
Chintan Pandya40762702011-12-06 13:47:06 +0530638 msm_camera_vreg_config(0);
639
640 config_gpio_table(camera_off_gpio_table,
641 ARRAY_SIZE(camera_off_gpio_table));
642}
643
644struct msm_camera_device_platform_data msm_camera_device_data_rear = {
645 .camera_gpio_on = config_camera_on_gpios_rear,
646 .camera_gpio_off = config_camera_off_gpios_rear,
647 .ioext.csiphy = 0xA1000000,
648 .ioext.csisz = 0x00100000,
649 .ioext.csiirq = INT_CSI_IRQ_1,
650 .ioclk.mclk_clk_rate = 24000000,
651 .ioclk.vfe_clk_rate = 192000000,
Taniya Das13b811a2011-12-09 18:33:45 +0530652 .ioext.appphy = MSM7XXX_CLK_CTL_PHYS,
653 .ioext.appsz = MSM7XXX_CLK_CTL_SIZE,
Chintan Pandya40762702011-12-06 13:47:06 +0530654};
655
656struct msm_camera_device_platform_data msm_camera_device_data_front = {
657 .camera_gpio_on = config_camera_on_gpios_front,
658 .camera_gpio_off = config_camera_off_gpios_front,
659 .ioext.csiphy = 0xA0F00000,
660 .ioext.csisz = 0x00100000,
661 .ioext.csiirq = INT_CSI_IRQ_0,
662 .ioclk.mclk_clk_rate = 24000000,
663 .ioclk.vfe_clk_rate = 192000000,
Taniya Das13b811a2011-12-09 18:33:45 +0530664 .ioext.appphy = MSM7XXX_CLK_CTL_PHYS,
665 .ioext.appsz = MSM7XXX_CLK_CTL_SIZE,
Chintan Pandya40762702011-12-06 13:47:06 +0530666};
667
Su Liuaca04702012-02-14 02:27:32 +0530668#ifdef CONFIG_OV5647
669
670static struct msm_camera_sensor_platform_info ov5647_sensor_7627a_info = {
671 .mount_angle = 90
672};
673
674static struct msm_camera_sensor_flash_src msm_flash_src_ov5647 = {
675 .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
676 ._fsrc.led_src.led_name = "flashlight",
677 ._fsrc.led_src.led_name_len = 10,
678};
679
680static struct msm_camera_sensor_flash_data flash_ov5647 = {
681 .flash_type = MSM_CAMERA_FLASH_LED,
682 .flash_src = &msm_flash_src_ov5647,
683};
684
685static struct msm_camera_sensor_info msm_camera_sensor_ov5647_data = {
686 .sensor_name = "ov5647",
687 .sensor_reset_enable = 1,
688 .sensor_reset = GPIO_SKU3_CAM_5MP_CAMIF_RESET,
689 .pmic_gpio_enable = 1,
690 .sensor_pwd = GPIO_SKU3_CAM_5MP_SHDN_N,
691 .vcm_pwd = GPIO_SKU3_CAM_5MP_CAM_DRIVER_PWDN,
Lokesh Kumar Aakulufe9c3ec2012-02-22 19:26:29 +0530692 .vcm_enable = 1,
Su Liuaca04702012-02-14 02:27:32 +0530693 .pdata = &msm_camera_device_data_rear,
694 .flash_data = &flash_ov5647,
695 .sensor_platform_info = &ov5647_sensor_7627a_info,
696 .csi_if = 1
697};
698
699static struct platform_device msm_camera_sensor_ov5647 = {
700 .name = "msm_camera_ov5647",
701 .dev = {
702 .platform_data = &msm_camera_sensor_ov5647_data,
703 },
704};
705#endif
706
Chintan Pandya40762702011-12-06 13:47:06 +0530707#ifdef CONFIG_S5K4E1
708static struct msm_camera_sensor_platform_info s5k4e1_sensor_7627a_info = {
709 .mount_angle = 90
710};
711
712static struct msm_camera_sensor_flash_data flash_s5k4e1 = {
713 .flash_type = MSM_CAMERA_FLASH_LED,
714 .flash_src = &msm_flash_src
715};
716
717static struct msm_camera_sensor_info msm_camera_sensor_s5k4e1_data = {
718 .sensor_name = "s5k4e1",
719 .sensor_reset_enable = 1,
720 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N,
Su Liuaca04702012-02-14 02:27:32 +0530721 .pmic_gpio_enable = 0,
Chintan Pandya40762702011-12-06 13:47:06 +0530722 .sensor_pwd = 85,
723 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
724 .vcm_enable = 1,
725 .pdata = &msm_camera_device_data_rear,
726 .flash_data = &flash_s5k4e1,
727 .sensor_platform_info = &s5k4e1_sensor_7627a_info,
728 .csi_if = 1
729};
730
731static struct platform_device msm_camera_sensor_s5k4e1 = {
732 .name = "msm_camera_s5k4e1",
733 .dev = {
734 .platform_data = &msm_camera_sensor_s5k4e1_data,
735 },
736};
737#endif
738
739#ifdef CONFIG_IMX072
740static struct msm_camera_sensor_platform_info imx072_sensor_7627a_info = {
741 .mount_angle = 90
742};
743
744static struct msm_camera_sensor_flash_data flash_imx072 = {
745 .flash_type = MSM_CAMERA_FLASH_LED,
746 .flash_src = &msm_flash_src
747};
748
749static struct msm_camera_sensor_info msm_camera_sensor_imx072_data = {
750 .sensor_name = "imx072",
751 .sensor_reset_enable = 1,
752 .sensor_reset = GPIO_CAM_GP_CAMIF_RESET_N, /* TODO 106,*/
Su Liuaca04702012-02-14 02:27:32 +0530753 .pmic_gpio_enable = 0,
Chintan Pandya40762702011-12-06 13:47:06 +0530754 .sensor_pwd = 85,
755 .vcm_pwd = GPIO_CAM_GP_CAM_PWDN,
756 .vcm_enable = 1,
757 .pdata = &msm_camera_device_data_rear,
758 .flash_data = &flash_imx072,
759 .sensor_platform_info = &imx072_sensor_7627a_info,
760 .csi_if = 1
761};
762
763static struct platform_device msm_camera_sensor_imx072 = {
764 .name = "msm_camera_imx072",
765 .dev = {
766 .platform_data = &msm_camera_sensor_imx072_data,
767 },
768};
769#endif
770
Chintan Pandya40762702011-12-06 13:47:06 +0530771#ifdef CONFIG_WEBCAM_OV9726
Steve Mucklef132c6c2012-06-06 18:30:57 -0700772static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data;
Chintan Pandya40762702011-12-06 13:47:06 +0530773static struct msm_camera_sensor_platform_info ov9726_sensor_7627a_info = {
774 .mount_angle = 90
775};
776
777static struct msm_camera_sensor_flash_data flash_ov9726 = {
778 .flash_type = MSM_CAMERA_FLASH_NONE,
779 .flash_src = &msm_flash_src
780};
781
782static struct msm_camera_sensor_info msm_camera_sensor_ov9726_data = {
783 .sensor_name = "ov9726",
784 .sensor_reset_enable = 0,
785 .sensor_reset = GPIO_CAM_GP_CAM1MP_XCLR,
Su Liuaca04702012-02-14 02:27:32 +0530786 .pmic_gpio_enable = 0,
Chintan Pandya40762702011-12-06 13:47:06 +0530787 .sensor_pwd = 85,
788 .vcm_pwd = 1,
789 .vcm_enable = 0,
790 .pdata = &msm_camera_device_data_front,
791 .flash_data = &flash_ov9726,
792 .sensor_platform_info = &ov9726_sensor_7627a_info,
793 .csi_if = 1
794};
795
796static struct platform_device msm_camera_sensor_ov9726 = {
797 .name = "msm_camera_ov9726",
798 .dev = {
799 .platform_data = &msm_camera_sensor_ov9726_data,
800 },
801};
802#else
803static inline void msm_camera_vreg_init(void) { }
804#endif
805
806#ifdef CONFIG_MT9E013
807static struct msm_camera_sensor_platform_info mt9e013_sensor_7627a_info = {
808 .mount_angle = 90
809};
810
811static struct msm_camera_sensor_flash_data flash_mt9e013 = {
812 .flash_type = MSM_CAMERA_FLASH_LED,
813 .flash_src = &msm_flash_src
814};
815
816static struct msm_camera_sensor_info msm_camera_sensor_mt9e013_data = {
817 .sensor_name = "mt9e013",
818 .sensor_reset = 0,
819 .sensor_reset_enable = 1,
Su Liuaca04702012-02-14 02:27:32 +0530820 .pmic_gpio_enable = 0,
Chintan Pandya40762702011-12-06 13:47:06 +0530821 .sensor_pwd = 85,
822 .vcm_pwd = 1,
823 .vcm_enable = 0,
824 .pdata = &msm_camera_device_data_rear,
825 .flash_data = &flash_mt9e013,
826 .sensor_platform_info = &mt9e013_sensor_7627a_info,
827 .csi_if = 1
828};
829
830static struct platform_device msm_camera_sensor_mt9e013 = {
831 .name = "msm_camera_mt9e013",
832 .dev = {
833 .platform_data = &msm_camera_sensor_mt9e013_data,
834 },
835};
836#endif
837
838#ifdef CONFIG_OV5640
839static struct msm_camera_sensor_platform_info ov5640_sensor_info = {
840 .mount_angle = 90
841};
842
843static struct msm_camera_sensor_flash_src msm_flash_src_ov5640 = {
844 .flash_sr_type = MSM_CAMERA_FLASH_SRC_LED,
845 ._fsrc.led_src.led_name = "flashlight",
846 ._fsrc.led_src.led_name_len = 10,
847};
848
849static struct msm_camera_sensor_flash_data flash_ov5640 = {
850 .flash_type = MSM_CAMERA_FLASH_LED,
851 .flash_src = &msm_flash_src_ov5640,
852};
853
854static struct msm_camera_sensor_info msm_camera_sensor_ov5640_data = {
855 .sensor_name = "ov5640",
856 .sensor_reset_enable = 1,
Su Liuaca04702012-02-14 02:27:32 +0530857 .pmic_gpio_enable = 0,
Chintan Pandya40762702011-12-06 13:47:06 +0530858 .sensor_reset = QRD_GPIO_CAM_5MP_RESET,
859 .sensor_pwd = QRD_GPIO_CAM_5MP_SHDN_EN,
860 .vcm_pwd = 0,
861 .vcm_enable = 0,
862 .pdata = &msm_camera_device_data_rear,
863 .flash_data = &flash_ov5640,
864 .sensor_platform_info = &ov5640_sensor_info,
865 .csi_if = 1,
866};
867
868static struct platform_device msm_camera_sensor_ov5640 = {
869 .name = "msm_camera_ov5640",
870 .dev = {
871 .platform_data = &msm_camera_sensor_ov5640_data,
872 },
873};
874#endif
875
876#ifdef CONFIG_WEBCAM_OV7692_QRD
877static struct msm_camera_sensor_platform_info ov7692_sensor_7627a_info = {
878 .mount_angle = 90
879};
880
881static struct msm_camera_sensor_flash_data flash_ov7692 = {
882 .flash_type = MSM_CAMERA_FLASH_NONE,
883};
884
885static struct msm_camera_sensor_info msm_camera_sensor_ov7692_data = {
886 .sensor_name = "ov7692",
887 .sensor_reset_enable = 0,
Su Liuaca04702012-02-14 02:27:32 +0530888 .pmic_gpio_enable = 1,
889 .sensor_reset = GPIO_SKU1_CAM_VGA_RESET_N,
890 .sensor_pwd = GPIO_SKU1_CAM_VGA_SHDN,
Chintan Pandya40762702011-12-06 13:47:06 +0530891 .vcm_pwd = 0,
892 .vcm_enable = 0,
893 .pdata = &msm_camera_device_data_front,
894 .flash_data = &flash_ov7692,
895 .sensor_platform_info = &ov7692_sensor_7627a_info,
896 .csi_if = 1,
897};
898
899static struct platform_device msm_camera_sensor_ov7692 = {
900 .name = "msm_camera_ov7692",
901 .dev = {
902 .platform_data = &msm_camera_sensor_ov7692_data,
903 },
904};
905#endif
906
Chintan Pandya40762702011-12-06 13:47:06 +0530907static struct i2c_board_info i2c_camera_devices[] = {
908 #ifdef CONFIG_S5K4E1
909 {
910 I2C_BOARD_INFO("s5k4e1", 0x36),
911 },
912 {
913 I2C_BOARD_INFO("s5k4e1_af", 0x8c >> 1),
914 },
915 #endif
916 #ifdef CONFIG_WEBCAM_OV9726
917 {
918 I2C_BOARD_INFO("ov9726", 0x10),
919 },
920 #endif
921 #ifdef CONFIG_IMX072
922 {
923 I2C_BOARD_INFO("imx072", 0x34),
924 },
925 #endif
926 #ifdef CONFIG_MT9E013
927 {
928 I2C_BOARD_INFO("mt9e013", 0x6C >> 2),
929 },
930 #endif
931 {
932 I2C_BOARD_INFO("sc628a", 0x6E),
933 },
934};
935
936static struct i2c_board_info i2c_camera_devices_qrd[] = {
937 #ifdef CONFIG_OV5640
938 {
939 I2C_BOARD_INFO("ov5640", 0x78 >> 1),
940 },
941 #endif
942 #ifdef CONFIG_WEBCAM_OV7692_QRD
943 {
944 I2C_BOARD_INFO("ov7692", 0x78),
945 },
946 #endif
947};
948
Su Liuaca04702012-02-14 02:27:32 +0530949static struct i2c_board_info i2c_camera_devices_evb[] = {
950 #ifdef CONFIG_OV5647
951 {
952 I2C_BOARD_INFO("ov5647", 0x36 << 1),
953 },
954 {
955 I2C_BOARD_INFO("ov5647_af", 0x18 >> 1),
956 },
957 #endif
958 #ifdef CONFIG_WEBCAM_OV7692_QRD
959 {
960 I2C_BOARD_INFO("ov7692", 0x78),
961 },
962 #endif
963};
964
Chintan Pandya40762702011-12-06 13:47:06 +0530965static struct platform_device *camera_devices_msm[] __initdata = {
966#ifdef CONFIG_S5K4E1
967 &msm_camera_sensor_s5k4e1,
968#endif
969#ifdef CONFIG_IMX072
970 &msm_camera_sensor_imx072,
971#endif
972#ifdef CONFIG_WEBCAM_OV9726
973 &msm_camera_sensor_ov9726,
974#endif
975#ifdef CONFIG_MT9E013
976 &msm_camera_sensor_mt9e013,
977#endif
978};
979
980static struct platform_device *camera_devices_qrd[] __initdata = {
981#ifdef CONFIG_OV5640
982 &msm_camera_sensor_ov5640,
983#endif
984#ifdef CONFIG_WEBCAM_OV7692_QRD
985 &msm_camera_sensor_ov7692,
986#endif
987};
Su Liuaca04702012-02-14 02:27:32 +0530988
989static struct platform_device *camera_devices_evb[] __initdata = {
990#ifdef CONFIG_OV5647
991 &msm_camera_sensor_ov5647,
992#endif
993#ifdef CONFIG_WEBCAM_OV7692_QRD
994 &msm_camera_sensor_ov7692,
995#endif
Katta Santhisindhu16746f62012-06-08 13:35:07 +0530996 &msm_camera_sensor_ov8825,
Su Liuaca04702012-02-14 02:27:32 +0530997};
Suresh Vankadara87e195b2012-01-18 00:42:58 +0530998#endif
999
1000enum {
1001 SX150X_CAM,
1002};
1003
1004static struct sx150x_platform_data sx150x_data[] __initdata = {
1005 [SX150X_CAM] = {
1006 .gpio_base = GPIO_CAM_EXPANDER_BASE,
1007 .oscio_is_gpo = false,
1008 .io_pullup_ena = 0,
1009 .io_pulldn_ena = 0,
1010 .io_open_drain_ena = 0x23,
1011 .irq_summary = -1,
1012 },
1013};
1014
1015static struct i2c_board_info cam_exp_i2c_info[] __initdata = {
1016 {
1017 I2C_BOARD_INFO("sx1508q", 0x22),
1018 .platform_data = &sx150x_data[SX150X_CAM],
1019 },
1020};
Chintan Pandya40762702011-12-06 13:47:06 +05301021
1022static void __init register_i2c_devices(void)
1023{
1024 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1025 cam_exp_i2c_info,
1026 ARRAY_SIZE(cam_exp_i2c_info));
1027}
1028
Su Liuaca04702012-02-14 02:27:32 +05301029#define LCD_CAMERA_LDO_2V8 35 /* SKU1&SKU3 2.8V LDO */
1030#define SKU3_LCD_CAMERA_LDO_1V8 40 /* SKU3 1.8V LDO */
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301031#define SKU7_LCD_CAMERA_LDO_1V8 58 /* SKU7 1.8V LDO */
Su Liuaca04702012-02-14 02:27:32 +05301032
1033static int lcd_camera_ldo_1v8 = SKU3_LCD_CAMERA_LDO_1V8;
1034
1035static void lcd_camera_power_init(void)
1036{
1037 int rc = 0;
1038
1039 pr_debug("lcd_camera_power_init\n");
1040
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301041 if (machine_is_msm7627a_qrd3() || machine_is_msm8625_qrd7())
1042 lcd_camera_ldo_1v8 = SKU7_LCD_CAMERA_LDO_1V8;
1043 else
1044 lcd_camera_ldo_1v8 = SKU3_LCD_CAMERA_LDO_1V8;
Su Liuaca04702012-02-14 02:27:32 +05301045
1046 /* LDO_EXT2V8 */
1047 if (gpio_request(LCD_CAMERA_LDO_2V8, "lcd_camera_ldo_2v8")) {
1048 pr_err("failed to request gpio lcd_camera_ldo_2v8\n");
1049 return;
1050 }
1051
1052 rc = gpio_tlmm_config(GPIO_CFG(LCD_CAMERA_LDO_2V8, 0,
1053 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
1054 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1055 if (rc < 0) {
1056 pr_err("%s: unable to enable lcd_camera_ldo_2v8!\n", __func__);
1057 goto fail_gpio2;
1058 }
1059
1060 /* LDO_EVT1V8 */
1061 if (gpio_request(lcd_camera_ldo_1v8, "lcd_camera_ldo_1v8")) {
1062 pr_err("failed to request gpio lcd_camera_ldo_1v8\n");
1063 goto fail_gpio2;
1064 }
1065
1066 rc = gpio_tlmm_config(GPIO_CFG(lcd_camera_ldo_1v8, 0,
1067 GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN,
1068 GPIO_CFG_2MA), GPIO_CFG_ENABLE);
1069 if (rc < 0) {
1070 pr_err("%s: unable to enable lcd_camera_ldo_1v8!\n", __func__);
1071 goto fail_gpio1;
1072 }
1073
1074 return;
1075
1076fail_gpio1:
1077 gpio_free(lcd_camera_ldo_1v8);
1078fail_gpio2:
1079 gpio_free(LCD_CAMERA_LDO_2V8);
1080
1081 return;
1082}
1083
1084static int lcd_camera_power_on_sku3(void)
1085{
1086 int rc = 0;
1087
1088 pr_debug("turn on sku3 lcd_camera_ldo_1v8\n");
1089 gpio_set_value_cansleep(lcd_camera_ldo_1v8, 1);
1090
1091 pr_debug("turn on sku3 lcd_camera_ldo\n");
1092 gpio_set_value_cansleep(LCD_CAMERA_LDO_2V8, 1);
1093
1094 return rc;
1095}
1096
1097static int lcd_camera_power_off_sku3(void)
1098{
1099 int rc = 0;
1100
1101 pr_debug("turn off sku3 lcd_camera_ldo_1v8\n");
1102 gpio_set_value_cansleep(lcd_camera_ldo_1v8, 0);
1103
1104 pr_debug("turn off sku3 lcd_camera_ldo\n");
1105 gpio_set_value_cansleep(LCD_CAMERA_LDO_2V8, 0);
1106
1107 gpio_free(lcd_camera_ldo_1v8);
1108 gpio_free(LCD_CAMERA_LDO_2V8);
1109
1110 return rc;
1111}
1112
1113int lcd_camera_power_onoff(int on)
1114{
1115 int rc = 0;
1116
1117 pr_debug("lcd_camera_power_onoff on = %d,\n", on);
1118
1119 if (on)
1120 rc = lcd_camera_power_on_sku3();
1121 else
1122 rc = lcd_camera_power_off_sku3();
1123
1124 return rc;
1125}
1126EXPORT_SYMBOL(lcd_camera_power_onoff);
Su Liuaca04702012-02-14 02:27:32 +05301127
Chintan Pandya40762702011-12-06 13:47:06 +05301128void __init msm7627a_camera_init(void)
1129{
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +05301130
Sandeep Kodimelac6f78672012-03-07 10:44:04 +05301131#ifndef CONFIG_MSM_CAMERA_V4L2
Chintan Pandya40762702011-12-06 13:47:06 +05301132 int rc;
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +05301133#endif
Chintan Pandya40762702011-12-06 13:47:06 +05301134
Su Liuaca04702012-02-14 02:27:32 +05301135 pr_debug("msm7627a_camera_init Entered\n");
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301136
1137 if (machine_is_msm7627a_qrd3() || machine_is_msm8625_qrd7()) {
1138 ov7692_cam_req_gpio[0].gpio =
1139 GPIO_SKU7_CAM_VGA_SHDN;
1140 ov7692_cam_gpio_set_tbl[0].gpio = GPIO_SKU7_CAM_VGA_SHDN;
1141 ov7692_cam_gpio_set_tbl[1].gpio = GPIO_SKU7_CAM_VGA_SHDN;
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301142
1143 msm_camera_sensor_ov5647_data.sensor_pwd =
1144 GPIO_SKU7_CAM_5MP_SHDN_N;
1145 msm_camera_sensor_ov5647_data.sensor_reset =
1146 GPIO_SKU7_CAM_5MP_CAMIF_RESET;
1147
1148 }
1149
Su Liuaca04702012-02-14 02:27:32 +05301150 /* LCD and camera power (VREG & LDO) init */
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301151 if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301152 || machine_is_msm8625_evt()
1153 || machine_is_msm7627a_qrd3()
1154 || machine_is_msm8625_qrd7()) {
1155
Su Liuaca04702012-02-14 02:27:32 +05301156 lcd_camera_power_init();
Raju P.L.S.S.S.Ncea31512012-03-20 11:57:50 +05301157 evb_camera_gpio_cfg();
Raju P.L.S.S.S.Ncc400972012-03-13 10:09:59 +05301158 }
1159
1160#ifndef CONFIG_MSM_CAMERA_V4L2
Chintan Pandya40762702011-12-06 13:47:06 +05301161 if (machine_is_msm7627a_qrd1()) {
1162 qrd1_camera_gpio_cfg();
1163 platform_add_devices(camera_devices_qrd,
1164 ARRAY_SIZE(camera_devices_qrd));
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301165 } else if (machine_is_msm7627a_evb()
1166 || machine_is_msm8625_evb()
1167 || machine_is_msm8625_evt()
1168 || machine_is_msm7627a_qrd3()
1169 || machine_is_msm8625_qrd7()) {
Su Liuaca04702012-02-14 02:27:32 +05301170 platform_add_devices(camera_devices_evb,
1171 ARRAY_SIZE(camera_devices_evb));
1172 } else if (machine_is_msm7627a_qrd3())
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301173 return;
Taniya Dasc868a2e2012-01-03 10:18:47 +05301174 else
Chintan Pandya40762702011-12-06 13:47:06 +05301175 platform_add_devices(camera_devices_msm,
1176 ARRAY_SIZE(camera_devices_msm));
Suresh Vankadara87e195b2012-01-18 00:42:58 +05301177#endif
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301178 if (!machine_is_msm7627a_qrd1() || !machine_is_msm7627a_evb()
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301179 || !machine_is_msm8625_evb()
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301180 || !machine_is_msm8625_evt()
1181 || !machine_is_msm7627a_qrd3()
1182 || !machine_is_msm8625_qrd7())
Chintan Pandya40762702011-12-06 13:47:06 +05301183 register_i2c_devices();
Sandeep Kodimelac6f78672012-03-07 10:44:04 +05301184#ifndef CONFIG_MSM_CAMERA_V4L2
Chintan Pandya40762702011-12-06 13:47:06 +05301185 rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);
1186
1187 if (rc) {
1188 pr_err("%s: could not get regulators: %d\n", __func__, rc);
1189 return;
1190 }
1191
1192 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);
1193
1194 if (rc) {
1195 pr_err("%s: could not set voltages: %d\n", __func__, rc);
1196 return;
1197 }
Sandeep Kodimelac6f78672012-03-07 10:44:04 +05301198#endif
Chintan Pandya40762702011-12-06 13:47:06 +05301199
Suresh Vankadara87e195b2012-01-18 00:42:58 +05301200#if defined(CONFIG_MSM_CAMERA_V4L2)
1201 msm7x27a_init_cam();
1202#endif
1203#ifndef CONFIG_MSM_CAMERA_V4L2
Su Liuaca04702012-02-14 02:27:32 +05301204 if (machine_is_msm7627a_qrd1()) {
Chintan Pandya40762702011-12-06 13:47:06 +05301205 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1206 i2c_camera_devices_qrd,
1207 ARRAY_SIZE(i2c_camera_devices_qrd));
Raju P.L.S.S.S.Nc71e1a82012-05-15 13:42:50 +05301208 } else if (machine_is_msm7627a_evb()
1209 || machine_is_msm8625_evb()
1210 || machine_is_msm8625_evt()
1211 || machine_is_msm7627a_qrd3()
1212 || machine_is_msm8625_qrd7()) {
Su Liuaca04702012-02-14 02:27:32 +05301213 pr_debug("machine_is_msm7627a_evb i2c_register_board_info\n");
1214 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1215 i2c_camera_devices_evb,
1216 ARRAY_SIZE(i2c_camera_devices_evb));
1217 } else
Suresh Vankadara87e195b2012-01-18 00:42:58 +05301218#endif
Sandeep Kodimelac6f78672012-03-07 10:44:04 +05301219 pr_debug("i2c_register_board_info\n");
Chintan Pandya40762702011-12-06 13:47:06 +05301220 i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
1221 i2c_camera_devices,
1222 ARRAY_SIZE(i2c_camera_devices));
1223}