Home | History | Annotate | Download | only in media
      1 /* Copyright (c) 2009-2012, The Linux Foundation. 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 #ifndef __LINUX_MSM_CAMERA_H
     14 #define __LINUX_MSM_CAMERA_H
     15 
     16 #ifdef MSM_CAMERA_BIONIC
     17 #include <sys/types.h>
     18 #endif
     19 #include <linux/types.h>
     20 #include <linux/ioctl.h>
     21 #ifdef __KERNEL__
     22 #include <linux/cdev.h>
     23 #endif
     24 #ifdef MSM_CAMERA_GCC
     25 #include <time.h>
     26 #else
     27 #include <linux/time.h>
     28 #endif
     29 
     30 #include <linux/msm_ion.h>
     31 
     32 #define BIT(nr)   (1UL << (nr))
     33 
     34 #define MSM_CAM_IOCTL_MAGIC 'm'
     35 
     36 #define MSM_CAM_IOCTL_GET_SENSOR_INFO \
     37 	_IOR(MSM_CAM_IOCTL_MAGIC, 1, struct msm_camsensor_info *)
     38 
     39 #define MSM_CAM_IOCTL_REGISTER_PMEM \
     40 	_IOW(MSM_CAM_IOCTL_MAGIC, 2, struct msm_pmem_info *)
     41 
     42 #define MSM_CAM_IOCTL_UNREGISTER_PMEM \
     43 	_IOW(MSM_CAM_IOCTL_MAGIC, 3, unsigned)
     44 
     45 #define MSM_CAM_IOCTL_CTRL_COMMAND \
     46 	_IOW(MSM_CAM_IOCTL_MAGIC, 4, struct msm_ctrl_cmd *)
     47 
     48 #define MSM_CAM_IOCTL_CONFIG_VFE  \
     49 	_IOW(MSM_CAM_IOCTL_MAGIC, 5, struct msm_camera_vfe_cfg_cmd *)
     50 
     51 #define MSM_CAM_IOCTL_GET_STATS \
     52 	_IOR(MSM_CAM_IOCTL_MAGIC, 6, struct msm_camera_stats_event_ctrl *)
     53 
     54 #define MSM_CAM_IOCTL_GETFRAME \
     55 	_IOR(MSM_CAM_IOCTL_MAGIC, 7, struct msm_camera_get_frame *)
     56 
     57 #define MSM_CAM_IOCTL_ENABLE_VFE \
     58 	_IOW(MSM_CAM_IOCTL_MAGIC, 8, struct camera_enable_cmd *)
     59 
     60 #define MSM_CAM_IOCTL_CTRL_CMD_DONE \
     61 	_IOW(MSM_CAM_IOCTL_MAGIC, 9, struct camera_cmd *)
     62 
     63 #define MSM_CAM_IOCTL_CONFIG_CMD \
     64 	_IOW(MSM_CAM_IOCTL_MAGIC, 10, struct camera_cmd *)
     65 
     66 #define MSM_CAM_IOCTL_DISABLE_VFE \
     67 	_IOW(MSM_CAM_IOCTL_MAGIC, 11, struct camera_enable_cmd *)
     68 
     69 #define MSM_CAM_IOCTL_PAD_REG_RESET2 \
     70 	_IOW(MSM_CAM_IOCTL_MAGIC, 12, struct camera_enable_cmd *)
     71 
     72 #define MSM_CAM_IOCTL_VFE_APPS_RESET \
     73 	_IOW(MSM_CAM_IOCTL_MAGIC, 13, struct camera_enable_cmd *)
     74 
     75 #define MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER \
     76 	_IOW(MSM_CAM_IOCTL_MAGIC, 14, struct camera_enable_cmd *)
     77 
     78 #define MSM_CAM_IOCTL_RELEASE_STATS_BUFFER \
     79 	_IOW(MSM_CAM_IOCTL_MAGIC, 15, struct msm_stats_buf *)
     80 
     81 #define MSM_CAM_IOCTL_AXI_CONFIG \
     82 	_IOW(MSM_CAM_IOCTL_MAGIC, 16, struct msm_camera_vfe_cfg_cmd *)
     83 
     84 #define MSM_CAM_IOCTL_GET_PICTURE \
     85 	_IOW(MSM_CAM_IOCTL_MAGIC, 17, struct msm_frame *)
     86 
     87 #define MSM_CAM_IOCTL_SET_CROP \
     88 	_IOW(MSM_CAM_IOCTL_MAGIC, 18, struct crop_info *)
     89 
     90 #define MSM_CAM_IOCTL_PICT_PP \
     91 	_IOW(MSM_CAM_IOCTL_MAGIC, 19, uint8_t *)
     92 
     93 #define MSM_CAM_IOCTL_PICT_PP_DONE \
     94 	_IOW(MSM_CAM_IOCTL_MAGIC, 20, struct msm_snapshot_pp_status *)
     95 
     96 #define MSM_CAM_IOCTL_SENSOR_IO_CFG \
     97 	_IOW(MSM_CAM_IOCTL_MAGIC, 21, struct sensor_cfg_data *)
     98 
     99 #define MSM_CAM_IOCTL_FLASH_LED_CFG \
    100 	_IOW(MSM_CAM_IOCTL_MAGIC, 22, unsigned *)
    101 
    102 #define MSM_CAM_IOCTL_UNBLOCK_POLL_FRAME \
    103 	_IO(MSM_CAM_IOCTL_MAGIC, 23)
    104 
    105 #define MSM_CAM_IOCTL_CTRL_COMMAND_2 \
    106 	_IOW(MSM_CAM_IOCTL_MAGIC, 24, struct msm_ctrl_cmd *)
    107 
    108 #define MSM_CAM_IOCTL_AF_CTRL \
    109 	_IOR(MSM_CAM_IOCTL_MAGIC, 25, struct msm_ctrl_cmt_t *)
    110 
    111 #define MSM_CAM_IOCTL_AF_CTRL_DONE \
    112 	_IOW(MSM_CAM_IOCTL_MAGIC, 26, struct msm_ctrl_cmt_t *)
    113 
    114 #define MSM_CAM_IOCTL_CONFIG_VPE \
    115 	_IOW(MSM_CAM_IOCTL_MAGIC, 27, struct msm_camera_vpe_cfg_cmd *)
    116 
    117 #define MSM_CAM_IOCTL_AXI_VPE_CONFIG \
    118 	_IOW(MSM_CAM_IOCTL_MAGIC, 28, struct msm_camera_vpe_cfg_cmd *)
    119 
    120 #define MSM_CAM_IOCTL_STROBE_FLASH_CFG \
    121 	_IOW(MSM_CAM_IOCTL_MAGIC, 29, uint32_t *)
    122 
    123 #define MSM_CAM_IOCTL_STROBE_FLASH_CHARGE \
    124 	_IOW(MSM_CAM_IOCTL_MAGIC, 30, uint32_t *)
    125 
    126 #define MSM_CAM_IOCTL_STROBE_FLASH_RELEASE \
    127 	_IO(MSM_CAM_IOCTL_MAGIC, 31)
    128 
    129 #define MSM_CAM_IOCTL_FLASH_CTRL \
    130 	_IOW(MSM_CAM_IOCTL_MAGIC, 32, struct flash_ctrl_data *)
    131 
    132 #define MSM_CAM_IOCTL_ERROR_CONFIG \
    133 	_IOW(MSM_CAM_IOCTL_MAGIC, 33, uint32_t *)
    134 
    135 #define MSM_CAM_IOCTL_ABORT_CAPTURE \
    136 	_IO(MSM_CAM_IOCTL_MAGIC, 34)
    137 
    138 #define MSM_CAM_IOCTL_SET_FD_ROI \
    139 	_IOW(MSM_CAM_IOCTL_MAGIC, 35, struct fd_roi_info *)
    140 
    141 #define MSM_CAM_IOCTL_GET_CAMERA_INFO \
    142 	_IOR(MSM_CAM_IOCTL_MAGIC, 36, struct msm_camera_info *)
    143 
    144 #define MSM_CAM_IOCTL_UNBLOCK_POLL_PIC_FRAME \
    145 	_IO(MSM_CAM_IOCTL_MAGIC, 37)
    146 
    147 #define MSM_CAM_IOCTL_RELEASE_PIC_BUFFER \
    148 	_IOW(MSM_CAM_IOCTL_MAGIC, 38, struct camera_enable_cmd *)
    149 
    150 #define MSM_CAM_IOCTL_PUT_ST_FRAME \
    151 	_IOW(MSM_CAM_IOCTL_MAGIC, 39, struct msm_camera_st_frame *)
    152 
    153 #define MSM_CAM_IOCTL_V4L2_EVT_NOTIFY \
    154 	_IOR(MSM_CAM_IOCTL_MAGIC, 40, struct v4l2_event *)
    155 
    156 #define MSM_CAM_IOCTL_SET_MEM_MAP_INFO \
    157 	_IOR(MSM_CAM_IOCTL_MAGIC, 41, struct msm_mem_map_info *)
    158 
    159 #define MSM_CAM_IOCTL_ACTUATOR_IO_CFG \
    160 	_IOW(MSM_CAM_IOCTL_MAGIC, 42, struct msm_actuator_cfg_data *)
    161 
    162 #define MSM_CAM_IOCTL_MCTL_POST_PROC \
    163 	_IOW(MSM_CAM_IOCTL_MAGIC, 43, struct msm_mctl_post_proc_cmd *)
    164 
    165 #define MSM_CAM_IOCTL_RESERVE_FREE_FRAME \
    166 	_IOW(MSM_CAM_IOCTL_MAGIC, 44, struct msm_cam_evt_divert_frame *)
    167 
    168 #define MSM_CAM_IOCTL_RELEASE_FREE_FRAME \
    169 	_IOR(MSM_CAM_IOCTL_MAGIC, 45, struct msm_cam_evt_divert_frame *)
    170 
    171 #define MSM_CAM_IOCTL_PICT_PP_DIVERT_DONE \
    172 	_IOR(MSM_CAM_IOCTL_MAGIC, 46, struct msm_pp_frame *)
    173 
    174 #define MSM_CAM_IOCTL_SENSOR_V4l2_S_CTRL \
    175 	_IOR(MSM_CAM_IOCTL_MAGIC, 47, struct v4l2_control)
    176 
    177 #define MSM_CAM_IOCTL_SENSOR_V4l2_QUERY_CTRL \
    178 	_IOR(MSM_CAM_IOCTL_MAGIC, 48, struct v4l2_queryctrl)
    179 
    180 #define MSM_CAM_IOCTL_GET_KERNEL_SYSTEM_TIME \
    181 	_IOW(MSM_CAM_IOCTL_MAGIC, 49, struct timeval *)
    182 
    183 #define MSM_CAM_IOCTL_SET_VFE_OUTPUT_TYPE \
    184 	_IOW(MSM_CAM_IOCTL_MAGIC, 50, uint32_t *)
    185 
    186 #define MSM_CAM_IOCTL_MCTL_DIVERT_DONE \
    187 	_IOR(MSM_CAM_IOCTL_MAGIC, 51, struct msm_cam_evt_divert_frame *)
    188 
    189 #define MSM_CAM_IOCTL_GET_ACTUATOR_INFO \
    190 	_IOW(MSM_CAM_IOCTL_MAGIC, 52, struct msm_actuator_cfg_data *)
    191 
    192 #define MSM_CAM_IOCTL_EEPROM_IO_CFG \
    193 	_IOW(MSM_CAM_IOCTL_MAGIC, 53, struct msm_eeprom_cfg_data *)
    194 
    195 #define MSM_CAM_IOCTL_ISPIF_IO_CFG \
    196 	_IOR(MSM_CAM_IOCTL_MAGIC, 54, struct ispif_cfg_data *)
    197 
    198 #define MSM_CAM_IOCTL_STATS_REQBUF \
    199 	_IOR(MSM_CAM_IOCTL_MAGIC, 55, struct msm_stats_reqbuf *)
    200 
    201 #define MSM_CAM_IOCTL_STATS_ENQUEUEBUF \
    202 	_IOR(MSM_CAM_IOCTL_MAGIC, 56, struct msm_stats_buf_info *)
    203 
    204 #define MSM_CAM_IOCTL_STATS_FLUSH_BUFQ \
    205 	_IOR(MSM_CAM_IOCTL_MAGIC, 57, struct msm_stats_flush_bufq *)
    206 
    207 #define MSM_CAM_IOCTL_SET_MCTL_SDEV \
    208 	_IOW(MSM_CAM_IOCTL_MAGIC, 58, struct msm_mctl_set_sdev_data *)
    209 
    210 #define MSM_CAM_IOCTL_UNSET_MCTL_SDEV \
    211 	_IOW(MSM_CAM_IOCTL_MAGIC, 59, struct msm_mctl_set_sdev_data *)
    212 
    213 #define MSM_CAM_IOCTL_GET_INST_HANDLE \
    214 	_IOR(MSM_CAM_IOCTL_MAGIC, 60, uint32_t *)
    215 
    216 #define MSM_CAM_IOCTL_STATS_UNREG_BUF \
    217 	_IOR(MSM_CAM_IOCTL_MAGIC, 61, struct msm_stats_flush_bufq *)
    218 
    219 struct msm_stats_reqbuf {
    220 	int num_buf;		/* how many buffers requested */
    221 	int stats_type;		/* stats type */
    222 };
    223 
    224 struct msm_stats_flush_bufq {
    225 	int stats_type;		/* enum msm_stats_enum_type */
    226 };
    227 
    228 struct msm_mctl_pp_cmd {
    229 	int32_t id;
    230 	uint16_t length;
    231 	void *value;
    232 };
    233 
    234 struct msm_mctl_post_proc_cmd {
    235 	int32_t type;
    236 	struct msm_mctl_pp_cmd cmd;
    237 };
    238 
    239 #define MSM_CAMERA_LED_OFF  0
    240 #define MSM_CAMERA_LED_LOW  1
    241 #define MSM_CAMERA_LED_HIGH 2
    242 #define MSM_CAMERA_LED_INIT 3
    243 #define MSM_CAMERA_LED_RELEASE 4
    244 
    245 #define MSM_CAMERA_STROBE_FLASH_NONE 0
    246 #define MSM_CAMERA_STROBE_FLASH_XENON 1
    247 
    248 #define MSM_MAX_CAMERA_SENSORS  5
    249 #define MAX_SENSOR_NAME 32
    250 #define MAX_CAM_NAME_SIZE 32
    251 #define MAX_ACT_MOD_NAME_SIZE 32
    252 #define MAX_ACT_NAME_SIZE 32
    253 #define NUM_ACTUATOR_DIR 2
    254 #define MAX_ACTUATOR_SCENARIO 8
    255 #define MAX_ACTUATOR_REGION 5
    256 #define MAX_ACTUATOR_INIT_SET 12
    257 #define MAX_ACTUATOR_TYPE_SIZE 32
    258 #define MAX_ACTUATOR_REG_TBL_SIZE 8
    259 
    260 #define MSM_MAX_CAMERA_CONFIGS 2
    261 
    262 #define PP_SNAP  0x01
    263 #define PP_RAW_SNAP ((0x01)<<1)
    264 #define PP_PREV  ((0x01)<<2)
    265 #define PP_THUMB ((0x01)<<3)
    266 #define PP_MASK		(PP_SNAP|PP_RAW_SNAP|PP_PREV|PP_THUMB)
    267 
    268 #define MSM_CAM_CTRL_CMD_DONE  0
    269 #define MSM_CAM_SENSOR_VFE_CMD 1
    270 
    271 /* Should be same as VIDEO_MAX_PLANES in videodev2.h */
    272 #define MAX_PLANES 8
    273 
    274 /*****************************************************
    275  *  structure
    276  *****************************************************/
    277 
    278 /* define five type of structures for userspace <==> kernel
    279  * space communication:
    280  * command 1 - 2 are from userspace ==> kernel
    281  * command 3 - 4 are from kernel ==> userspace
    282  *
    283  * 1. control command: control command(from control thread),
    284  *                     control status (from config thread);
    285  */
    286 struct msm_ctrl_cmd {
    287 	uint16_t type;
    288 	uint16_t length;
    289 	void *value;
    290 	uint16_t status;
    291 	uint32_t timeout_ms;
    292 	int resp_fd;		/* FIXME: to be used by the kernel, pass-through for now */
    293 	int vnode_id;		/* video dev id. Can we overload resp_fd? */
    294 	int queue_idx;
    295 	uint32_t evt_id;
    296 	uint32_t stream_type;	/* used to pass value to qcamera server */
    297 	int config_ident;	/*used as identifier for config node */
    298 };
    299 
    300 struct msm_cam_evt_msg {
    301 	unsigned short type;	/* 1 == event (RPC), 0 == message (adsp) */
    302 	unsigned short msg_id;
    303 	unsigned int len;	/* size in, number of bytes out */
    304 	uint32_t frame_id;
    305 	void *data;
    306 	struct timespec timestamp;
    307 };
    308 
    309 struct msm_pp_frame_sp {
    310 	/* phy addr of the buffer */
    311 	unsigned long phy_addr;
    312 	uint32_t y_off;
    313 	uint32_t cbcr_off;
    314 	/* buffer length */
    315 	uint32_t length;
    316 	int32_t fd;
    317 	uint32_t addr_offset;
    318 	/* mapped addr */
    319 	unsigned long vaddr;
    320 };
    321 
    322 struct msm_pp_frame_mp {
    323 	/* phy addr of the plane */
    324 	unsigned long phy_addr;
    325 	/* offset of plane data */
    326 	uint32_t data_offset;
    327 	/* plane length */
    328 	uint32_t length;
    329 	int32_t fd;
    330 	uint32_t addr_offset;
    331 	/* mapped addr */
    332 	unsigned long vaddr;
    333 };
    334 
    335 struct msm_pp_frame {
    336 	uint32_t handle;	/* stores vb cookie */
    337 	uint32_t frame_id;
    338 	unsigned short buf_idx;
    339 	int path;
    340 	unsigned short image_type;
    341 	unsigned short num_planes;	/* 1 for sp */
    342 	struct timeval timestamp;
    343 	union {
    344 		struct msm_pp_frame_sp sp;
    345 		struct msm_pp_frame_mp mp[MAX_PLANES];
    346 	};
    347 	int node_type;
    348 	uint32_t inst_handle;
    349 };
    350 
    351 struct msm_cam_evt_divert_frame {
    352 	unsigned short image_mode;
    353 	unsigned short op_mode;
    354 	unsigned short inst_idx;
    355 	unsigned short node_idx;
    356 	struct msm_pp_frame frame;
    357 	int do_pp;
    358 };
    359 
    360 struct msm_mctl_pp_cmd_ack_event {
    361 	uint32_t cmd;		/* VPE_CMD_ZOOM? */
    362 	int status;		/* 0 done, < 0 err */
    363 	uint32_t cookie;	/* daemon's cookie */
    364 };
    365 
    366 struct msm_mctl_pp_event_info {
    367 	int32_t event;
    368 	union {
    369 		struct msm_mctl_pp_cmd_ack_event ack;
    370 	};
    371 };
    372 
    373 struct msm_isp_event_ctrl {
    374 	unsigned short resptype;
    375 	union {
    376 		struct msm_cam_evt_msg isp_msg;
    377 		struct msm_ctrl_cmd ctrl;
    378 		struct msm_cam_evt_divert_frame div_frame;
    379 		struct msm_mctl_pp_event_info pp_event_info;
    380 	} isp_data;
    381 };
    382 
    383 #define MSM_CAM_RESP_CTRL              0
    384 #define MSM_CAM_RESP_STAT_EVT_MSG      1
    385 #define MSM_CAM_RESP_STEREO_OP_1       2
    386 #define MSM_CAM_RESP_STEREO_OP_2       3
    387 #define MSM_CAM_RESP_V4L2              4
    388 #define MSM_CAM_RESP_DIV_FRAME_EVT_MSG 5
    389 #define MSM_CAM_RESP_DONE_EVENT        6
    390 #define MSM_CAM_RESP_MCTL_PP_EVENT     7
    391 #define MSM_CAM_RESP_MAX               8
    392 
    393 #define MSM_CAM_APP_NOTIFY_EVENT  0
    394 #define MSM_CAM_APP_NOTIFY_ERROR_EVENT  1
    395 
    396 /* this one is used to send ctrl/status up to config thread */
    397 
    398 struct msm_stats_event_ctrl {
    399 	/* 0 - ctrl_cmd from control thread,
    400 	 * 1 - stats/event kernel,
    401 	 * 2 - V4L control or read request */
    402 	int resptype;
    403 	int timeout_ms;
    404 	struct msm_ctrl_cmd ctrl_cmd;
    405 	/* struct  vfe_event_t  stats_event; */
    406 	struct msm_cam_evt_msg stats_event;
    407 };
    408 
    409 /* 2. config command: config command(from config thread); */
    410 struct msm_camera_cfg_cmd {
    411 	/* what to config:
    412 	 * 1 - sensor config, 2 - vfe config */
    413 	uint16_t cfg_type;
    414 
    415 	/* sensor config type */
    416 	uint16_t cmd_type;
    417 	uint16_t queue;
    418 	uint16_t length;
    419 	void *value;
    420 };
    421 
    422 #define CMD_GENERAL			0
    423 #define CMD_AXI_CFG_OUT1		1
    424 #define CMD_AXI_CFG_SNAP_O1_AND_O2	2
    425 #define CMD_AXI_CFG_OUT2		3
    426 #define CMD_PICT_T_AXI_CFG		4
    427 #define CMD_PICT_M_AXI_CFG		5
    428 #define CMD_RAW_PICT_AXI_CFG		6
    429 
    430 #define CMD_FRAME_BUF_RELEASE		7
    431 #define CMD_PREV_BUF_CFG		8
    432 #define CMD_SNAP_BUF_RELEASE		9
    433 #define CMD_SNAP_BUF_CFG		10
    434 #define CMD_STATS_DISABLE		11
    435 #define CMD_STATS_AEC_AWB_ENABLE	12
    436 #define CMD_STATS_AF_ENABLE		13
    437 #define CMD_STATS_AEC_ENABLE		14
    438 #define CMD_STATS_AWB_ENABLE		15
    439 #define CMD_STATS_ENABLE  		16
    440 
    441 #define CMD_STATS_AXI_CFG		17
    442 #define CMD_STATS_AEC_AXI_CFG		18
    443 #define CMD_STATS_AF_AXI_CFG 		19
    444 #define CMD_STATS_AWB_AXI_CFG		20
    445 #define CMD_STATS_RS_AXI_CFG		21
    446 #define CMD_STATS_CS_AXI_CFG		22
    447 #define CMD_STATS_IHIST_AXI_CFG		23
    448 #define CMD_STATS_SKIN_AXI_CFG		24
    449 
    450 #define CMD_STATS_BUF_RELEASE		25
    451 #define CMD_STATS_AEC_BUF_RELEASE	26
    452 #define CMD_STATS_AF_BUF_RELEASE	27
    453 #define CMD_STATS_AWB_BUF_RELEASE	28
    454 #define CMD_STATS_RS_BUF_RELEASE	29
    455 #define CMD_STATS_CS_BUF_RELEASE	30
    456 #define CMD_STATS_IHIST_BUF_RELEASE	31
    457 #define CMD_STATS_SKIN_BUF_RELEASE	32
    458 
    459 #define UPDATE_STATS_INVALID		33
    460 #define CMD_AXI_CFG_SNAP_GEMINI		34
    461 #define CMD_AXI_CFG_SNAP		35
    462 #define CMD_AXI_CFG_PREVIEW		36
    463 #define CMD_AXI_CFG_VIDEO		37
    464 
    465 #define CMD_STATS_IHIST_ENABLE 38
    466 #define CMD_STATS_RS_ENABLE 39
    467 #define CMD_STATS_CS_ENABLE 40
    468 #define CMD_VPE 41
    469 #define CMD_AXI_CFG_VPE 42
    470 #define CMD_AXI_CFG_ZSL 43
    471 #define CMD_AXI_CFG_SNAP_VPE 44
    472 #define CMD_AXI_CFG_SNAP_THUMB_VPE 45
    473 
    474 #define CMD_CONFIG_PING_ADDR 46
    475 #define CMD_CONFIG_PONG_ADDR 47
    476 #define CMD_CONFIG_FREE_BUF_ADDR 48
    477 #define CMD_AXI_CFG_ZSL_ALL_CHNLS 49
    478 #define CMD_AXI_CFG_VIDEO_ALL_CHNLS 50
    479 #define CMD_VFE_BUFFER_RELEASE 51
    480 #define CMD_VFE_PROCESS_IRQ 52
    481 #define CMD_STATS_BG_ENABLE 53
    482 #define CMD_STATS_BF_ENABLE 54
    483 #define CMD_STATS_BHIST_ENABLE 55
    484 #define CMD_STATS_BG_BUF_RELEASE 56
    485 #define CMD_STATS_BF_BUF_RELEASE 57
    486 #define CMD_STATS_BHIST_BUF_RELEASE 58
    487 #define CMD_VFE_SOF_COUNT_UPDATE 59
    488 #define CMD_VFE_COUNT_SOF_ENABLE 60
    489 
    490 #define CMD_AXI_CFG_PRIM               BIT(8)
    491 #define CMD_AXI_CFG_PRIM_ALL_CHNLS     BIT(9)
    492 #define CMD_AXI_CFG_SEC                BIT(10)
    493 #define CMD_AXI_CFG_SEC_ALL_CHNLS      BIT(11)
    494 #define CMD_AXI_CFG_TERT1              BIT(12)
    495 #define CMD_AXI_CFG_TERT2              BIT(13)
    496 
    497 #define CMD_AXI_START  0xE1
    498 #define CMD_AXI_STOP   0xE2
    499 #define CMD_AXI_RESET  0xE3
    500 
    501 #define AXI_CMD_PREVIEW      BIT(0)
    502 #define AXI_CMD_CAPTURE      BIT(1)
    503 #define AXI_CMD_RECORD       BIT(2)
    504 #define AXI_CMD_ZSL          BIT(3)
    505 #define AXI_CMD_RAW_CAPTURE  BIT(4)
    506 #define AXI_CMD_LIVESHOT     BIT(5)
    507 
    508 /* vfe config command: config command(from config thread)*/
    509 struct msm_vfe_cfg_cmd {
    510 	int cmd_type;
    511 	uint16_t length;
    512 	void *value;
    513 };
    514 
    515 struct msm_vpe_cfg_cmd {
    516 	int cmd_type;
    517 	uint16_t length;
    518 	void *value;
    519 };
    520 
    521 #define MAX_CAMERA_ENABLE_NAME_LEN 32
    522 struct camera_enable_cmd {
    523 	char name[MAX_CAMERA_ENABLE_NAME_LEN];
    524 };
    525 
    526 #define MSM_PMEM_OUTPUT1		0
    527 #define MSM_PMEM_OUTPUT2		1
    528 #define MSM_PMEM_OUTPUT1_OUTPUT2	2
    529 #define MSM_PMEM_THUMBNAIL		3
    530 #define MSM_PMEM_MAINIMG		4
    531 #define MSM_PMEM_RAW_MAINIMG		5
    532 #define MSM_PMEM_AEC_AWB		6
    533 #define MSM_PMEM_AF			7
    534 #define MSM_PMEM_AEC			8
    535 #define MSM_PMEM_AWB			9
    536 #define MSM_PMEM_RS			10
    537 #define MSM_PMEM_CS			11
    538 #define MSM_PMEM_IHIST			12
    539 #define MSM_PMEM_SKIN			13
    540 #define MSM_PMEM_VIDEO			14
    541 #define MSM_PMEM_PREVIEW		15
    542 #define MSM_PMEM_VIDEO_VPE		16
    543 #define MSM_PMEM_C2D			17
    544 #define MSM_PMEM_MAINIMG_VPE    18
    545 #define MSM_PMEM_THUMBNAIL_VPE  19
    546 #define MSM_PMEM_BAYER_GRID		20
    547 #define MSM_PMEM_BAYER_FOCUS	21
    548 #define MSM_PMEM_BAYER_HIST		22
    549 #define MSM_PMEM_MAX            23
    550 
    551 #define STAT_AEAW			0
    552 #define STAT_AEC			1
    553 #define STAT_AF				2
    554 #define STAT_AWB			3
    555 #define STAT_RS				4
    556 #define STAT_CS				5
    557 #define STAT_IHIST			6
    558 #define STAT_SKIN			7
    559 #define STAT_BG				8
    560 #define STAT_BF				9
    561 #define STAT_BHIST			10
    562 #define STAT_MAX			11
    563 
    564 #define FRAME_PREVIEW_OUTPUT1		0
    565 #define FRAME_PREVIEW_OUTPUT2		1
    566 #define FRAME_SNAPSHOT			2
    567 #define FRAME_THUMBNAIL			3
    568 #define FRAME_RAW_SNAPSHOT		4
    569 #define FRAME_MAX			5
    570 
    571 enum msm_stats_enum_type {
    572 	MSM_STATS_TYPE_AEC,	/* legacy based AEC */
    573 	MSM_STATS_TYPE_AF,	/* legacy based AF */
    574 	MSM_STATS_TYPE_AWB,	/* legacy based AWB */
    575 	MSM_STATS_TYPE_RS,	/* legacy based RS */
    576 	MSM_STATS_TYPE_CS,	/* legacy based CS */
    577 	MSM_STATS_TYPE_IHIST,	/* legacy based HIST */
    578 	MSM_STATS_TYPE_SKIN,	/* legacy based SKIN */
    579 	MSM_STATS_TYPE_BG,	/* Bayer Grids */
    580 	MSM_STATS_TYPE_BF,	/* Bayer Focus */
    581 	MSM_STATS_TYPE_BHIST,	/* Bayer Hist */
    582 	MSM_STATS_TYPE_AE_AW,	/* legacy stats for vfe 2.x */
    583 	MSM_STATS_TYPE_MAX	/* MAX */
    584 };
    585 
    586 struct msm_stats_buf_info {
    587 	int type;		/* msm_stats_enum_type */
    588 	int fd;
    589 	void *vaddr;
    590 	uint32_t offset;
    591 	uint32_t len;
    592 	uint32_t y_off;
    593 	uint32_t cbcr_off;
    594 	uint32_t planar0_off;
    595 	uint32_t planar1_off;
    596 	uint32_t planar2_off;
    597 	uint8_t active;
    598 	int buf_idx;
    599 };
    600 
    601 struct msm_pmem_info {
    602 	int type;
    603 	int fd;
    604 	void *vaddr;
    605 	uint32_t offset;
    606 	uint32_t len;
    607 	uint32_t y_off;
    608 	uint32_t cbcr_off;
    609 	uint32_t planar0_off;
    610 	uint32_t planar1_off;
    611 	uint32_t planar2_off;
    612 	uint8_t active;
    613 };
    614 
    615 struct outputCfg {
    616 	uint32_t height;
    617 	uint32_t width;
    618 
    619 	uint32_t window_height_firstline;
    620 	uint32_t window_height_lastline;
    621 };
    622 
    623 #define VIDEO_NODE 0
    624 #define MCTL_NODE 1
    625 
    626 #define OUTPUT_1	0
    627 #define OUTPUT_2	1
    628 #define OUTPUT_1_AND_2            2	/* snapshot only */
    629 #define OUTPUT_1_AND_3            3	/* video */
    630 #define CAMIF_TO_AXI_VIA_OUTPUT_2 4
    631 #define OUTPUT_1_AND_CAMIF_TO_AXI_VIA_OUTPUT_2 5
    632 #define OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 6
    633 #define OUTPUT_1_2_AND_3 7
    634 #define OUTPUT_ALL_CHNLS 8
    635 #define OUTPUT_VIDEO_ALL_CHNLS 9
    636 #define OUTPUT_ZSL_ALL_CHNLS 10
    637 #define LAST_AXI_OUTPUT_MODE_ENUM = OUTPUT_ZSL_ALL_CHNLS
    638 
    639 #define OUTPUT_PRIM              BIT(8)
    640 #define OUTPUT_PRIM_ALL_CHNLS    BIT(9)
    641 #define OUTPUT_SEC               BIT(10)
    642 #define OUTPUT_SEC_ALL_CHNLS     BIT(11)
    643 #define OUTPUT_TERT1             BIT(12)
    644 #define OUTPUT_TERT2             BIT(13)
    645 
    646 #define MSM_FRAME_PREV_1	0
    647 #define MSM_FRAME_PREV_2	1
    648 #define MSM_FRAME_ENC		2
    649 
    650 #define OUTPUT_TYPE_P    BIT(0)
    651 #define OUTPUT_TYPE_T    BIT(1)
    652 #define OUTPUT_TYPE_S    BIT(2)
    653 #define OUTPUT_TYPE_V    BIT(3)
    654 #define OUTPUT_TYPE_L    BIT(4)
    655 #define OUTPUT_TYPE_ST_L BIT(5)
    656 #define OUTPUT_TYPE_ST_R BIT(6)
    657 #define OUTPUT_TYPE_ST_D BIT(7)
    658 #define OUTPUT_TYPE_R    BIT(8)
    659 #define OUTPUT_TYPE_R1   BIT(9)
    660 
    661 struct fd_roi_info {
    662 	void *info;
    663 	int info_len;
    664 };
    665 
    666 struct msm_mem_map_info {
    667 	uint32_t cookie;
    668 	uint32_t length;
    669 	uint32_t mem_type;
    670 };
    671 
    672 #define MSM_MEM_MMAP		0
    673 #define MSM_MEM_USERPTR		1
    674 #define MSM_PLANE_MAX		8
    675 #define MSM_PLANE_Y			0
    676 #define MSM_PLANE_UV		1
    677 
    678 struct msm_frame {
    679 	struct timespec ts;
    680 	int path;
    681 	int type;
    682 	unsigned long buffer;
    683 	uint32_t phy_offset;
    684 	uint32_t y_off;
    685 	uint32_t cbcr_off;
    686 	uint32_t planar0_off;
    687 	uint32_t planar1_off;
    688 	uint32_t planar2_off;
    689 	int fd;
    690 
    691 	void *cropinfo;
    692 	int croplen;
    693 	uint32_t error_code;
    694 	struct fd_roi_info roi_info;
    695 	uint32_t frame_id;
    696 	int stcam_quality_ind;
    697 	uint32_t stcam_conv_value;
    698 
    699 	struct ion_allocation_data ion_alloc;
    700 	struct ion_fd_data fd_data;
    701 	int ion_dev_fd;
    702 };
    703 
    704 enum msm_st_frame_packing {
    705 	SIDE_BY_SIDE_HALF,
    706 	SIDE_BY_SIDE_FULL,
    707 	TOP_DOWN_HALF,
    708 	TOP_DOWN_FULL,
    709 };
    710 
    711 struct msm_st_crop {
    712 	uint32_t in_w;
    713 	uint32_t in_h;
    714 	uint32_t out_w;
    715 	uint32_t out_h;
    716 };
    717 
    718 struct msm_st_half {
    719 	uint32_t buf_p0_off;
    720 	uint32_t buf_p1_off;
    721 	uint32_t buf_p0_stride;
    722 	uint32_t buf_p1_stride;
    723 	uint32_t pix_x_off;
    724 	uint32_t pix_y_off;
    725 	struct msm_st_crop stCropInfo;
    726 };
    727 
    728 struct msm_st_frame {
    729 	struct msm_frame buf_info;
    730 	int type;
    731 	enum msm_st_frame_packing packing;
    732 	struct msm_st_half L;
    733 	struct msm_st_half R;
    734 	int frame_id;
    735 };
    736 
    737 #define MSM_CAMERA_ERR_MASK (0xFFFFFFFF & 1)
    738 
    739 struct stats_buff {
    740 	unsigned long buff;
    741 	int fd;
    742 };
    743 
    744 struct msm_stats_buf {
    745 	uint8_t awb_ymin;
    746 	struct stats_buff aec;
    747 	struct stats_buff awb;
    748 	struct stats_buff af;
    749 	struct stats_buff ihist;
    750 	struct stats_buff rs;
    751 	struct stats_buff cs;
    752 	struct stats_buff skin;
    753 	int type;
    754 	uint32_t status_bits;
    755 	unsigned long buffer;
    756 	int fd;
    757 	int length;
    758 	struct ion_handle *handle;
    759 	uint32_t frame_id;
    760 	int buf_idx;
    761 };
    762 #define MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT 0
    763 /* video capture mode in VIDIOC_S_PARM */
    764 #define MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW \
    765 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+1)
    766 /* extendedmode for video recording in VIDIOC_S_PARM */
    767 #define MSM_V4L2_EXT_CAPTURE_MODE_VIDEO \
    768 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+2)
    769 /* extendedmode for the full size main image in VIDIOC_S_PARM */
    770 #define MSM_V4L2_EXT_CAPTURE_MODE_MAIN (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+3)
    771 /* extendedmode for the thumb nail image in VIDIOC_S_PARM */
    772 #define MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL \
    773 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+4)
    774 #define MSM_V4L2_EXT_CAPTURE_MODE_RAW \
    775 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+5)
    776 #define MSM_V4L2_EXT_CAPTURE_MODE_RDI \
    777 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+6)
    778 #define MSM_V4L2_EXT_CAPTURE_MODE_RDI1 \
    779 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+7)
    780 #define MSM_V4L2_EXT_CAPTURE_MODE_RDI2 \
    781 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+8)
    782 #define MSM_V4L2_EXT_CAPTURE_MODE_AEC \
    783 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+9)
    784 #define MSM_V4L2_EXT_CAPTURE_MODE_AWB \
    785 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+10)
    786 #define MSM_V4L2_EXT_CAPTURE_MODE_AF \
    787 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+11)
    788 #define MSM_V4L2_EXT_CAPTURE_MODE_IHIST \
    789 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+12)
    790 #define MSM_V4L2_EXT_CAPTURE_MODE_CS \
    791 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+13)
    792 #define MSM_V4L2_EXT_CAPTURE_MODE_RS \
    793 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+14)
    794 #define MSM_V4L2_EXT_CAPTURE_MODE_MAX (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+15)
    795 
    796 #define MSM_V4L2_PID_MOTION_ISO              V4L2_CID_PRIVATE_BASE
    797 #define MSM_V4L2_PID_EFFECT                 (V4L2_CID_PRIVATE_BASE+1)
    798 #define MSM_V4L2_PID_HJR                    (V4L2_CID_PRIVATE_BASE+2)
    799 #define MSM_V4L2_PID_LED_MODE               (V4L2_CID_PRIVATE_BASE+3)
    800 #define MSM_V4L2_PID_PREP_SNAPSHOT          (V4L2_CID_PRIVATE_BASE+4)
    801 #define MSM_V4L2_PID_EXP_METERING           (V4L2_CID_PRIVATE_BASE+5)
    802 #define MSM_V4L2_PID_ISO                    (V4L2_CID_PRIVATE_BASE+6)
    803 #define MSM_V4L2_PID_CAM_MODE               (V4L2_CID_PRIVATE_BASE+7)
    804 #define MSM_V4L2_PID_LUMA_ADAPTATION	    (V4L2_CID_PRIVATE_BASE+8)
    805 #define MSM_V4L2_PID_BEST_SHOT              (V4L2_CID_PRIVATE_BASE+9)
    806 #define MSM_V4L2_PID_FOCUS_MODE	            (V4L2_CID_PRIVATE_BASE+10)
    807 #define MSM_V4L2_PID_BL_DETECTION           (V4L2_CID_PRIVATE_BASE+11)
    808 #define MSM_V4L2_PID_SNOW_DETECTION         (V4L2_CID_PRIVATE_BASE+12)
    809 #define MSM_V4L2_PID_CTRL_CMD               (V4L2_CID_PRIVATE_BASE+13)
    810 #define MSM_V4L2_PID_EVT_SUB_INFO           (V4L2_CID_PRIVATE_BASE+14)
    811 #define MSM_V4L2_PID_STROBE_FLASH           (V4L2_CID_PRIVATE_BASE+15)
    812 #define MSM_V4L2_PID_INST_HANDLE            (V4L2_CID_PRIVATE_BASE+16)
    813 #define MSM_V4L2_PID_MMAP_INST              (V4L2_CID_PRIVATE_BASE+17)
    814 #define MSM_V4L2_PID_PP_PLANE_INFO          (V4L2_CID_PRIVATE_BASE+18)
    815 #define MSM_V4L2_PID_MAX                    MSM_V4L2_PID_PP_PLANE_INFO
    816 
    817 /* camera operation mode for video recording - two frame output queues */
    818 #define MSM_V4L2_CAM_OP_DEFAULT         0
    819 /* camera operation mode for video recording - two frame output queues */
    820 #define MSM_V4L2_CAM_OP_PREVIEW         (MSM_V4L2_CAM_OP_DEFAULT+1)
    821 /* camera operation mode for video recording - two frame output queues */
    822 #define MSM_V4L2_CAM_OP_VIDEO           (MSM_V4L2_CAM_OP_DEFAULT+2)
    823 /* camera operation mode for standard shapshot - two frame output queues */
    824 #define MSM_V4L2_CAM_OP_CAPTURE         (MSM_V4L2_CAM_OP_DEFAULT+3)
    825 /* camera operation mode for zsl shapshot - three output queues */
    826 #define MSM_V4L2_CAM_OP_ZSL             (MSM_V4L2_CAM_OP_DEFAULT+4)
    827 /* camera operation mode for raw snapshot - one frame output queue */
    828 #define MSM_V4L2_CAM_OP_RAW             (MSM_V4L2_CAM_OP_DEFAULT+5)
    829 /* camera operation mode for jpeg snapshot - one frame output queue */
    830 #define MSM_V4L2_CAM_OP_JPEG_CAPTURE    (MSM_V4L2_CAM_OP_DEFAULT+6)
    831 
    832 #define MSM_V4L2_VID_CAP_TYPE	0
    833 #define MSM_V4L2_STREAM_ON		1
    834 #define MSM_V4L2_STREAM_OFF		2
    835 #define MSM_V4L2_SNAPSHOT		3
    836 #define MSM_V4L2_QUERY_CTRL		4
    837 #define MSM_V4L2_GET_CTRL		5
    838 #define MSM_V4L2_SET_CTRL		6
    839 #define MSM_V4L2_QUERY			7
    840 #define MSM_V4L2_GET_CROP		8
    841 #define MSM_V4L2_SET_CROP		9
    842 #define MSM_V4L2_OPEN			10
    843 #define MSM_V4L2_CLOSE			11
    844 #define MSM_V4L2_SET_CTRL_CMD	12
    845 #define MSM_V4L2_EVT_SUB_MASK	13
    846 #define MSM_V4L2_MAX			14
    847 #define V4L2_CAMERA_EXIT		43
    848 
    849 struct crop_info {
    850 	void *info;
    851 	int len;
    852 };
    853 
    854 struct msm_postproc {
    855 	int ftnum;
    856 	struct msm_frame fthumnail;
    857 	int fmnum;
    858 	struct msm_frame fmain;
    859 };
    860 
    861 struct msm_snapshot_pp_status {
    862 	void *status;
    863 };
    864 
    865 #define CFG_SET_MODE			0
    866 #define CFG_SET_EFFECT			1
    867 #define CFG_START			2
    868 #define CFG_PWR_UP			3
    869 #define CFG_PWR_DOWN			4
    870 #define CFG_WRITE_EXPOSURE_GAIN		5
    871 #define CFG_SET_DEFAULT_FOCUS		6
    872 #define CFG_MOVE_FOCUS			7
    873 #define CFG_REGISTER_TO_REAL_GAIN	8
    874 #define CFG_REAL_TO_REGISTER_GAIN	9
    875 #define CFG_SET_FPS			10
    876 #define CFG_SET_PICT_FPS		11
    877 #define CFG_SET_BRIGHTNESS		12
    878 #define CFG_SET_CONTRAST		13
    879 #define CFG_SET_ZOOM			14
    880 #define CFG_SET_EXPOSURE_MODE		15
    881 #define CFG_SET_WB			16
    882 #define CFG_SET_ANTIBANDING		17
    883 #define CFG_SET_EXP_GAIN		18
    884 #define CFG_SET_PICT_EXP_GAIN		19
    885 #define CFG_SET_LENS_SHADING		20
    886 #define CFG_GET_PICT_FPS		21
    887 #define CFG_GET_PREV_L_PF		22
    888 #define CFG_GET_PREV_P_PL		23
    889 #define CFG_GET_PICT_L_PF		24
    890 #define CFG_GET_PICT_P_PL		25
    891 #define CFG_GET_AF_MAX_STEPS		26
    892 #define CFG_GET_PICT_MAX_EXP_LC		27
    893 #define CFG_SEND_WB_INFO    28
    894 #define CFG_SENSOR_INIT    29
    895 #define CFG_GET_3D_CALI_DATA 30
    896 #define CFG_GET_CALIB_DATA		31
    897 #define CFG_GET_OUTPUT_INFO		32
    898 #define CFG_GET_EEPROM_INFO		33
    899 #define CFG_GET_EEPROM_DATA		34
    900 #define CFG_SET_ACTUATOR_INFO		35
    901 #define CFG_GET_ACTUATOR_INFO           36
    902 /* TBD: QRD */
    903 #define CFG_SET_SATURATION            37
    904 #define CFG_SET_SHARPNESS             38
    905 #define CFG_SET_TOUCHAEC              39
    906 #define CFG_SET_AUTO_FOCUS            40
    907 #define CFG_SET_AUTOFLASH             41
    908 #define CFG_SET_EXPOSURE_COMPENSATION 42
    909 #define CFG_SET_ISO                   43
    910 #define CFG_START_STREAM              44
    911 #define CFG_STOP_STREAM               45
    912 #define CFG_GET_CSI_PARAMS            46
    913 #define CFG_MAX			47
    914 
    915 #define MOVE_NEAR	0
    916 #define MOVE_FAR	1
    917 
    918 #define SENSOR_PREVIEW_MODE		0
    919 #define SENSOR_SNAPSHOT_MODE		1
    920 #define SENSOR_RAW_SNAPSHOT_MODE	2
    921 #define SENSOR_HFR_60FPS_MODE 3
    922 #define SENSOR_HFR_90FPS_MODE 4
    923 #define SENSOR_HFR_120FPS_MODE 5
    924 
    925 #define SENSOR_QTR_SIZE			0
    926 #define SENSOR_FULL_SIZE		1
    927 #define SENSOR_QVGA_SIZE		2
    928 #define SENSOR_INVALID_SIZE		3
    929 
    930 #define CAMERA_EFFECT_OFF		0
    931 #define CAMERA_EFFECT_MONO		1
    932 #define CAMERA_EFFECT_NEGATIVE		2
    933 #define CAMERA_EFFECT_SOLARIZE		3
    934 #define CAMERA_EFFECT_SEPIA		4
    935 #define CAMERA_EFFECT_POSTERIZE		5
    936 #define CAMERA_EFFECT_WHITEBOARD	6
    937 #define CAMERA_EFFECT_BLACKBOARD	7
    938 #define CAMERA_EFFECT_AQUA		8
    939 #define CAMERA_EFFECT_EMBOSS		9
    940 #define CAMERA_EFFECT_SKETCH		10
    941 #define CAMERA_EFFECT_NEON		11
    942 #define CAMERA_EFFECT_MAX		12
    943 
    944 /* QRD */
    945 #define CAMERA_EFFECT_BW		10
    946 #define CAMERA_EFFECT_BLUISH	12
    947 #define CAMERA_EFFECT_REDDISH	13
    948 #define CAMERA_EFFECT_GREENISH	14
    949 
    950 /* QRD */
    951 #define CAMERA_ANTIBANDING_OFF		0
    952 #define CAMERA_ANTIBANDING_50HZ		2
    953 #define CAMERA_ANTIBANDING_60HZ		1
    954 #define CAMERA_ANTIBANDING_AUTO		3
    955 
    956 #define CAMERA_CONTRAST_LV0			0
    957 #define CAMERA_CONTRAST_LV1			1
    958 #define CAMERA_CONTRAST_LV2			2
    959 #define CAMERA_CONTRAST_LV3			3
    960 #define CAMERA_CONTRAST_LV4			4
    961 #define CAMERA_CONTRAST_LV5			5
    962 #define CAMERA_CONTRAST_LV6			6
    963 #define CAMERA_CONTRAST_LV7			7
    964 #define CAMERA_CONTRAST_LV8			8
    965 #define CAMERA_CONTRAST_LV9			9
    966 
    967 #define CAMERA_BRIGHTNESS_LV0			0
    968 #define CAMERA_BRIGHTNESS_LV1			1
    969 #define CAMERA_BRIGHTNESS_LV2			2
    970 #define CAMERA_BRIGHTNESS_LV3			3
    971 #define CAMERA_BRIGHTNESS_LV4			4
    972 #define CAMERA_BRIGHTNESS_LV5			5
    973 #define CAMERA_BRIGHTNESS_LV6			6
    974 #define CAMERA_BRIGHTNESS_LV7			7
    975 #define CAMERA_BRIGHTNESS_LV8			8
    976 
    977 #define CAMERA_SATURATION_LV0			0
    978 #define CAMERA_SATURATION_LV1			1
    979 #define CAMERA_SATURATION_LV2			2
    980 #define CAMERA_SATURATION_LV3			3
    981 #define CAMERA_SATURATION_LV4			4
    982 #define CAMERA_SATURATION_LV5			5
    983 #define CAMERA_SATURATION_LV6			6
    984 #define CAMERA_SATURATION_LV7			7
    985 #define CAMERA_SATURATION_LV8			8
    986 
    987 #define CAMERA_SHARPNESS_LV0		0
    988 #define CAMERA_SHARPNESS_LV1		3
    989 #define CAMERA_SHARPNESS_LV2		6
    990 #define CAMERA_SHARPNESS_LV3		9
    991 #define CAMERA_SHARPNESS_LV4		12
    992 #define CAMERA_SHARPNESS_LV5		15
    993 #define CAMERA_SHARPNESS_LV6		18
    994 #define CAMERA_SHARPNESS_LV7		21
    995 #define CAMERA_SHARPNESS_LV8		24
    996 #define CAMERA_SHARPNESS_LV9		27
    997 #define CAMERA_SHARPNESS_LV10		30
    998 
    999 #define CAMERA_SETAE_AVERAGE		0
   1000 #define CAMERA_SETAE_CENWEIGHT	1
   1001 
   1002 #define  CAMERA_WB_AUTO               1	/* This list must match aeecamera.h */
   1003 #define  CAMERA_WB_CUSTOM             2
   1004 #define  CAMERA_WB_INCANDESCENT       3
   1005 #define  CAMERA_WB_FLUORESCENT        4
   1006 #define  CAMERA_WB_DAYLIGHT           5
   1007 #define  CAMERA_WB_CLOUDY_DAYLIGHT    6
   1008 #define  CAMERA_WB_TWILIGHT           7
   1009 #define  CAMERA_WB_SHADE              8
   1010 
   1011 #define CAMERA_EXPOSURE_COMPENSATION_LV0			12
   1012 #define CAMERA_EXPOSURE_COMPENSATION_LV1			6
   1013 #define CAMERA_EXPOSURE_COMPENSATION_LV2			0
   1014 #define CAMERA_EXPOSURE_COMPENSATION_LV3			-6
   1015 #define CAMERA_EXPOSURE_COMPENSATION_LV4			-12
   1016 
   1017 enum msm_v4l2_saturation_level {
   1018 	MSM_V4L2_SATURATION_L0,
   1019 	MSM_V4L2_SATURATION_L1,
   1020 	MSM_V4L2_SATURATION_L2,
   1021 	MSM_V4L2_SATURATION_L3,
   1022 	MSM_V4L2_SATURATION_L4,
   1023 	MSM_V4L2_SATURATION_L5,
   1024 	MSM_V4L2_SATURATION_L6,
   1025 	MSM_V4L2_SATURATION_L7,
   1026 	MSM_V4L2_SATURATION_L8,
   1027 	MSM_V4L2_SATURATION_L9,
   1028 	MSM_V4L2_SATURATION_L10,
   1029 };
   1030 
   1031 enum msm_v4l2_contrast_level {
   1032 	MSM_V4L2_CONTRAST_L0,
   1033 	MSM_V4L2_CONTRAST_L1,
   1034 	MSM_V4L2_CONTRAST_L2,
   1035 	MSM_V4L2_CONTRAST_L3,
   1036 	MSM_V4L2_CONTRAST_L4,
   1037 	MSM_V4L2_CONTRAST_L5,
   1038 	MSM_V4L2_CONTRAST_L6,
   1039 	MSM_V4L2_CONTRAST_L7,
   1040 	MSM_V4L2_CONTRAST_L8,
   1041 	MSM_V4L2_CONTRAST_L9,
   1042 	MSM_V4L2_CONTRAST_L10,
   1043 };
   1044 
   1045 enum msm_v4l2_exposure_level {
   1046 	MSM_V4L2_EXPOSURE_N2,
   1047 	MSM_V4L2_EXPOSURE_N1,
   1048 	MSM_V4L2_EXPOSURE_D,
   1049 	MSM_V4L2_EXPOSURE_P1,
   1050 	MSM_V4L2_EXPOSURE_P2,
   1051 };
   1052 
   1053 enum msm_v4l2_sharpness_level {
   1054 	MSM_V4L2_SHARPNESS_L0,
   1055 	MSM_V4L2_SHARPNESS_L1,
   1056 	MSM_V4L2_SHARPNESS_L2,
   1057 	MSM_V4L2_SHARPNESS_L3,
   1058 	MSM_V4L2_SHARPNESS_L4,
   1059 	MSM_V4L2_SHARPNESS_L5,
   1060 	MSM_V4L2_SHARPNESS_L6,
   1061 };
   1062 
   1063 enum msm_v4l2_expo_metering_mode {
   1064 	MSM_V4L2_EXP_FRAME_AVERAGE,
   1065 	MSM_V4L2_EXP_CENTER_WEIGHTED,
   1066 	MSM_V4L2_EXP_SPOT_METERING,
   1067 };
   1068 
   1069 enum msm_v4l2_iso_mode {
   1070 	MSM_V4L2_ISO_AUTO = 0,
   1071 	MSM_V4L2_ISO_DEBLUR,
   1072 	MSM_V4L2_ISO_100,
   1073 	MSM_V4L2_ISO_200,
   1074 	MSM_V4L2_ISO_400,
   1075 	MSM_V4L2_ISO_800,
   1076 	MSM_V4L2_ISO_1600,
   1077 };
   1078 
   1079 enum msm_v4l2_wb_mode {
   1080 	MSM_V4L2_WB_OFF,
   1081 	MSM_V4L2_WB_AUTO,
   1082 	MSM_V4L2_WB_CUSTOM,
   1083 	MSM_V4L2_WB_INCANDESCENT,
   1084 	MSM_V4L2_WB_FLUORESCENT,
   1085 	MSM_V4L2_WB_DAYLIGHT,
   1086 	MSM_V4L2_WB_CLOUDY_DAYLIGHT,
   1087 };
   1088 
   1089 enum msm_v4l2_special_effect {
   1090 	MSM_V4L2_EFFECT_OFF,
   1091 	MSM_V4L2_EFFECT_MONO,
   1092 	MSM_V4L2_EFFECT_NEGATIVE,
   1093 	MSM_V4L2_EFFECT_SOLARIZE,
   1094 	MSM_V4L2_EFFECT_SEPIA,
   1095 	MSM_V4L2_EFFECT_POSTERAIZE,
   1096 	MSM_V4L2_EFFECT_WHITEBOARD,
   1097 	MSM_V4L2_EFFECT_BLACKBOARD,
   1098 	MSM_V4L2_EFFECT_AQUA,
   1099 	MSM_V4L2_EFFECT_EMBOSS,
   1100 	MSM_V4L2_EFFECT_SKETCH,
   1101 	MSM_V4L2_EFFECT_NEON,
   1102 	MSM_V4L2_EFFECT_MAX,
   1103 };
   1104 
   1105 enum msm_v4l2_power_line_frequency {
   1106 	MSM_V4L2_POWER_LINE_OFF,
   1107 	MSM_V4L2_POWER_LINE_60HZ,
   1108 	MSM_V4L2_POWER_LINE_50HZ,
   1109 	MSM_V4L2_POWER_LINE_AUTO,
   1110 };
   1111 
   1112 #define CAMERA_ISO_TYPE_AUTO           0
   1113 #define CAMEAR_ISO_TYPE_HJR            1
   1114 #define CAMEAR_ISO_TYPE_100            2
   1115 #define CAMERA_ISO_TYPE_200            3
   1116 #define CAMERA_ISO_TYPE_400            4
   1117 #define CAMEAR_ISO_TYPE_800            5
   1118 #define CAMERA_ISO_TYPE_1600           6
   1119 
   1120 struct sensor_pict_fps {
   1121 	uint16_t prevfps;
   1122 	uint16_t pictfps;
   1123 };
   1124 
   1125 struct exp_gain_cfg {
   1126 	uint16_t gain;
   1127 	uint32_t line;
   1128 };
   1129 
   1130 struct focus_cfg {
   1131 	int32_t steps;
   1132 	int dir;
   1133 };
   1134 
   1135 struct fps_cfg {
   1136 	uint16_t f_mult;
   1137 	uint16_t fps_div;
   1138 	uint32_t pict_fps_div;
   1139 };
   1140 struct wb_info_cfg {
   1141 	uint16_t red_gain;
   1142 	uint16_t green_gain;
   1143 	uint16_t blue_gain;
   1144 };
   1145 struct sensor_3d_exp_cfg {
   1146 	uint16_t gain;
   1147 	uint32_t line;
   1148 	uint16_t r_gain;
   1149 	uint16_t b_gain;
   1150 	uint16_t gr_gain;
   1151 	uint16_t gb_gain;
   1152 	uint16_t gain_adjust;
   1153 };
   1154 struct sensor_3d_cali_data_t {
   1155 	unsigned char left_p_matrix[3][4][8];
   1156 	unsigned char right_p_matrix[3][4][8];
   1157 	unsigned char square_len[8];
   1158 	unsigned char focal_len[8];
   1159 	unsigned char pixel_pitch[8];
   1160 	uint16_t left_r;
   1161 	uint16_t left_b;
   1162 	uint16_t left_gb;
   1163 	uint16_t left_af_far;
   1164 	uint16_t left_af_mid;
   1165 	uint16_t left_af_short;
   1166 	uint16_t left_af_5um;
   1167 	uint16_t left_af_50up;
   1168 	uint16_t left_af_50down;
   1169 	uint16_t right_r;
   1170 	uint16_t right_b;
   1171 	uint16_t right_gb;
   1172 	uint16_t right_af_far;
   1173 	uint16_t right_af_mid;
   1174 	uint16_t right_af_short;
   1175 	uint16_t right_af_5um;
   1176 	uint16_t right_af_50up;
   1177 	uint16_t right_af_50down;
   1178 };
   1179 struct sensor_init_cfg {
   1180 	uint8_t prev_res;
   1181 	uint8_t pict_res;
   1182 };
   1183 
   1184 #define ROLLOFF_CALDATA_SIZE    (17 * 13)
   1185 typedef struct {
   1186 	unsigned short mesh_rolloff_table_size;	// TableSize
   1187 	uint8_t r_gain[ROLLOFF_CALDATA_SIZE];	// RGain
   1188 	uint8_t gr_gain[ROLLOFF_CALDATA_SIZE];	// GRGain
   1189 	uint8_t gb_gain[ROLLOFF_CALDATA_SIZE];	// GBGain
   1190 	uint8_t b_gain[ROLLOFF_CALDATA_SIZE];	// BGain
   1191 	uint8_t red_ref[17];
   1192 } rolloff_caldata_array_type;
   1193 
   1194 struct sensor_calib_data {
   1195 	/* Color Related Measurements */
   1196 	uint16_t r_over_g;
   1197 	uint16_t b_over_g;
   1198 	uint16_t gr_over_gb;
   1199 
   1200 	/* Lens Related Measurements */
   1201 	uint16_t macro_2_inf;
   1202 	uint16_t inf_2_macro;
   1203 	uint16_t stroke_amt;
   1204 	uint16_t af_pos_1m;
   1205 	uint16_t af_pos_inf;
   1206 	/* Lens Shading Calibration Data */
   1207 	rolloff_caldata_array_type rolloff;
   1208 };
   1209 
   1210 enum msm_sensor_resolution_t {
   1211 	MSM_SENSOR_RES_FULL,
   1212 	MSM_SENSOR_RES_QTR,
   1213 	MSM_SENSOR_RES_2,
   1214 	MSM_SENSOR_RES_3,
   1215 	MSM_SENSOR_RES_4,
   1216 	MSM_SENSOR_RES_5,
   1217 	MSM_SENSOR_RES_6,
   1218 	MSM_SENSOR_RES_7,
   1219 	MSM_SENSOR_INVALID_RES,
   1220 };
   1221 
   1222 struct msm_sensor_output_info_t {
   1223 	uint16_t x_output;
   1224 	uint16_t y_output;
   1225 	uint16_t line_length_pclk;
   1226 	uint16_t frame_length_lines;
   1227 	uint32_t vt_pixel_clk;
   1228 	uint32_t op_pixel_clk;
   1229 	uint16_t binning_factor;
   1230 };
   1231 
   1232 struct sensor_output_info_t {
   1233 	struct msm_sensor_output_info_t *output_info;
   1234 	uint16_t num_info;
   1235 };
   1236 
   1237 struct mirror_flip {
   1238 	int32_t x_mirror;
   1239 	int32_t y_flip;
   1240 };
   1241 
   1242 struct cord {
   1243 	uint32_t x;
   1244 	uint32_t y;
   1245 };
   1246 
   1247 struct msm_eeprom_data_t {
   1248 	void *eeprom_data;
   1249 	uint16_t index;
   1250 };
   1251 
   1252 struct msm_camera_csid_vc_cfg {
   1253 	uint8_t cid;
   1254 	uint8_t dt;
   1255 	uint8_t decode_format;
   1256 };
   1257 
   1258 struct csi_lane_params_t {
   1259 	uint8_t csi_lane_assign;
   1260 	uint8_t csi_lane_mask;
   1261 	uint8_t csi_if;
   1262 	uint8_t csid_core;
   1263 	uint32_t csid_version;
   1264 };
   1265 
   1266 #define CSI_EMBED_DATA 0x12
   1267 #define CSI_RESERVED_DATA_0 0x13
   1268 #define CSI_YUV422_8  0x1E
   1269 #define CSI_RAW8    0x2A
   1270 #define CSI_RAW10   0x2B
   1271 #define CSI_RAW12   0x2C
   1272 
   1273 #define CSI_DECODE_6BIT 0
   1274 #define CSI_DECODE_8BIT 1
   1275 #define CSI_DECODE_10BIT 2
   1276 #define CSI_DECODE_DPCM_10_8_10 5
   1277 
   1278 #define ISPIF_STREAM(intf, action, vfe) (((intf)<<ISPIF_S_STREAM_SHIFT)+\
   1279 	(action)+((vfe)<<ISPIF_VFE_INTF_SHIFT))
   1280 #define ISPIF_ON_FRAME_BOUNDARY   (0x01 << 0)
   1281 #define ISPIF_OFF_FRAME_BOUNDARY  (0x01 << 1)
   1282 #define ISPIF_OFF_IMMEDIATELY     (0x01 << 2)
   1283 #define ISPIF_S_STREAM_SHIFT      4
   1284 #define ISPIF_VFE_INTF_SHIFT      12
   1285 
   1286 #define PIX_0 (0x01 << 0)
   1287 #define RDI_0 (0x01 << 1)
   1288 #define PIX_1 (0x01 << 2)
   1289 #define RDI_1 (0x01 << 3)
   1290 #define RDI_2 (0x01 << 4)
   1291 
   1292 enum msm_ispif_vfe_intf {
   1293 	VFE0,
   1294 	VFE1,
   1295 	VFE_MAX,
   1296 };
   1297 
   1298 enum msm_ispif_intftype {
   1299 	PIX0,
   1300 	RDI0,
   1301 	PIX1,
   1302 	RDI1,
   1303 	RDI2,
   1304 	INTF_MAX,
   1305 };
   1306 
   1307 enum msm_ispif_vc {
   1308 	VC0,
   1309 	VC1,
   1310 	VC2,
   1311 	VC3,
   1312 };
   1313 
   1314 enum msm_ispif_cid {
   1315 	CID0,
   1316 	CID1,
   1317 	CID2,
   1318 	CID3,
   1319 	CID4,
   1320 	CID5,
   1321 	CID6,
   1322 	CID7,
   1323 	CID8,
   1324 	CID9,
   1325 	CID10,
   1326 	CID11,
   1327 	CID12,
   1328 	CID13,
   1329 	CID14,
   1330 	CID15,
   1331 };
   1332 
   1333 struct msm_ispif_params {
   1334 	uint8_t intftype;
   1335 	uint16_t cid_mask;
   1336 	uint8_t csid;
   1337 	uint8_t vfe_intf;
   1338 };
   1339 
   1340 struct msm_ispif_params_list {
   1341 	uint32_t len;
   1342 	struct msm_ispif_params params[4];
   1343 };
   1344 
   1345 enum ispif_cfg_type_t {
   1346 	ISPIF_INIT,
   1347 	ISPIF_SET_CFG,
   1348 	ISPIF_SET_ON_FRAME_BOUNDARY,
   1349 	ISPIF_SET_OFF_FRAME_BOUNDARY,
   1350 	ISPIF_SET_OFF_IMMEDIATELY,
   1351 	ISPIF_RELEASE,
   1352 };
   1353 
   1354 struct ispif_cfg_data {
   1355 	enum ispif_cfg_type_t cfgtype;
   1356 	union {
   1357 		uint32_t csid_version;
   1358 		int cmd;
   1359 		struct msm_ispif_params_list ispif_params;
   1360 	} cfg;
   1361 };
   1362 
   1363 struct sensor_cfg_data {
   1364 	int cfgtype;
   1365 	int mode;
   1366 	int rs;
   1367 	uint8_t max_steps;
   1368 
   1369 	union {
   1370 		int8_t effect;
   1371 		uint8_t lens_shading;
   1372 		uint16_t prevl_pf;
   1373 		uint16_t prevp_pl;
   1374 		uint16_t pictl_pf;
   1375 		uint16_t pictp_pl;
   1376 		uint32_t pict_max_exp_lc;
   1377 		uint16_t p_fps;
   1378 		uint8_t iso_type;
   1379 		struct sensor_init_cfg init_info;
   1380 		struct sensor_pict_fps gfps;
   1381 		struct exp_gain_cfg exp_gain;
   1382 		struct focus_cfg focus;
   1383 		struct fps_cfg fps;
   1384 		struct wb_info_cfg wb_info;
   1385 		struct sensor_3d_exp_cfg sensor_3d_exp;
   1386 		struct sensor_calib_data calib_info;
   1387 		struct sensor_output_info_t output_info;
   1388 		struct msm_eeprom_data_t eeprom_data;
   1389 		struct csi_lane_params_t csi_lane_params;
   1390 		/* QRD */
   1391 		uint16_t antibanding;
   1392 		uint8_t contrast;
   1393 		uint8_t saturation;
   1394 		uint8_t sharpness;
   1395 		int8_t brightness;
   1396 		int ae_mode;
   1397 		uint8_t wb_val;
   1398 		int8_t exp_compensation;
   1399 		struct cord aec_cord;
   1400 		int is_autoflash;
   1401 		struct mirror_flip mirror_flip;
   1402 	} cfg;
   1403 };
   1404 
   1405 struct damping_params_t {
   1406 	uint32_t damping_step;
   1407 	uint32_t damping_delay;
   1408 	uint32_t hw_params;
   1409 };
   1410 
   1411 enum actuator_type {
   1412 	ACTUATOR_VCM,
   1413 	ACTUATOR_PIEZO,
   1414 };
   1415 
   1416 enum msm_actuator_data_type {
   1417 	MSM_ACTUATOR_BYTE_DATA = 1,
   1418 	MSM_ACTUATOR_WORD_DATA,
   1419 };
   1420 
   1421 enum msm_actuator_addr_type {
   1422 	MSM_ACTUATOR_BYTE_ADDR = 1,
   1423 	MSM_ACTUATOR_WORD_ADDR,
   1424 };
   1425 
   1426 enum msm_actuator_write_type {
   1427 	MSM_ACTUATOR_WRITE_HW_DAMP,
   1428 	MSM_ACTUATOR_WRITE_DAC,
   1429 };
   1430 
   1431 struct msm_actuator_reg_params_t {
   1432 	enum msm_actuator_write_type reg_write_type;
   1433 	uint32_t hw_mask;
   1434 	uint16_t reg_addr;
   1435 	uint16_t hw_shift;
   1436 	uint16_t data_shift;
   1437 };
   1438 
   1439 struct reg_settings_t {
   1440 	uint16_t reg_addr;
   1441 	uint16_t reg_data;
   1442 };
   1443 
   1444 struct region_params_t {
   1445 	/* [0] = ForwardDirection Macro boundary
   1446 	   [1] = ReverseDirection Inf boundary
   1447 	 */
   1448 	uint16_t step_bound[2];
   1449 	uint16_t code_per_step;
   1450 };
   1451 
   1452 struct msm_actuator_move_params_t {
   1453 	int8_t dir;
   1454 	int8_t sign_dir;
   1455 	int16_t dest_step_pos;
   1456 	int32_t num_steps;
   1457 	struct damping_params_t *ringing_params;
   1458 };
   1459 
   1460 struct msm_actuator_tuning_params_t {
   1461 	int16_t initial_code;
   1462 	uint16_t pwd_step;
   1463 	uint16_t region_size;
   1464 	uint32_t total_steps;
   1465 	struct region_params_t *region_params;
   1466 };
   1467 
   1468 struct msm_actuator_params_t {
   1469 	enum actuator_type act_type;
   1470 	uint8_t reg_tbl_size;
   1471 	uint16_t data_size;
   1472 	uint16_t init_setting_size;
   1473 	uint32_t i2c_addr;
   1474 	enum msm_actuator_addr_type i2c_addr_type;
   1475 	enum msm_actuator_data_type i2c_data_type;
   1476 	struct msm_actuator_reg_params_t *reg_tbl_params;
   1477 	struct reg_settings_t *init_settings;
   1478 };
   1479 
   1480 struct msm_actuator_set_info_t {
   1481 	struct msm_actuator_params_t actuator_params;
   1482 	struct msm_actuator_tuning_params_t af_tuning_params;
   1483 };
   1484 
   1485 struct msm_actuator_get_info_t {
   1486 	uint32_t focal_length_num;
   1487 	uint32_t focal_length_den;
   1488 	uint32_t f_number_num;
   1489 	uint32_t f_number_den;
   1490 	uint32_t f_pix_num;
   1491 	uint32_t f_pix_den;
   1492 	uint32_t total_f_dist_num;
   1493 	uint32_t total_f_dist_den;
   1494 	uint32_t hor_view_angle_num;
   1495 	uint32_t hor_view_angle_den;
   1496 	uint32_t ver_view_angle_num;
   1497 	uint32_t ver_view_angle_den;
   1498 };
   1499 
   1500 enum af_camera_name {
   1501 	ACTUATOR_MAIN_CAM_0,
   1502 	ACTUATOR_MAIN_CAM_1,
   1503 	ACTUATOR_MAIN_CAM_2,
   1504 	ACTUATOR_MAIN_CAM_3,
   1505 	ACTUATOR_MAIN_CAM_4,
   1506 	ACTUATOR_MAIN_CAM_5,
   1507 	ACTUATOR_WEB_CAM_0,
   1508 	ACTUATOR_WEB_CAM_1,
   1509 	ACTUATOR_WEB_CAM_2,
   1510 };
   1511 
   1512 struct msm_actuator_cfg_data {
   1513 	int cfgtype;
   1514 	uint8_t is_af_supported;
   1515 	union {
   1516 		struct msm_actuator_move_params_t move;
   1517 		struct msm_actuator_set_info_t set_info;
   1518 		struct msm_actuator_get_info_t get_info;
   1519 		enum af_camera_name cam_name;
   1520 	} cfg;
   1521 };
   1522 
   1523 struct msm_eeprom_support {
   1524 	uint16_t is_supported;
   1525 	uint16_t size;
   1526 	uint16_t index;
   1527 	uint16_t qvalue;
   1528 };
   1529 
   1530 struct msm_calib_wb {
   1531 	uint16_t r_over_g;
   1532 	uint16_t b_over_g;
   1533 	uint16_t gr_over_gb;
   1534 };
   1535 
   1536 struct msm_calib_af {
   1537 	uint16_t macro_dac;
   1538 	uint16_t inf_dac;
   1539 	uint16_t start_dac;
   1540 };
   1541 
   1542 struct msm_calib_lsc {
   1543 	uint16_t r_gain[221];
   1544 	uint16_t b_gain[221];
   1545 	uint16_t gr_gain[221];
   1546 	uint16_t gb_gain[221];
   1547 };
   1548 
   1549 struct pixel_t {
   1550 	int x;
   1551 	int y;
   1552 };
   1553 
   1554 struct msm_calib_dpc {
   1555 	uint16_t validcount;
   1556 	struct pixel_t snapshot_coord[128];
   1557 	struct pixel_t preview_coord[128];
   1558 	struct pixel_t video_coord[128];
   1559 };
   1560 
   1561 struct msm_camera_eeprom_info_t {
   1562 	struct msm_eeprom_support af;
   1563 	struct msm_eeprom_support wb;
   1564 	struct msm_eeprom_support lsc;
   1565 	struct msm_eeprom_support dpc;
   1566 };
   1567 
   1568 struct msm_eeprom_cfg_data {
   1569 	int cfgtype;
   1570 	uint8_t is_eeprom_supported;
   1571 	union {
   1572 		struct msm_eeprom_data_t get_data;
   1573 		struct msm_camera_eeprom_info_t get_info;
   1574 	} cfg;
   1575 };
   1576 
   1577 struct sensor_large_data {
   1578 	int cfgtype;
   1579 	union {
   1580 		struct sensor_3d_cali_data_t sensor_3d_cali_data;
   1581 	} data;
   1582 };
   1583 
   1584 enum sensor_type_t {
   1585 	BAYER,
   1586 	YUV,
   1587 	JPEG_SOC,
   1588 };
   1589 
   1590 enum flash_type {
   1591 	LED_FLASH,
   1592 	STROBE_FLASH,
   1593 };
   1594 
   1595 enum strobe_flash_ctrl_type {
   1596 	STROBE_FLASH_CTRL_INIT,
   1597 	STROBE_FLASH_CTRL_CHARGE,
   1598 	STROBE_FLASH_CTRL_RELEASE
   1599 };
   1600 
   1601 struct strobe_flash_ctrl_data {
   1602 	enum strobe_flash_ctrl_type type;
   1603 	int charge_en;
   1604 };
   1605 
   1606 struct msm_camera_info {
   1607 	int num_cameras;
   1608 	uint8_t has_3d_support[MSM_MAX_CAMERA_SENSORS];
   1609 	uint8_t is_internal_cam[MSM_MAX_CAMERA_SENSORS];
   1610 	uint32_t s_mount_angle[MSM_MAX_CAMERA_SENSORS];
   1611 	const char *video_dev_name[MSM_MAX_CAMERA_SENSORS];
   1612 	enum sensor_type_t sensor_type[MSM_MAX_CAMERA_SENSORS];
   1613 };
   1614 
   1615 struct msm_cam_config_dev_info {
   1616 	int num_config_nodes;
   1617 	const char *config_dev_name[MSM_MAX_CAMERA_CONFIGS];
   1618 	int config_dev_id[MSM_MAX_CAMERA_CONFIGS];
   1619 };
   1620 
   1621 struct msm_mctl_node_info {
   1622 	int num_mctl_nodes;
   1623 	const char *mctl_node_name[MSM_MAX_CAMERA_SENSORS];
   1624 };
   1625 
   1626 struct flash_ctrl_data {
   1627 	int flashtype;
   1628 	union {
   1629 		int led_state;
   1630 		struct strobe_flash_ctrl_data strobe_ctrl;
   1631 	} ctrl_data;
   1632 };
   1633 
   1634 #define GET_NAME			0
   1635 #define GET_PREVIEW_LINE_PER_FRAME	1
   1636 #define GET_PREVIEW_PIXELS_PER_LINE	2
   1637 #define GET_SNAPSHOT_LINE_PER_FRAME	3
   1638 #define GET_SNAPSHOT_PIXELS_PER_LINE	4
   1639 #define GET_SNAPSHOT_FPS		5
   1640 #define GET_SNAPSHOT_MAX_EP_LINE_CNT	6
   1641 
   1642 struct msm_camsensor_info {
   1643 	char name[MAX_SENSOR_NAME];
   1644 	uint8_t flash_enabled;
   1645 	uint8_t strobe_flash_enabled;
   1646 	uint8_t actuator_enabled;
   1647 	uint8_t ispif_supported;
   1648 	int8_t total_steps;
   1649 	uint8_t support_3d;
   1650 	enum flash_type flashtype;
   1651 	enum sensor_type_t sensor_type;
   1652 	uint32_t pxlcode;	/* enum v4l2_mbus_pixelcode */
   1653 	uint32_t camera_type;	/* msm_camera_type */
   1654 	int mount_angle;
   1655 	uint32_t max_width;
   1656 	uint32_t max_height;
   1657 };
   1658 
   1659 #define V4L2_SINGLE_PLANE	0
   1660 #define V4L2_MULTI_PLANE_Y	0
   1661 #define V4L2_MULTI_PLANE_CBCR	1
   1662 #define V4L2_MULTI_PLANE_CB	1
   1663 #define V4L2_MULTI_PLANE_CR	2
   1664 
   1665 struct plane_data {
   1666 	int plane_id;
   1667 	uint32_t offset;
   1668 	unsigned long size;
   1669 };
   1670 
   1671 struct img_plane_info {
   1672 	uint32_t width;
   1673 	uint32_t height;
   1674 	uint32_t pixelformat;
   1675 	uint8_t buffer_type;	/*Single/Multi planar */
   1676 	uint8_t output_port;
   1677 	uint32_t ext_mode;
   1678 	uint8_t num_planes;
   1679 	struct plane_data plane[MAX_PLANES];
   1680 	uint32_t sp_y_offset;
   1681 	uint32_t inst_handle;
   1682 };
   1683 
   1684 #define QCAMERA_NAME "qcamera"
   1685 #define QCAMERA_SERVER_NAME "qcamera_server"
   1686 #define QCAMERA_DEVICE_GROUP_ID 1
   1687 #define QCAMERA_VNODE_GROUP_ID 2
   1688 
   1689 enum msm_cam_subdev_type {
   1690 	CSIPHY_DEV,
   1691 	CSID_DEV,
   1692 	CSIC_DEV,
   1693 	ISPIF_DEV,
   1694 	VFE_DEV,
   1695 	AXI_DEV,
   1696 	VPE_DEV,
   1697 	SENSOR_DEV,
   1698 	ACTUATOR_DEV,
   1699 	EEPROM_DEV,
   1700 	GESTURE_DEV,
   1701 	IRQ_ROUTER_DEV,
   1702 	CPP_DEV,
   1703 	CCI_DEV,
   1704 };
   1705 
   1706 struct msm_mctl_set_sdev_data {
   1707 	uint32_t revision;
   1708 	enum msm_cam_subdev_type sdev_type;
   1709 };
   1710 
   1711 #define MSM_CAM_V4L2_IOCTL_GET_CAMERA_INFO \
   1712 	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
   1713 
   1714 #define MSM_CAM_V4L2_IOCTL_GET_CONFIG_INFO \
   1715 	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
   1716 
   1717 #define MSM_CAM_V4L2_IOCTL_GET_MCTL_INFO \
   1718 	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t)
   1719 
   1720 #define MSM_CAM_V4L2_IOCTL_CTRL_CMD_DONE \
   1721 	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t)
   1722 
   1723 #define MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD \
   1724 	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t)
   1725 
   1726 #define MSM_CAM_IOCTL_SEND_EVENT \
   1727 	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct v4l2_event)
   1728 
   1729 #define MSM_CAM_V4L2_IOCTL_CFG_VPE \
   1730 	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_vpe_cfg_cmd)
   1731 
   1732 #define MSM_CAM_V4L2_IOCTL_PRIVATE_S_CTRL \
   1733 	_IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_camera_v4l2_ioctl_t)
   1734 
   1735 #define MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL \
   1736 	_IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct msm_camera_v4l2_ioctl_t)
   1737 
   1738 #define VIDIOC_MSM_VPE_INIT \
   1739 	_IO('V', BASE_VIDIOC_PRIVATE + 15)
   1740 
   1741 #define VIDIOC_MSM_VPE_RELEASE \
   1742 	_IO('V', BASE_VIDIOC_PRIVATE + 16)
   1743 
   1744 #define VIDIOC_MSM_VPE_CFG \
   1745 	_IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_mctl_pp_params *)
   1746 
   1747 #define VIDIOC_MSM_AXI_INIT \
   1748 	_IO('V', BASE_VIDIOC_PRIVATE + 18)
   1749 
   1750 #define VIDIOC_MSM_AXI_RELEASE \
   1751 	_IO('V', BASE_VIDIOC_PRIVATE + 19)
   1752 
   1753 #define VIDIOC_MSM_AXI_CFG \
   1754 	_IOWR('V', BASE_VIDIOC_PRIVATE + 20, void *)
   1755 
   1756 #define VIDIOC_MSM_AXI_IRQ \
   1757 	_IOWR('V', BASE_VIDIOC_PRIVATE + 21, void *)
   1758 
   1759 #define VIDIOC_MSM_AXI_BUF_CFG \
   1760 	_IOWR('V', BASE_VIDIOC_PRIVATE + 22, void *)
   1761 
   1762 #define VIDIOC_MSM_VFE_INIT \
   1763 	_IO('V', BASE_VIDIOC_PRIVATE + 22)
   1764 
   1765 #define VIDIOC_MSM_VFE_RELEASE \
   1766 	_IO('V', BASE_VIDIOC_PRIVATE + 23)
   1767 
   1768 struct msm_camera_v4l2_ioctl_t {
   1769 	uint32_t id;
   1770 	void __user *ioctl_ptr;
   1771 	uint32_t len;
   1772 };
   1773 
   1774 struct msm_camera_vfe_params_t {
   1775 	uint32_t operation_mode;
   1776 	uint32_t capture_count;
   1777 	uint32_t skip_abort;
   1778 	uint16_t port_info;
   1779 	uint32_t inst_handle;
   1780 	uint16_t cmd_type;
   1781 };
   1782 
   1783 enum msm_camss_irq_idx {
   1784 	CAMERA_SS_IRQ_0,
   1785 	CAMERA_SS_IRQ_1,
   1786 	CAMERA_SS_IRQ_2,
   1787 	CAMERA_SS_IRQ_3,
   1788 	CAMERA_SS_IRQ_4,
   1789 	CAMERA_SS_IRQ_5,
   1790 	CAMERA_SS_IRQ_6,
   1791 	CAMERA_SS_IRQ_7,
   1792 	CAMERA_SS_IRQ_8,
   1793 	CAMERA_SS_IRQ_9,
   1794 	CAMERA_SS_IRQ_10,
   1795 	CAMERA_SS_IRQ_11,
   1796 	CAMERA_SS_IRQ_12,
   1797 	CAMERA_SS_IRQ_MAX
   1798 };
   1799 
   1800 enum msm_cam_hw_idx {
   1801 	MSM_CAM_HW_MICRO,
   1802 	MSM_CAM_HW_CCI,
   1803 	MSM_CAM_HW_CSI0,
   1804 	MSM_CAM_HW_CSI1,
   1805 	MSM_CAM_HW_CSI2,
   1806 	MSM_CAM_HW_CSI3,
   1807 	MSM_CAM_HW_ISPIF,
   1808 	MSM_CAM_HW_CPP,
   1809 	MSM_CAM_HW_VFE0,
   1810 	MSM_CAM_HW_VFE1,
   1811 	MSM_CAM_HW_JPEG0,
   1812 	MSM_CAM_HW_JPEG1,
   1813 	MSM_CAM_HW_JPEG2,
   1814 	MSM_CAM_HW_MAX
   1815 };
   1816 
   1817 struct msm_camera_irq_cfg {
   1818 	/* Bit mask of all the camera hardwares that needs to
   1819 	 * be composited into a single IRQ to the MSM.
   1820 	 * Current usage: (may be updated based on hw changes)
   1821 	 * Bits 31:13 - Reserved.
   1822 	 * Bits 12:0
   1823 	 * 12 - MSM_CAM_HW_JPEG2
   1824 	 * 11 - MSM_CAM_HW_JPEG1
   1825 	 * 10 - MSM_CAM_HW_JPEG0
   1826 	 *  9 - MSM_CAM_HW_VFE1
   1827 	 *  8 - MSM_CAM_HW_VFE0
   1828 	 *  7 - MSM_CAM_HW_CPP
   1829 	 *  6 - MSM_CAM_HW_ISPIF
   1830 	 *  5 - MSM_CAM_HW_CSI3
   1831 	 *  4 - MSM_CAM_HW_CSI2
   1832 	 *  3 - MSM_CAM_HW_CSI1
   1833 	 *  2 - MSM_CAM_HW_CSI0
   1834 	 *  1 - MSM_CAM_HW_CCI
   1835 	 *  0 - MSM_CAM_HW_MICRO
   1836 	 */
   1837 	uint32_t cam_hw_mask;
   1838 	uint8_t irq_idx;
   1839 	uint8_t num_hwcore;
   1840 };
   1841 
   1842 #define MSM_IRQROUTER_CFG_COMPIRQ \
   1843 	_IOWR('V', BASE_VIDIOC_PRIVATE, void __user *)
   1844 
   1845 #define MAX_NUM_CPP_STRIPS 8
   1846 
   1847 enum msm_cpp_frame_type {
   1848 	MSM_CPP_OFFLINE_FRAME,
   1849 	MSM_CPP_REALTIME_FRAME,
   1850 };
   1851 
   1852 struct msm_cpp_frame_strip_info {
   1853 	int scale_v_en;
   1854 	int scale_h_en;
   1855 
   1856 	int upscale_v_en;
   1857 	int upscale_h_en;
   1858 
   1859 	int src_start_x;
   1860 	int src_end_x;
   1861 	int src_start_y;
   1862 	int src_end_y;
   1863 
   1864 	/* Padding is required for upscaler because it does not
   1865 	 * pad internally like other blocks, also needed for rotation
   1866 	 * rotation expects all the blocks in the stripe to be the same size
   1867 	 * Padding is done such that all the extra padded pixels
   1868 	 * are on the right and bottom
   1869 	 */
   1870 	int pad_bottom;
   1871 	int pad_top;
   1872 	int pad_right;
   1873 	int pad_left;
   1874 
   1875 	int v_init_phase;
   1876 	int h_init_phase;
   1877 	int h_phase_step;
   1878 	int v_phase_step;
   1879 
   1880 	int prescale_crop_width_first_pixel;
   1881 	int prescale_crop_width_last_pixel;
   1882 	int prescale_crop_height_first_line;
   1883 	int prescale_crop_height_last_line;
   1884 
   1885 	int postscale_crop_height_first_line;
   1886 	int postscale_crop_height_last_line;
   1887 	int postscale_crop_width_first_pixel;
   1888 	int postscale_crop_width_last_pixel;
   1889 
   1890 	int dst_start_x;
   1891 	int dst_end_x;
   1892 	int dst_start_y;
   1893 	int dst_end_y;
   1894 
   1895 	int bytes_per_pixel;
   1896 	unsigned int source_address;
   1897 	unsigned int destination_address;
   1898 	unsigned int src_stride;
   1899 	unsigned int dst_stride;
   1900 	int rotate_270;
   1901 	int horizontal_flip;
   1902 	int vertical_flip;
   1903 	int scale_output_width;
   1904 	int scale_output_height;
   1905 };
   1906 
   1907 struct msm_cpp_frame_info_t {
   1908 	int32_t frame_id;
   1909 	uint32_t inst_id;
   1910 	uint32_t client_id;
   1911 	enum msm_cpp_frame_type frame_type;
   1912 	uint32_t num_strips;
   1913 	struct msm_cpp_frame_strip_info *strip_info;
   1914 };
   1915 
   1916 struct msm_ver_num_info {
   1917 	uint32_t main;
   1918 	uint32_t minor;
   1919 	uint32_t rev;
   1920 };
   1921 
   1922 #define VIDIOC_MSM_CPP_CFG \
   1923 	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl_t)
   1924 
   1925 #define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD \
   1926 	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
   1927 
   1928 #define VIDIOC_MSM_CPP_GET_INST_INFO \
   1929 	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
   1930 
   1931 #define V4L2_EVENT_CPP_FRAME_DONE  (V4L2_EVENT_PRIVATE_START + 0)
   1932 
   1933 /* Instance Handle - inst_handle
   1934  * Data bundle containing the information about where
   1935  * to get a buffer for a particular camera instance.
   1936  * This is a bitmask containing the following data:
   1937  * Buffer Handle Bitmask:
   1938  *      ------------------------------------
   1939  *      Bits    :  Purpose
   1940  *      ------------------------------------
   1941  *      31 - 24 :  Reserved.
   1942  *      23      :  is Image mode valid?
   1943  *      22 - 16 :  Image mode.
   1944  *      15      :  is MCTL PP inst idx valid?
   1945  *      14 - 8  :  MCTL PP inst idx.
   1946  *      7       :  is Video inst idx valid?
   1947  *      6 - 0   :  Video inst idx.
   1948  */
   1949 #define CLR_IMG_MODE(handle)	(handle &= 0xFF00FFFF)
   1950 #define SET_IMG_MODE(handle, data)	\
   1951 	(handle |= ((0x1 << 23) | ((data & 0x7F) << 16)))
   1952 #define GET_IMG_MODE(handle)	\
   1953 	((handle & 0x800000) ? ((handle & 0x7F0000) >> 16) : 0xFF)
   1954 
   1955 #define CLR_MCTLPP_INST_IDX(handle)	(handle &= 0xFFFF00FF)
   1956 #define SET_MCTLPP_INST_IDX(handle, data)	\
   1957 	(handle |= ((0x1 << 15) | ((data & 0x7F) << 8)))
   1958 #define GET_MCTLPP_INST_IDX(handle)	\
   1959 	((handle & 0x8000) ? ((handle & 0x7F00) >> 8) : 0xFF)
   1960 
   1961 #define CLR_VIDEO_INST_IDX(handle)	(handle &= 0xFFFFFF00)
   1962 #define GET_VIDEO_INST_IDX(handle)	\
   1963 	((handle & 0x80) ? (handle & 0x7F) : 0xFF)
   1964 #define SET_VIDEO_INST_IDX(handle, data)	\
   1965 	(handle |= (0x1 << 7) | (data & 0x7F))
   1966 
   1967 #endif /* __LINUX_MSM_CAMERA_H */
   1968