blob: 6d2c25a85d4b14aa0109321b80dbc9f08a9aeee2 [file] [log] [blame]
Jeyaprakash Soundrapandian2474e8f2012-01-03 15:59:57 -08001/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
14#ifndef __ASM__ARCH_CAMERA_H
15#define __ASM__ARCH_CAMERA_H
16
17#include <linux/list.h>
18#include <linux/poll.h>
19#include <linux/cdev.h>
20#include <linux/platform_device.h>
Stephen Boyd2fcabf92012-05-30 10:41:11 -070021#include <linux/pm_qos.h>
Kevin Chaneb6b6072012-01-17 11:54:54 -080022#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include "linux/types.h"
24
25#include <mach/board.h>
26#include <media/msm_camera.h>
Ankit Premrajka748a70a2011-11-01 08:22:04 -070027#include <linux/ion.h>
Laura Abbott5b1e6f12012-05-28 08:13:55 -070028#include <mach/iommu_domains.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029
30#define CONFIG_MSM_CAMERA_DEBUG
31#ifdef CONFIG_MSM_CAMERA_DEBUG
32#define CDBG(fmt, args...) pr_debug(fmt, ##args)
33#else
34#define CDBG(fmt, args...) do { } while (0)
35#endif
36
37#define PAD_TO_2K(a, b) ((!b) ? a : (((a)+2047) & ~2047))
38
39#define MSM_CAMERA_MSG 0
40#define MSM_CAMERA_EVT 1
41#define NUM_WB_EXP_NEUTRAL_REGION_LINES 4
42#define NUM_WB_EXP_STAT_OUTPUT_BUFFERS 3
43#define NUM_AUTOFOCUS_MULTI_WINDOW_GRIDS 16
44#define NUM_STAT_OUTPUT_BUFFERS 3
45#define NUM_AF_STAT_OUTPUT_BUFFERS 3
Mingcheng Zhu996be182011-10-16 16:04:23 -070046#define max_control_command_size 512
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#define CROP_LEN 36
48
49enum vfe_mode_of_operation{
50 VFE_MODE_OF_OPERATION_CONTINUOUS,
51 VFE_MODE_OF_OPERATION_SNAPSHOT,
52 VFE_MODE_OF_OPERATION_VIDEO,
53 VFE_MODE_OF_OPERATION_RAW_SNAPSHOT,
54 VFE_MODE_OF_OPERATION_ZSL,
Jignesh Mehta6cf8a742012-02-04 23:40:50 -080055 VFE_MODE_OF_OPERATION_JPEG_SNAPSHOT,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056 VFE_LAST_MODE_OF_OPERATION_ENUM
57};
58
59enum msm_queue {
60 MSM_CAM_Q_CTRL, /* control command or control command status */
61 MSM_CAM_Q_VFE_EVT, /* adsp event */
62 MSM_CAM_Q_VFE_MSG, /* adsp message */
63 MSM_CAM_Q_V4L2_REQ, /* v4l2 request */
64 MSM_CAM_Q_VPE_MSG, /* vpe message */
65 MSM_CAM_Q_PP_MSG, /* pp message */
66};
67
68enum vfe_resp_msg {
69 VFE_EVENT,
70 VFE_MSG_GENERAL,
71 VFE_MSG_SNAPSHOT,
72 VFE_MSG_OUTPUT_P, /* preview (continuous mode ) */
73 VFE_MSG_OUTPUT_T, /* thumbnail (snapshot mode )*/
74 VFE_MSG_OUTPUT_S, /* main image (snapshot mode )*/
75 VFE_MSG_OUTPUT_V, /* video (continuous mode ) */
76 VFE_MSG_STATS_AEC,
77 VFE_MSG_STATS_AF,
78 VFE_MSG_STATS_AWB,
Kiran Kumar H Ndd128472011-12-01 09:35:34 -080079 VFE_MSG_STATS_RS, /* 10 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080 VFE_MSG_STATS_CS,
81 VFE_MSG_STATS_IHIST,
82 VFE_MSG_STATS_SKIN,
83 VFE_MSG_STATS_WE, /* AEC + AWB */
84 VFE_MSG_SYNC_TIMER0,
85 VFE_MSG_SYNC_TIMER1,
86 VFE_MSG_SYNC_TIMER2,
87 VFE_MSG_COMMON,
Kiran Kumar H N0fb9dcf2011-07-17 12:31:53 -070088 VFE_MSG_V32_START,
Kiran Kumar H Ndd128472011-12-01 09:35:34 -080089 VFE_MSG_V32_START_RECORDING, /* 20 */
Kiran Kumar H N0fb9dcf2011-07-17 12:31:53 -070090 VFE_MSG_V32_CAPTURE,
Jignesh Mehta6cf8a742012-02-04 23:40:50 -080091 VFE_MSG_V32_JPEG_CAPTURE,
Kiran Kumar H N0fb9dcf2011-07-17 12:31:53 -070092 VFE_MSG_OUTPUT_IRQ,
Suresh Vankadara055cb8e2012-01-18 00:50:04 +053093 VFE_MSG_V2X_PREVIEW,
94 VFE_MSG_V2X_CAPTURE,
Kiran Kumar H Ndd128472011-12-01 09:35:34 -080095 VFE_MSG_OUTPUT_PRIMARY,
96 VFE_MSG_OUTPUT_SECONDARY,
Nishant Pandit28feb3d2012-04-26 23:56:22 +053097 VFE_MSG_OUTPUT_TERTIARY1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098};
99
100enum vpe_resp_msg {
101 VPE_MSG_GENERAL,
102 VPE_MSG_OUTPUT_V, /* video (continuous mode ) */
103 VPE_MSG_OUTPUT_ST_L,
104 VPE_MSG_OUTPUT_ST_R,
105};
106
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107enum msm_stereo_state {
108 STEREO_VIDEO_IDLE,
109 STEREO_VIDEO_ACTIVE,
110 STEREO_SNAP_IDLE,
111 STEREO_SNAP_STARTED,
112 STEREO_SNAP_BUFFER1_PROCESSING,
113 STEREO_SNAP_BUFFER2_PROCESSING,
114 STEREO_RAW_SNAP_IDLE,
115 STEREO_RAW_SNAP_STARTED,
116};
117
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700118struct msm_vpe_phy_info {
119 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530120 uint32_t planar0_off;
121 uint32_t planar1_off;
122 uint32_t planar2_off;
123 uint32_t p0_phy;
124 uint32_t p1_phy;
125 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
127 uint32_t frame_id;
128};
129
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700130struct msm_camera_csid_lut_params {
131 uint8_t num_cid;
132 struct msm_camera_csid_vc_cfg *vc_cfg;
133};
134
135struct msm_camera_csid_params {
136 uint8_t lane_cnt;
137 uint8_t lane_assign;
138 struct msm_camera_csid_lut_params lut_params;
139};
140
141struct msm_camera_csiphy_params {
142 uint8_t lane_cnt;
143 uint8_t settle_cnt;
Hody Hung9ba65cf2012-01-17 17:34:51 -0800144 uint8_t lane_mask;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700145};
146
Kevin Chana980f392011-08-01 20:55:00 -0700147struct msm_camera_csi2_params {
148 struct msm_camera_csid_params csid_params;
149 struct msm_camera_csiphy_params csiphy_params;
150};
151
Kevin Chan3be11612012-03-22 20:05:40 -0700152#ifndef CONFIG_MSM_CAMERA_V4L2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153#define VFE31_OUTPUT_MODE_PT (0x1 << 0)
154#define VFE31_OUTPUT_MODE_S (0x1 << 1)
155#define VFE31_OUTPUT_MODE_V (0x1 << 2)
156#define VFE31_OUTPUT_MODE_P (0x1 << 3)
157#define VFE31_OUTPUT_MODE_T (0x1 << 4)
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530158#define VFE31_OUTPUT_MODE_P_ALL_CHNLS (0x1 << 5)
Kevin Chan3be11612012-03-22 20:05:40 -0700159#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700160
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161struct msm_vfe_phy_info {
162 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530163 uint32_t planar0_off;
164 uint32_t planar1_off;
165 uint32_t planar2_off;
166 uint32_t p0_phy;
167 uint32_t p1_phy;
168 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
170 uint32_t frame_id;
171};
172
173struct msm_vfe_stats_msg {
Lakshmi Narayana Kalavala4ab97a92011-07-26 15:30:14 -0700174 uint8_t awb_ymin;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700175 uint32_t aec_buff;
176 uint32_t awb_buff;
177 uint32_t af_buff;
178 uint32_t ihist_buff;
179 uint32_t rs_buff;
180 uint32_t cs_buff;
181 uint32_t skin_buff;
182 uint32_t status_bits;
183 uint32_t frame_id;
184};
185
186struct video_crop_t{
187 uint32_t in1_w;
188 uint32_t out1_w;
189 uint32_t in1_h;
190 uint32_t out1_h;
191 uint32_t in2_w;
192 uint32_t out2_w;
193 uint32_t in2_h;
194 uint32_t out2_h;
195 uint8_t update_flag;
196};
197
198struct msm_vpe_buf_info {
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530199 uint32_t p0_phy;
200 uint32_t p1_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201 struct timespec ts;
202 uint32_t frame_id;
203 struct video_crop_t vpe_crop;
204};
205
206struct msm_vfe_resp {
207 enum vfe_resp_msg type;
208 struct msm_cam_evt_msg evt_msg;
209 struct msm_vfe_phy_info phy;
210 struct msm_vfe_stats_msg stats_msg;
211 struct msm_vpe_buf_info vpe_bf;
212 void *extdata;
213 int32_t extlen;
214};
215
216struct msm_vpe_resp {
217 enum vpe_resp_msg type;
218 struct msm_cam_evt_msg evt_msg;
219 struct msm_vpe_phy_info phy;
220 void *extdata;
221 int32_t extlen;
222};
223
224struct msm_vpe_callback {
225 void (*vpe_resp)(struct msm_vpe_resp *,
226 enum msm_queue, void *syncdata,
227 void *time_stamp, gfp_t gfp);
228 void* (*vpe_alloc)(int, void *syncdata, gfp_t gfp);
229 void (*vpe_free)(void *ptr);
230};
231
232struct msm_vfe_callback {
233 void (*vfe_resp)(struct msm_vfe_resp *,
234 enum msm_queue, void *syncdata,
235 gfp_t gfp);
236 void* (*vfe_alloc)(int, void *syncdata, gfp_t gfp);
237 void (*vfe_free)(void *ptr);
238};
239
240struct msm_camvfe_fn {
241 int (*vfe_init)(struct msm_vfe_callback *,
242 struct platform_device *);
243 int (*vfe_enable)(struct camera_enable_cmd *);
244 int (*vfe_config)(struct msm_vfe_cfg_cmd *, void *);
245 int (*vfe_disable)(struct camera_enable_cmd *,
246 struct platform_device *dev);
247 void (*vfe_release)(struct platform_device *);
248 void (*vfe_stop)(void);
249};
250
251struct msm_camvfe_params {
252 struct msm_vfe_cfg_cmd *vfe_cfg;
253 void *data;
254};
255
Mingcheng Zhu8e9f99e2011-08-26 16:33:32 -0700256struct msm_mctl_pp_params {
257 struct msm_mctl_pp_cmd *cmd;
258 void *data;
259};
260
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261struct msm_camvpe_fn {
262 int (*vpe_reg)(struct msm_vpe_callback *);
263 int (*vpe_cfg_update) (void *);
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530264 void (*send_frame_to_vpe) (uint32_t planar0_off, uint32_t planar1_off,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265 struct timespec *ts, int output_id);
266 int (*vpe_config)(struct msm_vpe_cfg_cmd *, void *);
267 void (*vpe_cfg_offset)(int frame_pack, uint32_t pyaddr,
268 uint32_t pcbcraddr, struct timespec *ts, int output_id,
269 struct msm_st_half st_half, int frameid);
270 int *dis;
271};
272
273struct msm_sensor_ctrl {
274 int (*s_init)(const struct msm_camera_sensor_info *);
275 int (*s_release)(void);
276 int (*s_config)(void __user *);
277 enum msm_camera_type s_camera_type;
278 uint32_t s_mount_angle;
279 enum msm_st_frame_packing s_video_packing;
280 enum msm_st_frame_packing s_snap_packing;
281};
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700282
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700283struct msm_strobe_flash_ctrl {
284 int (*strobe_flash_init)
285 (struct msm_camera_sensor_strobe_flash_data *);
286 int (*strobe_flash_release)
287 (struct msm_camera_sensor_strobe_flash_data *, int32_t);
288 int (*strobe_flash_charge)(int32_t, int32_t, uint32_t);
289};
290
291/* this structure is used in kernel */
292struct msm_queue_cmd {
293 struct list_head list_config;
294 struct list_head list_control;
295 struct list_head list_frame;
296 struct list_head list_pict;
297 struct list_head list_vpe_frame;
Kevin Chan94b4c832012-03-02 21:27:16 -0800298 struct list_head list_eventdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700299 enum msm_queue type;
300 void *command;
301 atomic_t on_heap;
302 struct timespec ts;
303 uint32_t error_code;
304};
305
306struct msm_device_queue {
307 struct list_head list;
308 spinlock_t lock;
309 wait_queue_head_t wait;
310 int max;
311 int len;
312 const char *name;
313};
314
Kevin Chan047053e2012-04-19 11:30:33 -0700315struct msm_mctl_stats_t {
316 struct hlist_head pmem_stats_list;
317 spinlock_t pmem_stats_spinlock;
318};
319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320struct msm_sync {
321 /* These two queues are accessed from a process context only
322 * They contain pmem descriptors for the preview frames and the stats
323 * coming from the camera sensor.
324 */
325 struct hlist_head pmem_frames;
326 struct hlist_head pmem_stats;
327
328 /* The message queue is used by the control thread to send commands
329 * to the config thread, and also by the DSP to send messages to the
330 * config thread. Thus it is the only queue that is accessed from
331 * both interrupt and process context.
332 */
333 struct msm_device_queue event_q;
334
335 /* This queue contains preview frames. It is accessed by the DSP (in
336 * in interrupt context, and by the frame thread.
337 */
338 struct msm_device_queue frame_q;
339 int unblock_poll_frame;
340 int unblock_poll_pic_frame;
341
342 /* This queue contains snapshot frames. It is accessed by the DSP (in
343 * interrupt context, and by the control thread.
344 */
345 struct msm_device_queue pict_q;
346 int get_pic_abort;
347 struct msm_device_queue vpe_q;
348
349 struct msm_camera_sensor_info *sdata;
350 struct msm_camvfe_fn vfefn;
351 struct msm_camvpe_fn vpefn;
352 struct msm_sensor_ctrl sctrl;
353 struct msm_strobe_flash_ctrl sfctrl;
Stephen Boyd2fcabf92012-05-30 10:41:11 -0700354 struct pm_qos_request idle_pm_qos;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355 struct platform_device *pdev;
356 int16_t ignore_qcmd_type;
357 uint8_t ignore_qcmd;
358 uint8_t opencnt;
359 void *cropinfo;
360 int croplen;
361 int core_powered_on;
362
363 struct fd_roi_info fdroiinfo;
364
365 atomic_t vpe_enable;
366 uint32_t pp_mask;
367 uint8_t pp_frame_avail;
368 struct msm_queue_cmd *pp_prev;
369 struct msm_queue_cmd *pp_snap;
370 struct msm_queue_cmd *pp_thumb;
371 int video_fd;
372
373 const char *apps_id;
374
375 struct mutex lock;
376 struct list_head list;
377 uint8_t liveshot_enabled;
378 struct msm_cam_v4l2_device *pcam_sync;
379
380 uint8_t stereocam_enabled;
381 struct msm_queue_cmd *pp_stereocam;
382 struct msm_queue_cmd *pp_stereocam2;
383 struct msm_queue_cmd *pp_stereosnap;
384 enum msm_stereo_state stereo_state;
385 int stcam_quality_ind;
386 uint32_t stcam_conv_value;
387
388 spinlock_t pmem_frame_spinlock;
389 spinlock_t pmem_stats_spinlock;
390 spinlock_t abort_pict_lock;
391 int snap_count;
392 int thumb_count;
393};
394
395#define MSM_APPS_ID_V4L2 "msm_v4l2"
396#define MSM_APPS_ID_PROP "msm_qct"
397
398struct msm_cam_device {
399 struct msm_sync *sync; /* most-frequently accessed */
400 struct device *device;
401 struct cdev cdev;
402 /* opened is meaningful only for the config and frame nodes,
403 * which may be opened only once.
404 */
405 atomic_t opened;
406};
407
408struct msm_control_device {
409 struct msm_cam_device *pmsm;
410
411 /* Used for MSM_CAM_IOCTL_CTRL_CMD_DONE responses */
412 uint8_t ctrl_data[max_control_command_size];
413 struct msm_ctrl_cmd ctrl;
414 struct msm_queue_cmd qcmd;
415
416 /* This queue used by the config thread to send responses back to the
417 * control thread. It is accessed only from a process context.
418 */
419 struct msm_device_queue ctrl_q;
420};
421
422struct register_address_value_pair {
423 uint16_t register_address;
424 uint16_t register_value;
425};
426
427struct msm_pmem_region {
428 struct hlist_node list;
429 unsigned long paddr;
430 unsigned long len;
431 struct file *file;
432 struct msm_pmem_info info;
Ankit Premrajka748a70a2011-11-01 08:22:04 -0700433 struct ion_handle *handle;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700434};
435
436struct axidata {
437 uint32_t bufnum1;
438 uint32_t bufnum2;
439 uint32_t bufnum3;
440 struct msm_pmem_region *region;
441};
442
443#ifdef CONFIG_MSM_CAMERA_FLASH
444int msm_camera_flash_set_led_state(
445 struct msm_camera_sensor_flash_data *fdata,
446 unsigned led_state);
447int msm_strobe_flash_init(struct msm_sync *sync, uint32_t sftype);
448int msm_flash_ctrl(struct msm_camera_sensor_info *sdata,
449 struct flash_ctrl_data *flash_info);
450#else
451static inline int msm_camera_flash_set_led_state(
452 struct msm_camera_sensor_flash_data *fdata,
453 unsigned led_state)
454{
455 return -ENOTSUPP;
456}
457static inline int msm_strobe_flash_init(
458 struct msm_sync *sync, uint32_t sftype)
459{
460 return -ENOTSUPP;
461}
462static inline int msm_flash_ctrl(
463 struct msm_camera_sensor_info *sdata,
464 struct flash_ctrl_data *flash_info)
465{
466 return -ENOTSUPP;
467}
468#endif
469
470
471
472void msm_camvfe_init(void);
473int msm_camvfe_check(void *);
474void msm_camvfe_fn_init(struct msm_camvfe_fn *, void *);
475void msm_camvpe_fn_init(struct msm_camvpe_fn *, void *);
476int msm_camera_drv_start(struct platform_device *dev,
477 int (*sensor_probe)(const struct msm_camera_sensor_info *,
478 struct msm_sensor_ctrl *));
479
480enum msm_camio_clk_type {
481 CAMIO_VFE_MDC_CLK,
482 CAMIO_MDC_CLK,
483 CAMIO_VFE_CLK,
484 CAMIO_VFE_AXI_CLK,
485
486 CAMIO_VFE_CAMIF_CLK,
487 CAMIO_VFE_PBDG_CLK,
488 CAMIO_CAM_MCLK_CLK,
489 CAMIO_CAMIF_PAD_PBDG_CLK,
490
491 CAMIO_CSI0_VFE_CLK,
492 CAMIO_CSI1_VFE_CLK,
493 CAMIO_VFE_PCLK,
494
495 CAMIO_CSI_SRC_CLK,
496 CAMIO_CSI0_CLK,
497 CAMIO_CSI1_CLK,
498 CAMIO_CSI0_PCLK,
499 CAMIO_CSI1_PCLK,
500
501 CAMIO_CSI1_SRC_CLK,
502 CAMIO_CSI_PIX_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700503 CAMIO_CSI_PIX1_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504 CAMIO_CSI_RDI_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700505 CAMIO_CSI_RDI1_CLK,
506 CAMIO_CSI_RDI2_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700507 CAMIO_CSIPHY0_TIMER_CLK,
508 CAMIO_CSIPHY1_TIMER_CLK,
509
510 CAMIO_JPEG_CLK,
511 CAMIO_JPEG_PCLK,
512 CAMIO_VPE_CLK,
513 CAMIO_VPE_PCLK,
514
515 CAMIO_CSI0_PHY_CLK,
516 CAMIO_CSI1_PHY_CLK,
517 CAMIO_CSIPHY_TIMER_SRC_CLK,
Jignesh Mehta95dd6e12011-11-18 17:21:16 -0800518 CAMIO_IMEM_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519
520 CAMIO_MAX_CLK
521};
522
523enum msm_camio_clk_src_type {
524 MSM_CAMIO_CLK_SRC_INTERNAL,
525 MSM_CAMIO_CLK_SRC_EXTERNAL,
526 MSM_CAMIO_CLK_SRC_MAX
527};
528
529enum msm_s_test_mode {
530 S_TEST_OFF,
531 S_TEST_1,
532 S_TEST_2,
533 S_TEST_3
534};
535
536enum msm_s_resolution {
537 S_QTR_SIZE,
538 S_FULL_SIZE,
539 S_INVALID_SIZE
540};
541
542enum msm_s_reg_update {
543 /* Sensor egisters that need to be updated during initialization */
544 S_REG_INIT,
545 /* Sensor egisters that needs periodic I2C writes */
546 S_UPDATE_PERIODIC,
547 /* All the sensor Registers will be updated */
548 S_UPDATE_ALL,
549 /* Not valid update */
550 S_UPDATE_INVALID
551};
552
553enum msm_s_setting {
554 S_RES_PREVIEW,
555 S_RES_CAPTURE
556};
557
558enum msm_bus_perf_setting {
559 S_INIT,
560 S_PREVIEW,
561 S_VIDEO,
562 S_CAPTURE,
563 S_ZSL,
564 S_STEREO_VIDEO,
565 S_STEREO_CAPTURE,
566 S_DEFAULT,
567 S_EXIT
568};
569
Kevin Chan85af4552011-10-25 15:07:58 -0700570struct msm_cam_clk_info {
571 const char *clk_name;
572 long clk_rate;
573};
574
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700575int msm_camio_enable(struct platform_device *dev);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576int msm_camio_vpe_clk_enable(uint32_t);
577int msm_camio_vpe_clk_disable(void);
578
Kevin Chanbb8ef862012-02-14 13:03:04 -0800579void msm_camio_mode_config(enum msm_camera_i2c_mux_mode mode);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700580int msm_camio_clk_enable(enum msm_camio_clk_type clk);
581int msm_camio_clk_disable(enum msm_camio_clk_type clk);
582int msm_camio_clk_config(uint32_t freq);
583void msm_camio_clk_rate_set(int rate);
Shuzhen Wange49436a2011-09-28 16:07:27 -0700584int msm_camio_vfe_clk_rate_set(int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585void msm_camio_clk_rate_set_2(struct clk *clk, int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700586void msm_camio_clk_axi_rate_set(int rate);
587void msm_disable_io_gpio_clk(struct platform_device *);
588
589void msm_camio_camif_pad_reg_reset(void);
590void msm_camio_camif_pad_reg_reset_2(void);
591
592void msm_camio_vfe_blk_reset(void);
Suresh Vankadara3a9722a2012-05-21 10:09:05 +0530593void msm_camio_vfe_blk_reset_2(void);
594void msm_camio_vfe_blk_reset_3(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595
Nishant Pandit24153d82011-08-27 16:05:13 +0530596int32_t msm_camio_3d_enable(const struct msm_camera_sensor_info *sinfo);
597void msm_camio_3d_disable(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598void msm_camio_clk_sel(enum msm_camio_clk_src_type);
599void msm_camio_disable(struct platform_device *);
600int msm_camio_probe_on(struct platform_device *);
601int msm_camio_probe_off(struct platform_device *);
602int msm_camio_sensor_clk_off(struct platform_device *);
603int msm_camio_sensor_clk_on(struct platform_device *);
604int msm_camio_csi_config(struct msm_camera_csi_params *csi_params);
605int msm_camio_csiphy_config(struct msm_camera_csiphy_params *csiphy_params);
606int msm_camio_csid_config(struct msm_camera_csid_params *csid_params);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607int add_axi_qos(void);
608int update_axi_qos(uint32_t freq);
609void release_axi_qos(void);
Kiran Kumar H N3ee46812012-04-13 16:57:57 -0700610void msm_camera_io_w(u32 data, void __iomem *addr);
611void msm_camera_io_w_mb(u32 data, void __iomem *addr);
612u32 msm_camera_io_r(void __iomem *addr);
613u32 msm_camera_io_r_mb(void __iomem *addr);
614void msm_camera_io_dump(void __iomem *addr, int size);
615void msm_camera_io_memcpy(void __iomem *dest_addr,
616 void __iomem *src_addr, u32 len);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617void msm_camio_set_perf_lvl(enum msm_bus_perf_setting);
Kevin Chan09f4e662011-12-16 08:17:02 -0800618void msm_camio_bus_scale_cfg(
619 struct msm_bus_scale_pdata *, enum msm_bus_perf_setting);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700621void *msm_isp_sync_alloc(int size, gfp_t gfp);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700622
623void msm_isp_sync_free(void *ptr);
Kevin Chan85af4552011-10-25 15:07:58 -0700624
625int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
626 struct clk **clk_ptr, int num_clk, int enable);
Jeyaprakash Soundrapandian2474e8f2012-01-03 15:59:57 -0800627int msm_cam_core_reset(void);
Kevin Chaneb6b6072012-01-17 11:54:54 -0800628
629int msm_camera_config_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
630 int num_vreg, struct regulator **reg_ptr, int config);
631int msm_camera_enable_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
632 int num_vreg, struct regulator **reg_ptr, int enable);
633
634int msm_camera_config_gpio_table
635 (struct msm_camera_sensor_info *sinfo, int gpio_en);
636int msm_camera_request_gpio_table
637 (struct msm_camera_sensor_info *sinfo, int gpio_en);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638#endif