blob: 8961c798e27d61329ceded7413fb4260778e20d4 [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,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090};
91
92enum vpe_resp_msg {
93 VPE_MSG_GENERAL,
94 VPE_MSG_OUTPUT_V, /* video (continuous mode ) */
95 VPE_MSG_OUTPUT_ST_L,
96 VPE_MSG_OUTPUT_ST_R,
97};
98
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099enum msm_stereo_state {
100 STEREO_VIDEO_IDLE,
101 STEREO_VIDEO_ACTIVE,
102 STEREO_SNAP_IDLE,
103 STEREO_SNAP_STARTED,
104 STEREO_SNAP_BUFFER1_PROCESSING,
105 STEREO_SNAP_BUFFER2_PROCESSING,
106 STEREO_RAW_SNAP_IDLE,
107 STEREO_RAW_SNAP_STARTED,
108};
109
110enum msm_ispif_intftype {
111 PIX0,
112 RDI0,
113 PIX1,
114 RDI1,
115 PIX2,
116 RDI2,
117};
118
119enum msm_ispif_vc {
120 VC0,
121 VC1,
122 VC2,
123 VC3,
124};
125
126enum msm_ispif_cid {
127 CID0,
128 CID1,
129 CID2,
130 CID3,
131 CID4,
132 CID5,
133 CID6,
134 CID7,
135 CID8,
136 CID9,
137 CID10,
138 CID11,
139 CID12,
140 CID13,
141 CID14,
142 CID15,
143};
144
145struct msm_ispif_params {
146 uint8_t intftype;
147 uint16_t cid_mask;
148 uint8_t csid;
149};
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700150
151struct msm_ispif_params_list {
152 uint32_t len;
153 struct msm_ispif_params params[3];
154};
155
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700156struct msm_vpe_phy_info {
157 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530158 uint32_t planar0_off;
159 uint32_t planar1_off;
160 uint32_t planar2_off;
161 uint32_t p0_phy;
162 uint32_t p1_phy;
163 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
165 uint32_t frame_id;
166};
167
168struct msm_camera_csid_vc_cfg {
169 uint8_t cid;
170 uint8_t dt;
171 uint8_t decode_format;
172};
173
174struct msm_camera_csid_lut_params {
175 uint8_t num_cid;
176 struct msm_camera_csid_vc_cfg *vc_cfg;
177};
178
179struct msm_camera_csid_params {
180 uint8_t lane_cnt;
181 uint8_t lane_assign;
182 struct msm_camera_csid_lut_params lut_params;
183};
184
185struct msm_camera_csiphy_params {
186 uint8_t lane_cnt;
187 uint8_t settle_cnt;
188};
189
Kevin Chana980f392011-08-01 20:55:00 -0700190struct msm_camera_csi2_params {
191 struct msm_camera_csid_params csid_params;
192 struct msm_camera_csiphy_params csiphy_params;
193};
194
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195#define VFE31_OUTPUT_MODE_PT (0x1 << 0)
196#define VFE31_OUTPUT_MODE_S (0x1 << 1)
197#define VFE31_OUTPUT_MODE_V (0x1 << 2)
198#define VFE31_OUTPUT_MODE_P (0x1 << 3)
199#define VFE31_OUTPUT_MODE_T (0x1 << 4)
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530200#define VFE31_OUTPUT_MODE_P_ALL_CHNLS (0x1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201
202#define CSI_EMBED_DATA 0x12
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800203#define CSI_YUV422_8 0x1E
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204#define CSI_RAW8 0x2A
205#define CSI_RAW10 0x2B
206#define CSI_RAW12 0x2C
207
208#define CSI_DECODE_6BIT 0
209#define CSI_DECODE_8BIT 1
210#define CSI_DECODE_10BIT 2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211
212struct msm_vfe_phy_info {
213 uint32_t sbuf_phy;
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530214 uint32_t planar0_off;
215 uint32_t planar1_off;
216 uint32_t planar2_off;
217 uint32_t p0_phy;
218 uint32_t p1_phy;
219 uint32_t p2_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
221 uint32_t frame_id;
222};
223
224struct msm_vfe_stats_msg {
Lakshmi Narayana Kalavala4ab97a92011-07-26 15:30:14 -0700225 uint8_t awb_ymin;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700226 uint32_t aec_buff;
227 uint32_t awb_buff;
228 uint32_t af_buff;
229 uint32_t ihist_buff;
230 uint32_t rs_buff;
231 uint32_t cs_buff;
232 uint32_t skin_buff;
233 uint32_t status_bits;
234 uint32_t frame_id;
235};
236
237struct video_crop_t{
238 uint32_t in1_w;
239 uint32_t out1_w;
240 uint32_t in1_h;
241 uint32_t out1_h;
242 uint32_t in2_w;
243 uint32_t out2_w;
244 uint32_t in2_h;
245 uint32_t out2_h;
246 uint8_t update_flag;
247};
248
249struct msm_vpe_buf_info {
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530250 uint32_t p0_phy;
251 uint32_t p1_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700252 struct timespec ts;
253 uint32_t frame_id;
254 struct video_crop_t vpe_crop;
255};
256
257struct msm_vfe_resp {
258 enum vfe_resp_msg type;
259 struct msm_cam_evt_msg evt_msg;
260 struct msm_vfe_phy_info phy;
261 struct msm_vfe_stats_msg stats_msg;
262 struct msm_vpe_buf_info vpe_bf;
263 void *extdata;
264 int32_t extlen;
265};
266
267struct msm_vpe_resp {
268 enum vpe_resp_msg type;
269 struct msm_cam_evt_msg evt_msg;
270 struct msm_vpe_phy_info phy;
271 void *extdata;
272 int32_t extlen;
273};
274
275struct msm_vpe_callback {
276 void (*vpe_resp)(struct msm_vpe_resp *,
277 enum msm_queue, void *syncdata,
278 void *time_stamp, gfp_t gfp);
279 void* (*vpe_alloc)(int, void *syncdata, gfp_t gfp);
280 void (*vpe_free)(void *ptr);
281};
282
283struct msm_vfe_callback {
284 void (*vfe_resp)(struct msm_vfe_resp *,
285 enum msm_queue, void *syncdata,
286 gfp_t gfp);
287 void* (*vfe_alloc)(int, void *syncdata, gfp_t gfp);
288 void (*vfe_free)(void *ptr);
289};
290
291struct msm_camvfe_fn {
292 int (*vfe_init)(struct msm_vfe_callback *,
293 struct platform_device *);
294 int (*vfe_enable)(struct camera_enable_cmd *);
295 int (*vfe_config)(struct msm_vfe_cfg_cmd *, void *);
296 int (*vfe_disable)(struct camera_enable_cmd *,
297 struct platform_device *dev);
298 void (*vfe_release)(struct platform_device *);
299 void (*vfe_stop)(void);
300};
301
302struct msm_camvfe_params {
303 struct msm_vfe_cfg_cmd *vfe_cfg;
304 void *data;
305};
306
Mingcheng Zhu8e9f99e2011-08-26 16:33:32 -0700307struct msm_mctl_pp_params {
308 struct msm_mctl_pp_cmd *cmd;
309 void *data;
310};
311
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700312struct msm_camvpe_fn {
313 int (*vpe_reg)(struct msm_vpe_callback *);
314 int (*vpe_cfg_update) (void *);
Alekhya,Monikafc81e102011-12-29 15:17:33 +0530315 void (*send_frame_to_vpe) (uint32_t planar0_off, uint32_t planar1_off,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700316 struct timespec *ts, int output_id);
317 int (*vpe_config)(struct msm_vpe_cfg_cmd *, void *);
318 void (*vpe_cfg_offset)(int frame_pack, uint32_t pyaddr,
319 uint32_t pcbcraddr, struct timespec *ts, int output_id,
320 struct msm_st_half st_half, int frameid);
321 int *dis;
322};
323
324struct msm_sensor_ctrl {
325 int (*s_init)(const struct msm_camera_sensor_info *);
326 int (*s_release)(void);
327 int (*s_config)(void __user *);
328 enum msm_camera_type s_camera_type;
329 uint32_t s_mount_angle;
330 enum msm_st_frame_packing s_video_packing;
331 enum msm_st_frame_packing s_snap_packing;
332};
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700333
334struct msm_actuator_ctrl {
335 int (*a_init_table)(void);
Rajakumar Govindaramdf6af9c2011-12-01 21:26:20 -0800336 int (*a_power_up)(void *);
337 int (*a_power_down)(void *);
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700338 int (*a_create_subdevice)(void *, void *);
339 int (*a_config)(void __user *);
340};
341
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700342struct msm_strobe_flash_ctrl {
343 int (*strobe_flash_init)
344 (struct msm_camera_sensor_strobe_flash_data *);
345 int (*strobe_flash_release)
346 (struct msm_camera_sensor_strobe_flash_data *, int32_t);
347 int (*strobe_flash_charge)(int32_t, int32_t, uint32_t);
348};
349
350/* this structure is used in kernel */
351struct msm_queue_cmd {
352 struct list_head list_config;
353 struct list_head list_control;
354 struct list_head list_frame;
355 struct list_head list_pict;
356 struct list_head list_vpe_frame;
357 enum msm_queue type;
358 void *command;
359 atomic_t on_heap;
360 struct timespec ts;
361 uint32_t error_code;
362};
363
364struct msm_device_queue {
365 struct list_head list;
366 spinlock_t lock;
367 wait_queue_head_t wait;
368 int max;
369 int len;
370 const char *name;
371};
372
373struct msm_sync {
374 /* These two queues are accessed from a process context only
375 * They contain pmem descriptors for the preview frames and the stats
376 * coming from the camera sensor.
377 */
378 struct hlist_head pmem_frames;
379 struct hlist_head pmem_stats;
380
381 /* The message queue is used by the control thread to send commands
382 * to the config thread, and also by the DSP to send messages to the
383 * config thread. Thus it is the only queue that is accessed from
384 * both interrupt and process context.
385 */
386 struct msm_device_queue event_q;
387
388 /* This queue contains preview frames. It is accessed by the DSP (in
389 * in interrupt context, and by the frame thread.
390 */
391 struct msm_device_queue frame_q;
392 int unblock_poll_frame;
393 int unblock_poll_pic_frame;
394
395 /* This queue contains snapshot frames. It is accessed by the DSP (in
396 * interrupt context, and by the control thread.
397 */
398 struct msm_device_queue pict_q;
399 int get_pic_abort;
400 struct msm_device_queue vpe_q;
401
402 struct msm_camera_sensor_info *sdata;
403 struct msm_camvfe_fn vfefn;
404 struct msm_camvpe_fn vpefn;
405 struct msm_sensor_ctrl sctrl;
406 struct msm_strobe_flash_ctrl sfctrl;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700407 struct msm_actuator_ctrl actctrl;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700408 struct wake_lock wake_lock;
409 struct platform_device *pdev;
410 int16_t ignore_qcmd_type;
411 uint8_t ignore_qcmd;
412 uint8_t opencnt;
413 void *cropinfo;
414 int croplen;
415 int core_powered_on;
416
417 struct fd_roi_info fdroiinfo;
418
419 atomic_t vpe_enable;
420 uint32_t pp_mask;
421 uint8_t pp_frame_avail;
422 struct msm_queue_cmd *pp_prev;
423 struct msm_queue_cmd *pp_snap;
424 struct msm_queue_cmd *pp_thumb;
425 int video_fd;
426
427 const char *apps_id;
428
429 struct mutex lock;
430 struct list_head list;
431 uint8_t liveshot_enabled;
432 struct msm_cam_v4l2_device *pcam_sync;
433
434 uint8_t stereocam_enabled;
435 struct msm_queue_cmd *pp_stereocam;
436 struct msm_queue_cmd *pp_stereocam2;
437 struct msm_queue_cmd *pp_stereosnap;
438 enum msm_stereo_state stereo_state;
439 int stcam_quality_ind;
440 uint32_t stcam_conv_value;
441
442 spinlock_t pmem_frame_spinlock;
443 spinlock_t pmem_stats_spinlock;
444 spinlock_t abort_pict_lock;
445 int snap_count;
446 int thumb_count;
447};
448
449#define MSM_APPS_ID_V4L2 "msm_v4l2"
450#define MSM_APPS_ID_PROP "msm_qct"
451
452struct msm_cam_device {
453 struct msm_sync *sync; /* most-frequently accessed */
454 struct device *device;
455 struct cdev cdev;
456 /* opened is meaningful only for the config and frame nodes,
457 * which may be opened only once.
458 */
459 atomic_t opened;
460};
461
462struct msm_control_device {
463 struct msm_cam_device *pmsm;
464
465 /* Used for MSM_CAM_IOCTL_CTRL_CMD_DONE responses */
466 uint8_t ctrl_data[max_control_command_size];
467 struct msm_ctrl_cmd ctrl;
468 struct msm_queue_cmd qcmd;
469
470 /* This queue used by the config thread to send responses back to the
471 * control thread. It is accessed only from a process context.
472 */
473 struct msm_device_queue ctrl_q;
474};
475
476struct register_address_value_pair {
477 uint16_t register_address;
478 uint16_t register_value;
479};
480
481struct msm_pmem_region {
482 struct hlist_node list;
483 unsigned long paddr;
484 unsigned long len;
485 struct file *file;
486 struct msm_pmem_info info;
Ankit Premrajkac6864b82011-07-15 11:43:41 -0700487 struct msm_mapped_buffer *msm_buffer;
488 int subsys_id;
Ankit Premrajka748a70a2011-11-01 08:22:04 -0700489 struct ion_handle *handle;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700490};
491
492struct axidata {
493 uint32_t bufnum1;
494 uint32_t bufnum2;
495 uint32_t bufnum3;
496 struct msm_pmem_region *region;
497};
498
499#ifdef CONFIG_MSM_CAMERA_FLASH
500int msm_camera_flash_set_led_state(
501 struct msm_camera_sensor_flash_data *fdata,
502 unsigned led_state);
503int msm_strobe_flash_init(struct msm_sync *sync, uint32_t sftype);
504int msm_flash_ctrl(struct msm_camera_sensor_info *sdata,
505 struct flash_ctrl_data *flash_info);
506#else
507static inline int msm_camera_flash_set_led_state(
508 struct msm_camera_sensor_flash_data *fdata,
509 unsigned led_state)
510{
511 return -ENOTSUPP;
512}
513static inline int msm_strobe_flash_init(
514 struct msm_sync *sync, uint32_t sftype)
515{
516 return -ENOTSUPP;
517}
518static inline int msm_flash_ctrl(
519 struct msm_camera_sensor_info *sdata,
520 struct flash_ctrl_data *flash_info)
521{
522 return -ENOTSUPP;
523}
524#endif
525
526
527
528void msm_camvfe_init(void);
529int msm_camvfe_check(void *);
530void msm_camvfe_fn_init(struct msm_camvfe_fn *, void *);
531void msm_camvpe_fn_init(struct msm_camvpe_fn *, void *);
532int msm_camera_drv_start(struct platform_device *dev,
533 int (*sensor_probe)(const struct msm_camera_sensor_info *,
534 struct msm_sensor_ctrl *));
535
536enum msm_camio_clk_type {
537 CAMIO_VFE_MDC_CLK,
538 CAMIO_MDC_CLK,
539 CAMIO_VFE_CLK,
540 CAMIO_VFE_AXI_CLK,
541
542 CAMIO_VFE_CAMIF_CLK,
543 CAMIO_VFE_PBDG_CLK,
544 CAMIO_CAM_MCLK_CLK,
545 CAMIO_CAMIF_PAD_PBDG_CLK,
546
547 CAMIO_CSI0_VFE_CLK,
548 CAMIO_CSI1_VFE_CLK,
549 CAMIO_VFE_PCLK,
550
551 CAMIO_CSI_SRC_CLK,
552 CAMIO_CSI0_CLK,
553 CAMIO_CSI1_CLK,
554 CAMIO_CSI0_PCLK,
555 CAMIO_CSI1_PCLK,
556
557 CAMIO_CSI1_SRC_CLK,
558 CAMIO_CSI_PIX_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700559 CAMIO_CSI_PIX1_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 CAMIO_CSI_RDI_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700561 CAMIO_CSI_RDI1_CLK,
562 CAMIO_CSI_RDI2_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700563 CAMIO_CSIPHY0_TIMER_CLK,
564 CAMIO_CSIPHY1_TIMER_CLK,
565
566 CAMIO_JPEG_CLK,
567 CAMIO_JPEG_PCLK,
568 CAMIO_VPE_CLK,
569 CAMIO_VPE_PCLK,
570
571 CAMIO_CSI0_PHY_CLK,
572 CAMIO_CSI1_PHY_CLK,
573 CAMIO_CSIPHY_TIMER_SRC_CLK,
574
575 CAMIO_MAX_CLK
576};
577
578enum msm_camio_clk_src_type {
579 MSM_CAMIO_CLK_SRC_INTERNAL,
580 MSM_CAMIO_CLK_SRC_EXTERNAL,
581 MSM_CAMIO_CLK_SRC_MAX
582};
583
584enum msm_s_test_mode {
585 S_TEST_OFF,
586 S_TEST_1,
587 S_TEST_2,
588 S_TEST_3
589};
590
591enum msm_s_resolution {
592 S_QTR_SIZE,
593 S_FULL_SIZE,
594 S_INVALID_SIZE
595};
596
597enum msm_s_reg_update {
598 /* Sensor egisters that need to be updated during initialization */
599 S_REG_INIT,
600 /* Sensor egisters that needs periodic I2C writes */
601 S_UPDATE_PERIODIC,
602 /* All the sensor Registers will be updated */
603 S_UPDATE_ALL,
604 /* Not valid update */
605 S_UPDATE_INVALID
606};
607
608enum msm_s_setting {
609 S_RES_PREVIEW,
610 S_RES_CAPTURE
611};
612
613enum msm_bus_perf_setting {
614 S_INIT,
615 S_PREVIEW,
616 S_VIDEO,
617 S_CAPTURE,
618 S_ZSL,
619 S_STEREO_VIDEO,
620 S_STEREO_CAPTURE,
621 S_DEFAULT,
622 S_EXIT
623};
624
Nishant Pandit24153d82011-08-27 16:05:13 +0530625enum msm_cam_mode {
626 MODE_R,
627 MODE_L,
628 MODE_DUAL
629};
630
Kevin Chan85af4552011-10-25 15:07:58 -0700631struct msm_cam_clk_info {
632 const char *clk_name;
633 long clk_rate;
634};
635
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700636int msm_camio_enable(struct platform_device *dev);
637int msm_camio_jpeg_clk_enable(void);
638int msm_camio_jpeg_clk_disable(void);
639int msm_camio_vpe_clk_enable(uint32_t);
640int msm_camio_vpe_clk_disable(void);
641
Nishant Pandit24153d82011-08-27 16:05:13 +0530642void msm_camio_mode_config(enum msm_cam_mode mode);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643int msm_camio_clk_enable(enum msm_camio_clk_type clk);
644int msm_camio_clk_disable(enum msm_camio_clk_type clk);
645int msm_camio_clk_config(uint32_t freq);
646void msm_camio_clk_rate_set(int rate);
Shuzhen Wange49436a2011-09-28 16:07:27 -0700647int msm_camio_vfe_clk_rate_set(int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700648void msm_camio_clk_rate_set_2(struct clk *clk, int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649void msm_camio_clk_axi_rate_set(int rate);
650void msm_disable_io_gpio_clk(struct platform_device *);
651
652void msm_camio_camif_pad_reg_reset(void);
653void msm_camio_camif_pad_reg_reset_2(void);
654
655void msm_camio_vfe_blk_reset(void);
656
Nishant Pandit24153d82011-08-27 16:05:13 +0530657int32_t msm_camio_3d_enable(const struct msm_camera_sensor_info *sinfo);
658void msm_camio_3d_disable(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700659void msm_camio_clk_sel(enum msm_camio_clk_src_type);
660void msm_camio_disable(struct platform_device *);
661int msm_camio_probe_on(struct platform_device *);
662int msm_camio_probe_off(struct platform_device *);
663int msm_camio_sensor_clk_off(struct platform_device *);
664int msm_camio_sensor_clk_on(struct platform_device *);
665int msm_camio_csi_config(struct msm_camera_csi_params *csi_params);
666int msm_camio_csiphy_config(struct msm_camera_csiphy_params *csiphy_params);
667int msm_camio_csid_config(struct msm_camera_csid_params *csid_params);
668void msm_io_read_interrupt(void);
669int add_axi_qos(void);
670int update_axi_qos(uint32_t freq);
671void release_axi_qos(void);
672void msm_io_w(u32 data, void __iomem *addr);
673void msm_io_w_mb(u32 data, void __iomem *addr);
674u32 msm_io_r(void __iomem *addr);
675u32 msm_io_r_mb(void __iomem *addr);
676void msm_io_dump(void __iomem *addr, int size);
677void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len);
678void msm_camio_set_perf_lvl(enum msm_bus_perf_setting);
Kevin Chan09f4e662011-12-16 08:17:02 -0800679void msm_camio_bus_scale_cfg(
680 struct msm_bus_scale_pdata *, enum msm_bus_perf_setting);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700682void *msm_isp_sync_alloc(int size, gfp_t gfp);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700683
684void msm_isp_sync_free(void *ptr);
Kevin Chan85af4552011-10-25 15:07:58 -0700685
686int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
687 struct clk **clk_ptr, int num_clk, int enable);
Kevin Chan09f4e662011-12-16 08:17:02 -0800688int msm_sensor_probe_on(struct device *);
689int msm_sensor_probe_off(struct device *);
Jeyaprakash Soundrapandian2474e8f2012-01-03 15:59:57 -0800690int msm_cam_core_reset(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700691#endif