blob: fd282d5171eb52837abe37887854c0bb3593b421 [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;
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700158 uint32_t y_phy;
159 uint32_t cbcr_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700160 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
161 uint32_t frame_id;
162};
163
164struct msm_camera_csid_vc_cfg {
165 uint8_t cid;
166 uint8_t dt;
167 uint8_t decode_format;
168};
169
170struct msm_camera_csid_lut_params {
171 uint8_t num_cid;
172 struct msm_camera_csid_vc_cfg *vc_cfg;
173};
174
175struct msm_camera_csid_params {
176 uint8_t lane_cnt;
177 uint8_t lane_assign;
178 struct msm_camera_csid_lut_params lut_params;
179};
180
181struct msm_camera_csiphy_params {
182 uint8_t lane_cnt;
183 uint8_t settle_cnt;
184};
185
Kevin Chana980f392011-08-01 20:55:00 -0700186struct msm_camera_csi2_params {
187 struct msm_camera_csid_params csid_params;
188 struct msm_camera_csiphy_params csiphy_params;
189};
190
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191#define VFE31_OUTPUT_MODE_PT (0x1 << 0)
192#define VFE31_OUTPUT_MODE_S (0x1 << 1)
193#define VFE31_OUTPUT_MODE_V (0x1 << 2)
194#define VFE31_OUTPUT_MODE_P (0x1 << 3)
195#define VFE31_OUTPUT_MODE_T (0x1 << 4)
196
197#define CSI_EMBED_DATA 0x12
Rajakumar Govindaram6bc004a2011-12-05 20:58:19 -0800198#define CSI_YUV422_8 0x1E
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199#define CSI_RAW8 0x2A
200#define CSI_RAW10 0x2B
201#define CSI_RAW12 0x2C
202
203#define CSI_DECODE_6BIT 0
204#define CSI_DECODE_8BIT 1
205#define CSI_DECODE_10BIT 2
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700206
207struct msm_vfe_phy_info {
208 uint32_t sbuf_phy;
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700209 uint32_t y_phy;
210 uint32_t cbcr_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700211 uint8_t output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
212 uint32_t frame_id;
213};
214
215struct msm_vfe_stats_msg {
Lakshmi Narayana Kalavala4ab97a92011-07-26 15:30:14 -0700216 uint8_t awb_ymin;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217 uint32_t aec_buff;
218 uint32_t awb_buff;
219 uint32_t af_buff;
220 uint32_t ihist_buff;
221 uint32_t rs_buff;
222 uint32_t cs_buff;
223 uint32_t skin_buff;
224 uint32_t status_bits;
225 uint32_t frame_id;
226};
227
228struct video_crop_t{
229 uint32_t in1_w;
230 uint32_t out1_w;
231 uint32_t in1_h;
232 uint32_t out1_h;
233 uint32_t in2_w;
234 uint32_t out2_w;
235 uint32_t in2_h;
236 uint32_t out2_h;
237 uint8_t update_flag;
238};
239
240struct msm_vpe_buf_info {
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700241 uint32_t y_phy;
242 uint32_t cbcr_phy;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700243 struct timespec ts;
244 uint32_t frame_id;
245 struct video_crop_t vpe_crop;
246};
247
248struct msm_vfe_resp {
249 enum vfe_resp_msg type;
250 struct msm_cam_evt_msg evt_msg;
251 struct msm_vfe_phy_info phy;
252 struct msm_vfe_stats_msg stats_msg;
253 struct msm_vpe_buf_info vpe_bf;
254 void *extdata;
255 int32_t extlen;
256};
257
258struct msm_vpe_resp {
259 enum vpe_resp_msg type;
260 struct msm_cam_evt_msg evt_msg;
261 struct msm_vpe_phy_info phy;
262 void *extdata;
263 int32_t extlen;
264};
265
266struct msm_vpe_callback {
267 void (*vpe_resp)(struct msm_vpe_resp *,
268 enum msm_queue, void *syncdata,
269 void *time_stamp, gfp_t gfp);
270 void* (*vpe_alloc)(int, void *syncdata, gfp_t gfp);
271 void (*vpe_free)(void *ptr);
272};
273
274struct msm_vfe_callback {
275 void (*vfe_resp)(struct msm_vfe_resp *,
276 enum msm_queue, void *syncdata,
277 gfp_t gfp);
278 void* (*vfe_alloc)(int, void *syncdata, gfp_t gfp);
279 void (*vfe_free)(void *ptr);
280};
281
282struct msm_camvfe_fn {
283 int (*vfe_init)(struct msm_vfe_callback *,
284 struct platform_device *);
285 int (*vfe_enable)(struct camera_enable_cmd *);
286 int (*vfe_config)(struct msm_vfe_cfg_cmd *, void *);
287 int (*vfe_disable)(struct camera_enable_cmd *,
288 struct platform_device *dev);
289 void (*vfe_release)(struct platform_device *);
290 void (*vfe_stop)(void);
291};
292
293struct msm_camvfe_params {
294 struct msm_vfe_cfg_cmd *vfe_cfg;
295 void *data;
296};
297
Mingcheng Zhu8e9f99e2011-08-26 16:33:32 -0700298struct msm_mctl_pp_params {
299 struct msm_mctl_pp_cmd *cmd;
300 void *data;
301};
302
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700303struct msm_camvpe_fn {
304 int (*vpe_reg)(struct msm_vpe_callback *);
305 int (*vpe_cfg_update) (void *);
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700306 void (*send_frame_to_vpe) (uint32_t y_phy, uint32_t cbcr_phy,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307 struct timespec *ts, int output_id);
308 int (*vpe_config)(struct msm_vpe_cfg_cmd *, void *);
309 void (*vpe_cfg_offset)(int frame_pack, uint32_t pyaddr,
310 uint32_t pcbcraddr, struct timespec *ts, int output_id,
311 struct msm_st_half st_half, int frameid);
312 int *dis;
313};
314
315struct msm_sensor_ctrl {
316 int (*s_init)(const struct msm_camera_sensor_info *);
317 int (*s_release)(void);
318 int (*s_config)(void __user *);
319 enum msm_camera_type s_camera_type;
320 uint32_t s_mount_angle;
321 enum msm_st_frame_packing s_video_packing;
322 enum msm_st_frame_packing s_snap_packing;
323};
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700324
325struct msm_actuator_ctrl {
326 int (*a_init_table)(void);
Rajakumar Govindaramdf6af9c2011-12-01 21:26:20 -0800327 int (*a_power_up)(void *);
328 int (*a_power_down)(void *);
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700329 int (*a_create_subdevice)(void *, void *);
330 int (*a_config)(void __user *);
331};
332
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333struct msm_strobe_flash_ctrl {
334 int (*strobe_flash_init)
335 (struct msm_camera_sensor_strobe_flash_data *);
336 int (*strobe_flash_release)
337 (struct msm_camera_sensor_strobe_flash_data *, int32_t);
338 int (*strobe_flash_charge)(int32_t, int32_t, uint32_t);
339};
340
341/* this structure is used in kernel */
342struct msm_queue_cmd {
343 struct list_head list_config;
344 struct list_head list_control;
345 struct list_head list_frame;
346 struct list_head list_pict;
347 struct list_head list_vpe_frame;
348 enum msm_queue type;
349 void *command;
350 atomic_t on_heap;
351 struct timespec ts;
352 uint32_t error_code;
353};
354
355struct msm_device_queue {
356 struct list_head list;
357 spinlock_t lock;
358 wait_queue_head_t wait;
359 int max;
360 int len;
361 const char *name;
362};
363
364struct msm_sync {
365 /* These two queues are accessed from a process context only
366 * They contain pmem descriptors for the preview frames and the stats
367 * coming from the camera sensor.
368 */
369 struct hlist_head pmem_frames;
370 struct hlist_head pmem_stats;
371
372 /* The message queue is used by the control thread to send commands
373 * to the config thread, and also by the DSP to send messages to the
374 * config thread. Thus it is the only queue that is accessed from
375 * both interrupt and process context.
376 */
377 struct msm_device_queue event_q;
378
379 /* This queue contains preview frames. It is accessed by the DSP (in
380 * in interrupt context, and by the frame thread.
381 */
382 struct msm_device_queue frame_q;
383 int unblock_poll_frame;
384 int unblock_poll_pic_frame;
385
386 /* This queue contains snapshot frames. It is accessed by the DSP (in
387 * interrupt context, and by the control thread.
388 */
389 struct msm_device_queue pict_q;
390 int get_pic_abort;
391 struct msm_device_queue vpe_q;
392
393 struct msm_camera_sensor_info *sdata;
394 struct msm_camvfe_fn vfefn;
395 struct msm_camvpe_fn vpefn;
396 struct msm_sensor_ctrl sctrl;
397 struct msm_strobe_flash_ctrl sfctrl;
Sreesudhan Ramakrish Ramkumara4b5f302011-09-12 16:23:22 -0700398 struct msm_actuator_ctrl actctrl;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700399 struct wake_lock wake_lock;
400 struct platform_device *pdev;
401 int16_t ignore_qcmd_type;
402 uint8_t ignore_qcmd;
403 uint8_t opencnt;
404 void *cropinfo;
405 int croplen;
406 int core_powered_on;
407
408 struct fd_roi_info fdroiinfo;
409
410 atomic_t vpe_enable;
411 uint32_t pp_mask;
412 uint8_t pp_frame_avail;
413 struct msm_queue_cmd *pp_prev;
414 struct msm_queue_cmd *pp_snap;
415 struct msm_queue_cmd *pp_thumb;
416 int video_fd;
417
418 const char *apps_id;
419
420 struct mutex lock;
421 struct list_head list;
422 uint8_t liveshot_enabled;
423 struct msm_cam_v4l2_device *pcam_sync;
424
425 uint8_t stereocam_enabled;
426 struct msm_queue_cmd *pp_stereocam;
427 struct msm_queue_cmd *pp_stereocam2;
428 struct msm_queue_cmd *pp_stereosnap;
429 enum msm_stereo_state stereo_state;
430 int stcam_quality_ind;
431 uint32_t stcam_conv_value;
432
433 spinlock_t pmem_frame_spinlock;
434 spinlock_t pmem_stats_spinlock;
435 spinlock_t abort_pict_lock;
436 int snap_count;
437 int thumb_count;
438};
439
440#define MSM_APPS_ID_V4L2 "msm_v4l2"
441#define MSM_APPS_ID_PROP "msm_qct"
442
443struct msm_cam_device {
444 struct msm_sync *sync; /* most-frequently accessed */
445 struct device *device;
446 struct cdev cdev;
447 /* opened is meaningful only for the config and frame nodes,
448 * which may be opened only once.
449 */
450 atomic_t opened;
451};
452
453struct msm_control_device {
454 struct msm_cam_device *pmsm;
455
456 /* Used for MSM_CAM_IOCTL_CTRL_CMD_DONE responses */
457 uint8_t ctrl_data[max_control_command_size];
458 struct msm_ctrl_cmd ctrl;
459 struct msm_queue_cmd qcmd;
460
461 /* This queue used by the config thread to send responses back to the
462 * control thread. It is accessed only from a process context.
463 */
464 struct msm_device_queue ctrl_q;
465};
466
467struct register_address_value_pair {
468 uint16_t register_address;
469 uint16_t register_value;
470};
471
472struct msm_pmem_region {
473 struct hlist_node list;
474 unsigned long paddr;
475 unsigned long len;
476 struct file *file;
477 struct msm_pmem_info info;
Ankit Premrajkac6864b82011-07-15 11:43:41 -0700478 struct msm_mapped_buffer *msm_buffer;
479 int subsys_id;
Ankit Premrajka748a70a2011-11-01 08:22:04 -0700480 struct ion_handle *handle;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700481};
482
483struct axidata {
484 uint32_t bufnum1;
485 uint32_t bufnum2;
486 uint32_t bufnum3;
487 struct msm_pmem_region *region;
488};
489
490#ifdef CONFIG_MSM_CAMERA_FLASH
491int msm_camera_flash_set_led_state(
492 struct msm_camera_sensor_flash_data *fdata,
493 unsigned led_state);
494int msm_strobe_flash_init(struct msm_sync *sync, uint32_t sftype);
495int msm_flash_ctrl(struct msm_camera_sensor_info *sdata,
496 struct flash_ctrl_data *flash_info);
497#else
498static inline int msm_camera_flash_set_led_state(
499 struct msm_camera_sensor_flash_data *fdata,
500 unsigned led_state)
501{
502 return -ENOTSUPP;
503}
504static inline int msm_strobe_flash_init(
505 struct msm_sync *sync, uint32_t sftype)
506{
507 return -ENOTSUPP;
508}
509static inline int msm_flash_ctrl(
510 struct msm_camera_sensor_info *sdata,
511 struct flash_ctrl_data *flash_info)
512{
513 return -ENOTSUPP;
514}
515#endif
516
517
518
519void msm_camvfe_init(void);
520int msm_camvfe_check(void *);
521void msm_camvfe_fn_init(struct msm_camvfe_fn *, void *);
522void msm_camvpe_fn_init(struct msm_camvpe_fn *, void *);
523int msm_camera_drv_start(struct platform_device *dev,
524 int (*sensor_probe)(const struct msm_camera_sensor_info *,
525 struct msm_sensor_ctrl *));
526
527enum msm_camio_clk_type {
528 CAMIO_VFE_MDC_CLK,
529 CAMIO_MDC_CLK,
530 CAMIO_VFE_CLK,
531 CAMIO_VFE_AXI_CLK,
532
533 CAMIO_VFE_CAMIF_CLK,
534 CAMIO_VFE_PBDG_CLK,
535 CAMIO_CAM_MCLK_CLK,
536 CAMIO_CAMIF_PAD_PBDG_CLK,
537
538 CAMIO_CSI0_VFE_CLK,
539 CAMIO_CSI1_VFE_CLK,
540 CAMIO_VFE_PCLK,
541
542 CAMIO_CSI_SRC_CLK,
543 CAMIO_CSI0_CLK,
544 CAMIO_CSI1_CLK,
545 CAMIO_CSI0_PCLK,
546 CAMIO_CSI1_PCLK,
547
548 CAMIO_CSI1_SRC_CLK,
549 CAMIO_CSI_PIX_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700550 CAMIO_CSI_PIX1_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700551 CAMIO_CSI_RDI_CLK,
Sreesudhan Ramakrish Ramkumard6e9cb92011-10-12 17:55:18 -0700552 CAMIO_CSI_RDI1_CLK,
553 CAMIO_CSI_RDI2_CLK,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700554 CAMIO_CSIPHY0_TIMER_CLK,
555 CAMIO_CSIPHY1_TIMER_CLK,
556
557 CAMIO_JPEG_CLK,
558 CAMIO_JPEG_PCLK,
559 CAMIO_VPE_CLK,
560 CAMIO_VPE_PCLK,
561
562 CAMIO_CSI0_PHY_CLK,
563 CAMIO_CSI1_PHY_CLK,
564 CAMIO_CSIPHY_TIMER_SRC_CLK,
565
566 CAMIO_MAX_CLK
567};
568
569enum msm_camio_clk_src_type {
570 MSM_CAMIO_CLK_SRC_INTERNAL,
571 MSM_CAMIO_CLK_SRC_EXTERNAL,
572 MSM_CAMIO_CLK_SRC_MAX
573};
574
575enum msm_s_test_mode {
576 S_TEST_OFF,
577 S_TEST_1,
578 S_TEST_2,
579 S_TEST_3
580};
581
582enum msm_s_resolution {
583 S_QTR_SIZE,
584 S_FULL_SIZE,
585 S_INVALID_SIZE
586};
587
588enum msm_s_reg_update {
589 /* Sensor egisters that need to be updated during initialization */
590 S_REG_INIT,
591 /* Sensor egisters that needs periodic I2C writes */
592 S_UPDATE_PERIODIC,
593 /* All the sensor Registers will be updated */
594 S_UPDATE_ALL,
595 /* Not valid update */
596 S_UPDATE_INVALID
597};
598
599enum msm_s_setting {
600 S_RES_PREVIEW,
601 S_RES_CAPTURE
602};
603
604enum msm_bus_perf_setting {
605 S_INIT,
606 S_PREVIEW,
607 S_VIDEO,
608 S_CAPTURE,
609 S_ZSL,
610 S_STEREO_VIDEO,
611 S_STEREO_CAPTURE,
612 S_DEFAULT,
613 S_EXIT
614};
615
Nishant Pandit24153d82011-08-27 16:05:13 +0530616enum msm_cam_mode {
617 MODE_R,
618 MODE_L,
619 MODE_DUAL
620};
621
Kevin Chan85af4552011-10-25 15:07:58 -0700622struct msm_cam_clk_info {
623 const char *clk_name;
624 long clk_rate;
625};
626
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700627int msm_camio_enable(struct platform_device *dev);
628int msm_camio_jpeg_clk_enable(void);
629int msm_camio_jpeg_clk_disable(void);
630int msm_camio_vpe_clk_enable(uint32_t);
631int msm_camio_vpe_clk_disable(void);
632
Nishant Pandit24153d82011-08-27 16:05:13 +0530633void msm_camio_mode_config(enum msm_cam_mode mode);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634int msm_camio_clk_enable(enum msm_camio_clk_type clk);
635int msm_camio_clk_disable(enum msm_camio_clk_type clk);
636int msm_camio_clk_config(uint32_t freq);
637void msm_camio_clk_rate_set(int rate);
Shuzhen Wange49436a2011-09-28 16:07:27 -0700638int msm_camio_vfe_clk_rate_set(int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700639void msm_camio_clk_rate_set_2(struct clk *clk, int rate);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700640void msm_camio_clk_axi_rate_set(int rate);
641void msm_disable_io_gpio_clk(struct platform_device *);
642
643void msm_camio_camif_pad_reg_reset(void);
644void msm_camio_camif_pad_reg_reset_2(void);
645
646void msm_camio_vfe_blk_reset(void);
647
Nishant Pandit24153d82011-08-27 16:05:13 +0530648int32_t msm_camio_3d_enable(const struct msm_camera_sensor_info *sinfo);
649void msm_camio_3d_disable(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650void msm_camio_clk_sel(enum msm_camio_clk_src_type);
651void msm_camio_disable(struct platform_device *);
652int msm_camio_probe_on(struct platform_device *);
653int msm_camio_probe_off(struct platform_device *);
654int msm_camio_sensor_clk_off(struct platform_device *);
655int msm_camio_sensor_clk_on(struct platform_device *);
656int msm_camio_csi_config(struct msm_camera_csi_params *csi_params);
657int msm_camio_csiphy_config(struct msm_camera_csiphy_params *csiphy_params);
658int msm_camio_csid_config(struct msm_camera_csid_params *csid_params);
659void msm_io_read_interrupt(void);
660int add_axi_qos(void);
661int update_axi_qos(uint32_t freq);
662void release_axi_qos(void);
663void msm_io_w(u32 data, void __iomem *addr);
664void msm_io_w_mb(u32 data, void __iomem *addr);
665u32 msm_io_r(void __iomem *addr);
666u32 msm_io_r_mb(void __iomem *addr);
667void msm_io_dump(void __iomem *addr, int size);
668void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len);
669void msm_camio_set_perf_lvl(enum msm_bus_perf_setting);
Kevin Chan09f4e662011-12-16 08:17:02 -0800670void msm_camio_bus_scale_cfg(
671 struct msm_bus_scale_pdata *, enum msm_bus_perf_setting);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700672
Shuzhen Wanga3c1a122011-08-04 15:33:27 -0700673void *msm_isp_sync_alloc(int size, gfp_t gfp);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700674
675void msm_isp_sync_free(void *ptr);
Kevin Chan85af4552011-10-25 15:07:58 -0700676
677int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
678 struct clk **clk_ptr, int num_clk, int enable);
Kevin Chan09f4e662011-12-16 08:17:02 -0800679int msm_sensor_probe_on(struct device *);
680int msm_sensor_probe_off(struct device *);
Jeyaprakash Soundrapandian2474e8f2012-01-03 15:59:57 -0800681int msm_cam_core_reset(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700682#endif