blob: 1abfd7b052cfe715fe92d503de812484d3d00fc2 [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>
21#include <linux/wakelock.h>
22#include "linux/types.h"
23
24#include <mach/board.h>
25#include <media/msm_camera.h>
Ankit Premrajkac6864b82011-07-15 11:43:41 -070026#include <mach/msm_subsystem_map.h>
Ankit Premrajka748a70a2011-11-01 08:22:04 -070027#include <linux/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028
29#define CONFIG_MSM_CAMERA_DEBUG
30#ifdef CONFIG_MSM_CAMERA_DEBUG
31#define CDBG(fmt, args...) pr_debug(fmt, ##args)
32#else
33#define CDBG(fmt, args...) do { } while (0)
34#endif
35
36#define PAD_TO_2K(a, b) ((!b) ? a : (((a)+2047) & ~2047))
37
38#define MSM_CAMERA_MSG 0
39#define MSM_CAMERA_EVT 1
40#define NUM_WB_EXP_NEUTRAL_REGION_LINES 4
41#define NUM_WB_EXP_STAT_OUTPUT_BUFFERS 3
42#define NUM_AUTOFOCUS_MULTI_WINDOW_GRIDS 16
43#define NUM_STAT_OUTPUT_BUFFERS 3
44#define NUM_AF_STAT_OUTPUT_BUFFERS 3
Mingcheng Zhu996be182011-10-16 16:04:23 -070045#define max_control_command_size 512
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#define CROP_LEN 36
47
48enum vfe_mode_of_operation{
49 VFE_MODE_OF_OPERATION_CONTINUOUS,
50 VFE_MODE_OF_OPERATION_SNAPSHOT,
51 VFE_MODE_OF_OPERATION_VIDEO,
52 VFE_MODE_OF_OPERATION_RAW_SNAPSHOT,
53 VFE_MODE_OF_OPERATION_ZSL,
54 VFE_LAST_MODE_OF_OPERATION_ENUM
55};
56
57enum msm_queue {
58 MSM_CAM_Q_CTRL, /* control command or control command status */
59 MSM_CAM_Q_VFE_EVT, /* adsp event */
60 MSM_CAM_Q_VFE_MSG, /* adsp message */
61 MSM_CAM_Q_V4L2_REQ, /* v4l2 request */
62 MSM_CAM_Q_VPE_MSG, /* vpe message */
63 MSM_CAM_Q_PP_MSG, /* pp message */
64};
65
66enum vfe_resp_msg {
67 VFE_EVENT,
68 VFE_MSG_GENERAL,
69 VFE_MSG_SNAPSHOT,
70 VFE_MSG_OUTPUT_P, /* preview (continuous mode ) */
71 VFE_MSG_OUTPUT_T, /* thumbnail (snapshot mode )*/
72 VFE_MSG_OUTPUT_S, /* main image (snapshot mode )*/
73 VFE_MSG_OUTPUT_V, /* video (continuous mode ) */
74 VFE_MSG_STATS_AEC,
75 VFE_MSG_STATS_AF,
76 VFE_MSG_STATS_AWB,
77 VFE_MSG_STATS_RS,
78 VFE_MSG_STATS_CS,
79 VFE_MSG_STATS_IHIST,
80 VFE_MSG_STATS_SKIN,
81 VFE_MSG_STATS_WE, /* AEC + AWB */
82 VFE_MSG_SYNC_TIMER0,
83 VFE_MSG_SYNC_TIMER1,
84 VFE_MSG_SYNC_TIMER2,
85 VFE_MSG_COMMON,
Kiran Kumar H N0fb9dcf2011-07-17 12:31:53 -070086 VFE_MSG_V32_START,
87 VFE_MSG_V32_START_RECORDING,
88 VFE_MSG_V32_CAPTURE,
89 VFE_MSG_OUTPUT_IRQ,
Suresh Vankadara055cb8e2012-01-18 00:50:04 +053090 VFE_MSG_V2X_PREVIEW,
91 VFE_MSG_V2X_CAPTURE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092};
93
94enum vpe_resp_msg {
95 VPE_MSG_GENERAL,
96 VPE_MSG_OUTPUT_V, /* video (continuous mode ) */
97 VPE_MSG_OUTPUT_ST_L,
98 VPE_MSG_OUTPUT_ST_R,
99};
100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700101enum msm_stereo_state {
102 STEREO_VIDEO_IDLE,
103 STEREO_VIDEO_ACTIVE,
104 STEREO_SNAP_IDLE,
105 STEREO_SNAP_STARTED,
106 STEREO_SNAP_BUFFER1_PROCESSING,
107 STEREO_SNAP_BUFFER2_PROCESSING,
108 STEREO_RAW_SNAP_IDLE,
109 STEREO_RAW_SNAP_STARTED,
110};
111
112enum msm_ispif_intftype {
113 PIX0,
114 RDI0,
115 PIX1,
116 RDI1,
117 PIX2,
118 RDI2,
119};
120
121enum msm_ispif_vc {
122 VC0,
123 VC1,
124 VC2,
125 VC3,
126};
127
128enum msm_ispif_cid {
129 CID0,
130 CID1,
131 CID2,
132 CID3,
133 CID4,
134 CID5,
135 CID6,
136 CID7,
137 CID8,
138 CID9,
139 CID10,
140 CID11,
141 CID12,
142 CID13,
143 CID14,
144 CID15,
145};
146
147struct msm_ispif_params {
148 uint8_t intftype;
149 uint16_t cid_mask;
150 uint8_t csid;
151};
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700152
153struct msm_ispif_params_list {
154 uint32_t len;
155 struct msm_ispif_params params[3];
156};
157
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700158struct msm_vpe_phy_info {
159 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530160 uint32_t planar0_off;
161 uint32_t planar1_off;
162 uint32_t planar2_off;
163 uint32_t p0_phy;
164 uint32_t p1_phy;
165 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
167 uint32_t frame_id;
168};
169
170struct msm_camera_csid_vc_cfg {
171 uint8_t cid;
172 uint8_t dt;
173 uint8_t decode_format;
174};
175
176struct msm_camera_csid_lut_params {
177 uint8_t num_cid;
178 struct msm_camera_csid_vc_cfg *vc_cfg;
179};
180
181struct msm_camera_csid_params {
182 uint8_t lane_cnt;
183 uint8_t lane_assign;
184 struct msm_camera_csid_lut_params lut_params;
185};
186
187struct msm_camera_csiphy_params {
188 uint8_t lane_cnt;
189 uint8_t settle_cnt;
190};
191
Kevin Chana980f392011-08-01 20:55:00 -0700192struct msm_camera_csi2_params {
193 struct msm_camera_csid_params csid_params;
194 struct msm_camera_csiphy_params csiphy_params;
195};
196
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197#define VFE31_OUTPUT_MODE_PT (0x1 << 0)
198#define VFE31_OUTPUT_MODE_S (0x1 << 1)
199#define VFE31_OUTPUT_MODE_V (0x1 << 2)
200#define VFE31_OUTPUT_MODE_P (0x1 << 3)
201#define VFE31_OUTPUT_MODE_T (0x1 << 4)
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530202#define VFE31_OUTPUT_MODE_P_ALL_CHNLS (0x1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700203
204#define CSI_EMBED_DATA 0x12
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800205#define CSI_YUV422_8 0x1E
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700206#define CSI_RAW8 0x2A
207#define CSI_RAW10 0x2B
208#define CSI_RAW12 0x2C
209
210#define CSI_DECODE_6BIT 0
211#define CSI_DECODE_8BIT 1
212#define CSI_DECODE_10BIT 2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213
214struct msm_vfe_phy_info {
215 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530216 uint32_t planar0_off;
217 uint32_t planar1_off;
218 uint32_t planar2_off;
219 uint32_t p0_phy;
220 uint32_t p1_phy;
221 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
223 uint32_t frame_id;
224};
225
226struct msm_vfe_stats_msg {
Lakshmi Narayana Kalavala4ab97a92011-07-26 15:30:14 -0700227 uint8_t awb_ymin;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 uint32_t aec_buff;
229 uint32_t awb_buff;
230 uint32_t af_buff;
231 uint32_t ihist_buff;
232 uint32_t rs_buff;
233 uint32_t cs_buff;
234 uint32_t skin_buff;
235 uint32_t status_bits;
236 uint32_t frame_id;
237};
238
239struct video_crop_t{
240 uint32_t in1_w;
241 uint32_t out1_w;
242 uint32_t in1_h;
243 uint32_t out1_h;
244 uint32_t in2_w;
245 uint32_t out2_w;
246 uint32_t in2_h;
247 uint32_t out2_h;
248 uint8_t update_flag;
249};
250
251struct msm_vpe_buf_info {
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530252 uint32_t p0_phy;
253 uint32_t p1_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254 struct timespec ts;
255 uint32_t frame_id;
256 struct video_crop_t vpe_crop;
257};
258
259struct msm_vfe_resp {
260 enum vfe_resp_msg type;
261 struct msm_cam_evt_msg evt_msg;
262 struct msm_vfe_phy_info phy;
263 struct msm_vfe_stats_msg stats_msg;
264 struct msm_vpe_buf_info vpe_bf;
265 void *extdata;
266 int32_t extlen;
267};
268
269struct msm_vpe_resp {
270 enum vpe_resp_msg type;
271 struct msm_cam_evt_msg evt_msg;
272 struct msm_vpe_phy_info phy;
273 void *extdata;
274 int32_t extlen;
275};
276
277struct msm_vpe_callback {
278 void (*vpe_resp)(struct msm_vpe_resp *,
279 enum msm_queue, void *syncdata,
280 void *time_stamp, gfp_t gfp);
281 void* (*vpe_alloc)(int, void *syncdata, gfp_t gfp);
282 void (*vpe_free)(void *ptr);
283};
284
285struct msm_vfe_callback {
286 void (*vfe_resp)(struct msm_vfe_resp *,
287 enum msm_queue, void *syncdata,
288 gfp_t gfp);
289 void* (*vfe_alloc)(int, void *syncdata, gfp_t gfp);
290 void (*vfe_free)(void *ptr);
291};
292
293struct msm_camvfe_fn {
294 int (*vfe_init)(struct msm_vfe_callback *,
295 struct platform_device *);
296 int (*vfe_enable)(struct camera_enable_cmd *);
297 int (*vfe_config)(struct msm_vfe_cfg_cmd *, void *);
298 int (*vfe_disable)(struct camera_enable_cmd *,
299 struct platform_device *dev);
300 void (*vfe_release)(struct platform_device *);
301 void (*vfe_stop)(void);
302};
303
304struct msm_camvfe_params {
305 struct msm_vfe_cfg_cmd *vfe_cfg;
306 void *data;
307};
308
Mingcheng Zhu8e9f99e2011-08-26 16:33:32 -0700309struct msm_mctl_pp_params {
310 struct msm_mctl_pp_cmd *cmd;
311 void *data;
312};
313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700314struct msm_camvpe_fn {
315 int (*vpe_reg)(struct msm_vpe_callback *);
316 int (*vpe_cfg_update) (void *);
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530317 void (*send_frame_to_vpe) (uint32_t planar0_off, uint32_t planar1_off,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700318 struct timespec *ts, int output_id);
319 int (*vpe_config)(struct msm_vpe_cfg_cmd *, void *);
320 void (*vpe_cfg_offset)(int frame_pack, uint32_t pyaddr,
321 uint32_t pcbcraddr, struct timespec *ts, int output_id,
322 struct msm_st_half st_half, int frameid);
323 int *dis;
324};
325
326struct msm_sensor_ctrl {
327 int (*s_init)(const struct msm_camera_sensor_info *);
328 int (*s_release)(void);
329 int (*s_config)(void __user *);
330 enum msm_camera_type s_camera_type;
331 uint32_t s_mount_angle;
332 enum msm_st_frame_packing s_video_packing;
333 enum msm_st_frame_packing s_snap_packing;
334};
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700335
336struct msm_actuator_ctrl {
337 int (*a_init_table)(void);
Rajakumar Govindaramdf6af9c2011-12-01 21:26:20 -0800338 int (*a_power_up)(void *);
339 int (*a_power_down)(void *);
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700340 int (*a_create_subdevice)(void *, void *);
341 int (*a_config)(void __user *);
342};
343
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700344struct msm_strobe_flash_ctrl {
345 int (*strobe_flash_init)
346 (struct msm_camera_sensor_strobe_flash_data *);
347 int (*strobe_flash_release)
348 (struct msm_camera_sensor_strobe_flash_data *, int32_t);
349 int (*strobe_flash_charge)(int32_t, int32_t, uint32_t);
350};
351
352/* this structure is used in kernel */
353struct msm_queue_cmd {
354 struct list_head list_config;
355 struct list_head list_control;
356 struct list_head list_frame;
357 struct list_head list_pict;
358 struct list_head list_vpe_frame;
359 enum msm_queue type;
360 void *command;
361 atomic_t on_heap;
362 struct timespec ts;
363 uint32_t error_code;
364};
365
366struct msm_device_queue {
367 struct list_head list;
368 spinlock_t lock;
369 wait_queue_head_t wait;
370 int max;
371 int len;
372 const char *name;
373};
374
375struct msm_sync {
376 /* These two queues are accessed from a process context only
377 * They contain pmem descriptors for the preview frames and the stats
378 * coming from the camera sensor.
379 */
380 struct hlist_head pmem_frames;
381 struct hlist_head pmem_stats;
382
383 /* The message queue is used by the control thread to send commands
384 * to the config thread, and also by the DSP to send messages to the
385 * config thread. Thus it is the only queue that is accessed from
386 * both interrupt and process context.
387 */
388 struct msm_device_queue event_q;
389
390 /* This queue contains preview frames. It is accessed by the DSP (in
391 * in interrupt context, and by the frame thread.
392 */
393 struct msm_device_queue frame_q;
394 int unblock_poll_frame;
395 int unblock_poll_pic_frame;
396
397 /* This queue contains snapshot frames. It is accessed by the DSP (in
398 * interrupt context, and by the control thread.
399 */
400 struct msm_device_queue pict_q;
401 int get_pic_abort;
402 struct msm_device_queue vpe_q;
403
404 struct msm_camera_sensor_info *sdata;
405 struct msm_camvfe_fn vfefn;
406 struct msm_camvpe_fn vpefn;
407 struct msm_sensor_ctrl sctrl;
408 struct msm_strobe_flash_ctrl sfctrl;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700409 struct msm_actuator_ctrl actctrl;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700410 struct wake_lock wake_lock;
411 struct platform_device *pdev;
412 int16_t ignore_qcmd_type;
413 uint8_t ignore_qcmd;
414 uint8_t opencnt;
415 void *cropinfo;
416 int croplen;
417 int core_powered_on;
418
419 struct fd_roi_info fdroiinfo;
420
421 atomic_t vpe_enable;
422 uint32_t pp_mask;
423 uint8_t pp_frame_avail;
424 struct msm_queue_cmd *pp_prev;
425 struct msm_queue_cmd *pp_snap;
426 struct msm_queue_cmd *pp_thumb;
427 int video_fd;
428
429 const char *apps_id;
430
431 struct mutex lock;
432 struct list_head list;
433 uint8_t liveshot_enabled;
434 struct msm_cam_v4l2_device *pcam_sync;
435
436 uint8_t stereocam_enabled;
437 struct msm_queue_cmd *pp_stereocam;
438 struct msm_queue_cmd *pp_stereocam2;
439 struct msm_queue_cmd *pp_stereosnap;
440 enum msm_stereo_state stereo_state;
441 int stcam_quality_ind;
442 uint32_t stcam_conv_value;
443
444 spinlock_t pmem_frame_spinlock;
445 spinlock_t pmem_stats_spinlock;
446 spinlock_t abort_pict_lock;
447 int snap_count;
448 int thumb_count;
449};
450
451#define MSM_APPS_ID_V4L2 "msm_v4l2"
452#define MSM_APPS_ID_PROP "msm_qct"
453
454struct msm_cam_device {
455 struct msm_sync *sync; /* most-frequently accessed */
456 struct device *device;
457 struct cdev cdev;
458 /* opened is meaningful only for the config and frame nodes,
459 * which may be opened only once.
460 */
461 atomic_t opened;
462};
463
464struct msm_control_device {
465 struct msm_cam_device *pmsm;
466
467 /* Used for MSM_CAM_IOCTL_CTRL_CMD_DONE responses */
468 uint8_t ctrl_data[max_control_command_size];
469 struct msm_ctrl_cmd ctrl;
470 struct msm_queue_cmd qcmd;
471
472 /* This queue used by the config thread to send responses back to the
473 * control thread. It is accessed only from a process context.
474 */
475 struct msm_device_queue ctrl_q;
476};
477
478struct register_address_value_pair {
479 uint16_t register_address;
480 uint16_t register_value;
481};
482
483struct msm_pmem_region {
484 struct hlist_node list;
485 unsigned long paddr;
486 unsigned long len;
487 struct file *file;
488 struct msm_pmem_info info;
Ankit Premrajkac6864b82011-07-15 11:43:41 -0700489 struct msm_mapped_buffer *msm_buffer;
490 int subsys_id;
Ankit Premrajka748a70a2011-11-01 08:22:04 -0700491 struct ion_handle *handle;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700492};
493
494struct axidata {
495 uint32_t bufnum1;
496 uint32_t bufnum2;
497 uint32_t bufnum3;
498 struct msm_pmem_region *region;
499};
500
501#ifdef CONFIG_MSM_CAMERA_FLASH
502int msm_camera_flash_set_led_state(
503 struct msm_camera_sensor_flash_data *fdata,
504 unsigned led_state);
505int msm_strobe_flash_init(struct msm_sync *sync, uint32_t sftype);
506int msm_flash_ctrl(struct msm_camera_sensor_info *sdata,
507 struct flash_ctrl_data *flash_info);
508#else
509static inline int msm_camera_flash_set_led_state(
510 struct msm_camera_sensor_flash_data *fdata,
511 unsigned led_state)
512{
513 return -ENOTSUPP;
514}
515static inline int msm_strobe_flash_init(
516 struct msm_sync *sync, uint32_t sftype)
517{
518 return -ENOTSUPP;
519}
520static inline int msm_flash_ctrl(
521 struct msm_camera_sensor_info *sdata,
522 struct flash_ctrl_data *flash_info)
523{
524 return -ENOTSUPP;
525}
526#endif
527
528
529
530void msm_camvfe_init(void);
531int msm_camvfe_check(void *);
532void msm_camvfe_fn_init(struct msm_camvfe_fn *, void *);
533void msm_camvpe_fn_init(struct msm_camvpe_fn *, void *);
534int msm_camera_drv_start(struct platform_device *dev,
535 int (*sensor_probe)(const struct msm_camera_sensor_info *,
536 struct msm_sensor_ctrl *));
537
538enum msm_camio_clk_type {
539 CAMIO_VFE_MDC_CLK,
540 CAMIO_MDC_CLK,
541 CAMIO_VFE_CLK,
542 CAMIO_VFE_AXI_CLK,
543
544 CAMIO_VFE_CAMIF_CLK,
545 CAMIO_VFE_PBDG_CLK,
546 CAMIO_CAM_MCLK_CLK,
547 CAMIO_CAMIF_PAD_PBDG_CLK,
548
549 CAMIO_CSI0_VFE_CLK,
550 CAMIO_CSI1_VFE_CLK,
551 CAMIO_VFE_PCLK,
552
553 CAMIO_CSI_SRC_CLK,
554 CAMIO_CSI0_CLK,
555 CAMIO_CSI1_CLK,
556 CAMIO_CSI0_PCLK,
557 CAMIO_CSI1_PCLK,
558
559 CAMIO_CSI1_SRC_CLK,
560 CAMIO_CSI_PIX_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700561 CAMIO_CSI_PIX1_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700562 CAMIO_CSI_RDI_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700563 CAMIO_CSI_RDI1_CLK,
564 CAMIO_CSI_RDI2_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 CAMIO_CSIPHY0_TIMER_CLK,
566 CAMIO_CSIPHY1_TIMER_CLK,
567
568 CAMIO_JPEG_CLK,
569 CAMIO_JPEG_PCLK,
570 CAMIO_VPE_CLK,
571 CAMIO_VPE_PCLK,
572
573 CAMIO_CSI0_PHY_CLK,
574 CAMIO_CSI1_PHY_CLK,
575 CAMIO_CSIPHY_TIMER_SRC_CLK,
576
577 CAMIO_MAX_CLK
578};
579
580enum msm_camio_clk_src_type {
581 MSM_CAMIO_CLK_SRC_INTERNAL,
582 MSM_CAMIO_CLK_SRC_EXTERNAL,
583 MSM_CAMIO_CLK_SRC_MAX
584};
585
586enum msm_s_test_mode {
587 S_TEST_OFF,
588 S_TEST_1,
589 S_TEST_2,
590 S_TEST_3
591};
592
593enum msm_s_resolution {
594 S_QTR_SIZE,
595 S_FULL_SIZE,
596 S_INVALID_SIZE
597};
598
599enum msm_s_reg_update {
600 /* Sensor egisters that need to be updated during initialization */
601 S_REG_INIT,
602 /* Sensor egisters that needs periodic I2C writes */
603 S_UPDATE_PERIODIC,
604 /* All the sensor Registers will be updated */
605 S_UPDATE_ALL,
606 /* Not valid update */
607 S_UPDATE_INVALID
608};
609
610enum msm_s_setting {
611 S_RES_PREVIEW,
612 S_RES_CAPTURE
613};
614
615enum msm_bus_perf_setting {
616 S_INIT,
617 S_PREVIEW,
618 S_VIDEO,
619 S_CAPTURE,
620 S_ZSL,
621 S_STEREO_VIDEO,
622 S_STEREO_CAPTURE,
623 S_DEFAULT,
624 S_EXIT
625};
626
Nishant Pandit24153d82011-08-27 16:05:13 +0530627enum msm_cam_mode {
628 MODE_R,
629 MODE_L,
630 MODE_DUAL
631};
632
Kevin Chan85af4552011-10-25 15:07:58 -0700633struct msm_cam_clk_info {
634 const char *clk_name;
635 long clk_rate;
636};
637
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638int msm_camio_enable(struct platform_device *dev);
639int msm_camio_jpeg_clk_enable(void);
640int msm_camio_jpeg_clk_disable(void);
641int msm_camio_vpe_clk_enable(uint32_t);
642int msm_camio_vpe_clk_disable(void);
643
Nishant Pandit24153d82011-08-27 16:05:13 +0530644void msm_camio_mode_config(enum msm_cam_mode mode);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700645int msm_camio_clk_enable(enum msm_camio_clk_type clk);
646int msm_camio_clk_disable(enum msm_camio_clk_type clk);
647int msm_camio_clk_config(uint32_t freq);
648void msm_camio_clk_rate_set(int rate);
Shuzhen Wange49436a2011-09-28 16:07:27 -0700649int msm_camio_vfe_clk_rate_set(int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650void msm_camio_clk_rate_set_2(struct clk *clk, int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700651void msm_camio_clk_axi_rate_set(int rate);
652void msm_disable_io_gpio_clk(struct platform_device *);
653
654void msm_camio_camif_pad_reg_reset(void);
655void msm_camio_camif_pad_reg_reset_2(void);
656
657void msm_camio_vfe_blk_reset(void);
658
Nishant Pandit24153d82011-08-27 16:05:13 +0530659int32_t msm_camio_3d_enable(const struct msm_camera_sensor_info *sinfo);
660void msm_camio_3d_disable(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700661void msm_camio_clk_sel(enum msm_camio_clk_src_type);
662void msm_camio_disable(struct platform_device *);
663int msm_camio_probe_on(struct platform_device *);
664int msm_camio_probe_off(struct platform_device *);
665int msm_camio_sensor_clk_off(struct platform_device *);
666int msm_camio_sensor_clk_on(struct platform_device *);
667int msm_camio_csi_config(struct msm_camera_csi_params *csi_params);
668int msm_camio_csiphy_config(struct msm_camera_csiphy_params *csiphy_params);
669int msm_camio_csid_config(struct msm_camera_csid_params *csid_params);
670void msm_io_read_interrupt(void);
671int add_axi_qos(void);
672int update_axi_qos(uint32_t freq);
673void release_axi_qos(void);
674void msm_io_w(u32 data, void __iomem *addr);
675void msm_io_w_mb(u32 data, void __iomem *addr);
676u32 msm_io_r(void __iomem *addr);
677u32 msm_io_r_mb(void __iomem *addr);
678void msm_io_dump(void __iomem *addr, int size);
679void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len);
680void msm_camio_set_perf_lvl(enum msm_bus_perf_setting);
Kevin Chan09f4e662011-12-16 08:17:02 -0800681void msm_camio_bus_scale_cfg(
682 struct msm_bus_scale_pdata *, enum msm_bus_perf_setting);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700683
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700684void *msm_isp_sync_alloc(int size, gfp_t gfp);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700685
686void msm_isp_sync_free(void *ptr);
Kevin Chan85af4552011-10-25 15:07:58 -0700687
688int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
689 struct clk **clk_ptr, int num_clk, int enable);
Kevin Chan09f4e662011-12-16 08:17:02 -0800690int msm_sensor_probe_on(struct device *);
691int msm_sensor_probe_off(struct device *);
Jeyaprakash Soundrapandian2474e8f2012-01-03 15:59:57 -0800692int msm_cam_core_reset(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700693#endif