Home | History | Annotate | Download | only in media
      1 #ifndef __UAPI_LINUX_MSMB_CAMERA_H
      2 #define __UAPI_LINUX_MSMB_CAMERA_H
      3 
      4 #include <linux/videodev2.h>
      5 #include <linux/types.h>
      6 #include <linux/ioctl.h>
      7 
      8 #define MSM_CAM_LOGSYNC_FILE_NAME "logsync"
      9 #define MSM_CAM_LOGSYNC_FILE_BASEDIR "camera"
     10 
     11 #define MSM_CAM_V4L2_IOCTL_NOTIFY \
     12 	_IOW('V', BASE_VIDIOC_PRIVATE + 30, struct msm_v4l2_event_data)
     13 
     14 #define MSM_CAM_V4L2_IOCTL_NOTIFY_META \
     15 	_IOW('V', BASE_VIDIOC_PRIVATE + 31, struct msm_v4l2_event_data)
     16 
     17 #define MSM_CAM_V4L2_IOCTL_CMD_ACK \
     18 	_IOW('V', BASE_VIDIOC_PRIVATE + 32, struct msm_v4l2_event_data)
     19 
     20 #define MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR \
     21 	_IOW('V', BASE_VIDIOC_PRIVATE + 33, struct msm_v4l2_event_data)
     22 
     23 #define MSM_CAM_V4L2_IOCTL_NOTIFY_DEBUG \
     24 	_IOW('V', BASE_VIDIOC_PRIVATE + 34, struct msm_v4l2_event_data)
     25 
     26 #define MSM_CAM_V4L2_IOCTL_DAEMON_DISABLED \
     27 	_IOW('V', BASE_VIDIOC_PRIVATE + 35, struct msm_v4l2_event_data)
     28 
     29 #define QCAMERA_DEVICE_GROUP_ID	1
     30 #define QCAMERA_VNODE_GROUP_ID	2
     31 #define MSM_CAMERA_NAME			"msm_camera"
     32 #define MSM_CONFIGURATION_NAME	"msm_config"
     33 
     34 #define MSM_CAMERA_SUBDEV_CSIPHY       0
     35 #define MSM_CAMERA_SUBDEV_CSID         1
     36 #define MSM_CAMERA_SUBDEV_ISPIF        2
     37 #define MSM_CAMERA_SUBDEV_VFE          3
     38 #define MSM_CAMERA_SUBDEV_AXI          4
     39 #define MSM_CAMERA_SUBDEV_VPE          5
     40 #define MSM_CAMERA_SUBDEV_SENSOR       6
     41 #define MSM_CAMERA_SUBDEV_ACTUATOR     7
     42 #define MSM_CAMERA_SUBDEV_EEPROM       8
     43 #define MSM_CAMERA_SUBDEV_CPP          9
     44 #define MSM_CAMERA_SUBDEV_CCI          10
     45 #define MSM_CAMERA_SUBDEV_LED_FLASH    11
     46 #define MSM_CAMERA_SUBDEV_STROBE_FLASH 12
     47 #define MSM_CAMERA_SUBDEV_BUF_MNGR     13
     48 #define MSM_CAMERA_SUBDEV_SENSOR_INIT  14
     49 #define MSM_CAMERA_SUBDEV_OIS          15
     50 #define MSM_CAMERA_SUBDEV_FLASH        16
     51 #define MSM_CAMERA_SUBDEV_IR_LED       17
     52 #define MSM_CAMERA_SUBDEV_IR_CUT       18
     53 #define MSM_CAMERA_SUBDEV_EXT          19
     54 #define MSM_CAMERA_SUBDEV_TOF          20
     55 #define MSM_MAX_CAMERA_SENSORS  5
     56 
     57 /* The below macro is defined to put an upper limit on maximum
     58  * number of buffer requested per stream. In case of extremely
     59  * large value for number of buffer due to data structure corruption
     60  * we return error to avoid integer overflow. Group processing
     61  * can have max of 9 groups of 8 bufs each. This value may be
     62  * configured in future*/
     63 #define MSM_CAMERA_MAX_STREAM_BUF 72
     64 
     65 /* Max batch size of processing */
     66 #define MSM_CAMERA_MAX_USER_BUFF_CNT 16
     67 
     68 /* featur base */
     69 #define MSM_CAMERA_FEATURE_BASE     0x00010000
     70 #define MSM_CAMERA_FEATURE_SHUTDOWN (MSM_CAMERA_FEATURE_BASE + 1)
     71 
     72 #define MSM_CAMERA_STATUS_BASE      0x00020000
     73 #define MSM_CAMERA_STATUS_FAIL      (MSM_CAMERA_STATUS_BASE + 1)
     74 #define MSM_CAMERA_STATUS_SUCCESS   (MSM_CAMERA_STATUS_BASE + 2)
     75 
     76 /* event type */
     77 #define MSM_CAMERA_V4L2_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x00002000)
     78 
     79 /* event id */
     80 #define MSM_CAMERA_EVENT_MIN    0
     81 #define MSM_CAMERA_NEW_SESSION  (MSM_CAMERA_EVENT_MIN + 1)
     82 #define MSM_CAMERA_DEL_SESSION  (MSM_CAMERA_EVENT_MIN + 2)
     83 #define MSM_CAMERA_SET_PARM     (MSM_CAMERA_EVENT_MIN + 3)
     84 #define MSM_CAMERA_GET_PARM     (MSM_CAMERA_EVENT_MIN + 4)
     85 #define MSM_CAMERA_MAPPING_CFG  (MSM_CAMERA_EVENT_MIN + 5)
     86 #define MSM_CAMERA_MAPPING_SES  (MSM_CAMERA_EVENT_MIN + 6)
     87 #define MSM_CAMERA_MSM_NOTIFY   (MSM_CAMERA_EVENT_MIN + 7)
     88 #define MSM_CAMERA_EVENT_MAX    (MSM_CAMERA_EVENT_MIN + 8)
     89 
     90 /* data.command */
     91 #define MSM_CAMERA_PRIV_S_CROP			(V4L2_CID_PRIVATE_BASE + 1)
     92 #define MSM_CAMERA_PRIV_G_CROP			(V4L2_CID_PRIVATE_BASE + 2)
     93 #define MSM_CAMERA_PRIV_G_FMT			(V4L2_CID_PRIVATE_BASE + 3)
     94 #define MSM_CAMERA_PRIV_S_FMT			(V4L2_CID_PRIVATE_BASE + 4)
     95 #define MSM_CAMERA_PRIV_TRY_FMT			(V4L2_CID_PRIVATE_BASE + 5)
     96 #define MSM_CAMERA_PRIV_METADATA		(V4L2_CID_PRIVATE_BASE + 6)
     97 #define MSM_CAMERA_PRIV_QUERY_CAP		(V4L2_CID_PRIVATE_BASE + 7)
     98 #define MSM_CAMERA_PRIV_STREAM_ON		(V4L2_CID_PRIVATE_BASE + 8)
     99 #define MSM_CAMERA_PRIV_STREAM_OFF		(V4L2_CID_PRIVATE_BASE + 9)
    100 #define MSM_CAMERA_PRIV_NEW_STREAM		(V4L2_CID_PRIVATE_BASE + 10)
    101 #define MSM_CAMERA_PRIV_DEL_STREAM		(V4L2_CID_PRIVATE_BASE + 11)
    102 #define MSM_CAMERA_PRIV_SHUTDOWN		(V4L2_CID_PRIVATE_BASE + 12)
    103 #define MSM_CAMERA_PRIV_STREAM_INFO_SYNC \
    104 	(V4L2_CID_PRIVATE_BASE + 13)
    105 #define MSM_CAMERA_PRIV_G_SESSION_ID (V4L2_CID_PRIVATE_BASE + 14)
    106 #define MSM_CAMERA_PRIV_CMD_MAX  20
    107 
    108 /* data.status - success */
    109 #define MSM_CAMERA_CMD_SUCESS      0x00000001
    110 #define MSM_CAMERA_BUF_MAP_SUCESS  0x00000002
    111 
    112 /* data.status - error */
    113 #define MSM_CAMERA_ERR_EVT_BASE 0x00010000
    114 #define MSM_CAMERA_ERR_CMD_FAIL		(MSM_CAMERA_ERR_EVT_BASE + 1)
    115 #define MSM_CAMERA_ERR_MAPPING		(MSM_CAMERA_ERR_EVT_BASE + 2)
    116 #define MSM_CAMERA_ERR_DEVICE_BUSY	(MSM_CAMERA_ERR_EVT_BASE + 3)
    117 
    118 /* The msm_v4l2_event_data structure should match the
    119  * v4l2_event.u.data field.
    120  * should not exceed 16 elements */
    121 struct msm_v4l2_event_data {
    122 	/*word 0*/
    123 	unsigned int command;
    124 	/*word 1*/
    125 	unsigned int status;
    126 	/*word 2*/
    127 	unsigned int session_id;
    128 	/*word 3*/
    129 	unsigned int stream_id;
    130 	/*word 4*/
    131 	unsigned int map_op;
    132 	/*word 5*/
    133 	unsigned int map_buf_idx;
    134 	/*word 6*/
    135 	unsigned int notify;
    136 	/*word 7*/
    137 	unsigned int arg_value;
    138 	/*word 8*/
    139 	unsigned int ret_value;
    140 	/*word 9*/
    141 	unsigned int v4l2_event_type;
    142 	/*word 10*/
    143 	unsigned int v4l2_event_id;
    144 	/*word 11*/
    145 	unsigned int handle;
    146 	/*word 12*/
    147 	unsigned int nop6;
    148 	/*word 13*/
    149 	unsigned int nop7;
    150 	/*word 14*/
    151 	unsigned int nop8;
    152 	/*word 15*/
    153 	unsigned int nop9;
    154 };
    155 
    156 /* map to v4l2_format.fmt.raw_data */
    157 struct msm_v4l2_format_data {
    158 	enum v4l2_buf_type type;
    159 	unsigned int width;
    160 	unsigned int height;
    161 	unsigned int pixelformat; /* FOURCC */
    162 	unsigned char num_planes;
    163 	unsigned int plane_sizes[VIDEO_MAX_PLANES];
    164 };
    165 
    166 /*  MSM Four-character-code (FOURCC) */
    167 #define msm_v4l2_fourcc(a, b, c, d)\
    168 	((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) |\
    169 	((__u32)(d) << 24))
    170 
    171 /* Composite stats */
    172 #define MSM_V4L2_PIX_FMT_STATS_COMB v4l2_fourcc('S', 'T', 'C', 'M')
    173 /* AEC stats */
    174 #define MSM_V4L2_PIX_FMT_STATS_AE   v4l2_fourcc('S', 'T', 'A', 'E')
    175 /* AF stats */
    176 #define MSM_V4L2_PIX_FMT_STATS_AF   v4l2_fourcc('S', 'T', 'A', 'F')
    177 /* AWB stats */
    178 #define MSM_V4L2_PIX_FMT_STATS_AWB  v4l2_fourcc('S', 'T', 'W', 'B')
    179 /* IHIST stats */
    180 #define MSM_V4L2_PIX_FMT_STATS_IHST v4l2_fourcc('I', 'H', 'S', 'T')
    181 /* Column count stats */
    182 #define MSM_V4L2_PIX_FMT_STATS_CS   v4l2_fourcc('S', 'T', 'C', 'S')
    183 /* Row count stats */
    184 #define MSM_V4L2_PIX_FMT_STATS_RS   v4l2_fourcc('S', 'T', 'R', 'S')
    185 /* Bayer Grid stats */
    186 #define MSM_V4L2_PIX_FMT_STATS_BG   v4l2_fourcc('S', 'T', 'B', 'G')
    187 /* Bayer focus stats */
    188 #define MSM_V4L2_PIX_FMT_STATS_BF   v4l2_fourcc('S', 'T', 'B', 'F')
    189 /* Bayer hist stats */
    190 #define MSM_V4L2_PIX_FMT_STATS_BHST v4l2_fourcc('B', 'H', 'S', 'T')
    191 
    192 enum smmu_attach_mode {
    193 	NON_SECURE_MODE = 0x01,
    194 	SECURE_MODE = 0x02,
    195 	MAX_PROTECTION_MODE = 0x03,
    196 };
    197 
    198 struct msm_camera_smmu_attach_type {
    199 	enum smmu_attach_mode attach;
    200 };
    201 
    202 struct msm_camera_user_buf_cont_t {
    203 	unsigned int buf_cnt;
    204 	unsigned int buf_idx[MSM_CAMERA_MAX_USER_BUFF_CNT];
    205 };
    206 
    207 struct msm_camera_return_buf {
    208 	__u32 index;
    209 	__u32 reserved;
    210 };
    211 
    212 #define MSM_CAMERA_PRIV_IOCTL_ID_BASE 0
    213 #define MSM_CAMERA_PRIV_IOCTL_ID_RETURN_BUF 1
    214 
    215 struct msm_camera_private_ioctl_arg {
    216 	__u32 id;
    217 	__u32 size;
    218 	__u32 result;
    219 	__u32 reserved;
    220 	__u64 ioctl_ptr;
    221 };
    222 
    223 #define VIDIOC_MSM_CAMERA_PRIVATE_IOCTL_CMD \
    224 	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_private_ioctl_arg)
    225 
    226 #endif
    227 
    228