Home | History | Annotate | Download | only in media
      1 #ifndef __LINUX_MSMB_CAMERA_H
      2 #define __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_V4L2_IOCTL_NOTIFY \
      9 	_IOW('V', BASE_VIDIOC_PRIVATE + 30, struct v4l2_event)
     10 
     11 #define MSM_CAM_V4L2_IOCTL_NOTIFY_META \
     12 	_IOW('V', BASE_VIDIOC_PRIVATE + 31, struct v4l2_event)
     13 
     14 #define MSM_CAM_V4L2_IOCTL_CMD_ACK \
     15 	_IOW('V', BASE_VIDIOC_PRIVATE + 32, struct v4l2_event)
     16 
     17 #define MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR \
     18 	_IOW('V', BASE_VIDIOC_PRIVATE + 33, struct v4l2_event)
     19 
     20 #define QCAMERA_DEVICE_GROUP_ID	1
     21 #define QCAMERA_VNODE_GROUP_ID	2
     22 #define MSM_CAMERA_NAME					"msm_camera"
     23 #define MSM_CONFIGURATION_NAME	"msm_config"
     24 
     25 #define MSM_CAMERA_SUBDEV_CSIPHY       0
     26 #define MSM_CAMERA_SUBDEV_CSID         1
     27 #define MSM_CAMERA_SUBDEV_ISPIF        2
     28 #define MSM_CAMERA_SUBDEV_VFE          3
     29 #define MSM_CAMERA_SUBDEV_AXI          4
     30 #define MSM_CAMERA_SUBDEV_VPE          5
     31 #define MSM_CAMERA_SUBDEV_SENSOR       6
     32 #define MSM_CAMERA_SUBDEV_ACTUATOR     7
     33 #define MSM_CAMERA_SUBDEV_EEPROM       8
     34 #define MSM_CAMERA_SUBDEV_CPP          9
     35 #define MSM_CAMERA_SUBDEV_CCI          10
     36 #define MSM_CAMERA_SUBDEV_LED_FLASH    11
     37 #define MSM_CAMERA_SUBDEV_STROBE_FLASH 12
     38 #define MSM_CAMERA_SUBDEV_BUF_MNGR     13
     39 
     40 #define MSM_MAX_CAMERA_SENSORS  5
     41 
     42 /* The below macro is defined to put an upper limit on maximum
     43  * number of buffer requested per stream. In case of extremely
     44  * large value for number of buffer due to data structure corruption
     45  * we return error to avoid integer overflow. This value may be
     46  * configured in future*/
     47 #define MSM_CAMERA_MAX_STREAM_BUF 40
     48 
     49 /* featur base */
     50 #define MSM_CAMERA_FEATURE_BASE     0x00010000
     51 #define MSM_CAMERA_FEATURE_SHUTDOWN (MSM_CAMERA_FEATURE_BASE + 1)
     52 
     53 #define MSM_CAMERA_STATUS_BASE      0x00020000
     54 #define MSM_CAMERA_STATUS_FAIL      (MSM_CAMERA_STATUS_BASE + 1)
     55 #define MSM_CAMERA_STATUS_SUCCESS   (MSM_CAMERA_STATUS_BASE + 2)
     56 
     57 /* event type */
     58 #define MSM_CAMERA_V4L2_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x00002000)
     59 
     60 /* event id */
     61 #define MSM_CAMERA_EVENT_MIN    0
     62 #define MSM_CAMERA_NEW_SESSION  (MSM_CAMERA_EVENT_MIN + 1)
     63 #define MSM_CAMERA_DEL_SESSION  (MSM_CAMERA_EVENT_MIN + 2)
     64 #define MSM_CAMERA_SET_PARM     (MSM_CAMERA_EVENT_MIN + 3)
     65 #define MSM_CAMERA_GET_PARM     (MSM_CAMERA_EVENT_MIN + 4)
     66 #define MSM_CAMERA_MAPPING_CFG  (MSM_CAMERA_EVENT_MIN + 5)
     67 #define MSM_CAMERA_MAPPING_SES  (MSM_CAMERA_EVENT_MIN + 6)
     68 #define MSM_CAMERA_MSM_NOTIFY   (MSM_CAMERA_EVENT_MIN + 7)
     69 #define MSM_CAMERA_EVENT_MAX    (MSM_CAMERA_EVENT_MIN + 8)
     70 
     71 /* data.command */
     72 #define MSM_CAMERA_PRIV_S_CROP		 (V4L2_CID_PRIVATE_BASE + 1)
     73 #define MSM_CAMERA_PRIV_G_CROP		 (V4L2_CID_PRIVATE_BASE + 2)
     74 #define MSM_CAMERA_PRIV_G_FMT			 (V4L2_CID_PRIVATE_BASE + 3)
     75 #define MSM_CAMERA_PRIV_S_FMT			 (V4L2_CID_PRIVATE_BASE + 4)
     76 #define MSM_CAMERA_PRIV_TRY_FMT		 (V4L2_CID_PRIVATE_BASE + 5)
     77 #define MSM_CAMERA_PRIV_METADATA	 (V4L2_CID_PRIVATE_BASE + 6)
     78 #define MSM_CAMERA_PRIV_QUERY_CAP  (V4L2_CID_PRIVATE_BASE + 7)
     79 #define MSM_CAMERA_PRIV_STREAM_ON  (V4L2_CID_PRIVATE_BASE + 8)
     80 #define MSM_CAMERA_PRIV_STREAM_OFF (V4L2_CID_PRIVATE_BASE + 9)
     81 #define MSM_CAMERA_PRIV_NEW_STREAM (V4L2_CID_PRIVATE_BASE + 10)
     82 #define MSM_CAMERA_PRIV_DEL_STREAM (V4L2_CID_PRIVATE_BASE + 11)
     83 #define MSM_CAMERA_PRIV_SHUTDOWN   (V4L2_CID_PRIVATE_BASE + 12)
     84 #define MSM_CAMERA_PRIV_STREAM_INFO_SYNC \
     85 	(V4L2_CID_PRIVATE_BASE + 13)
     86 
     87 /* data.status - success */
     88 #define MSM_CAMERA_CMD_SUCESS      0x00000001
     89 #define MSM_CAMERA_BUF_MAP_SUCESS  0x00000002
     90 
     91 /* data.status - error */
     92 #define MSM_CAMERA_ERR_EVT_BASE 0x00010000
     93 #define MSM_CAMERA_ERR_CMD_FAIL (MSM_CAMERA_ERR_EVT_BASE + 1)
     94 #define MSM_CAMERA_ERR_MAPPING  (MSM_CAMERA_ERR_EVT_BASE + 2)
     95 
     96 /* The msm_v4l2_event_data structure should match the
     97  * v4l2_event.u.data field.
     98  * should not exceed 16 elements */
     99 struct msm_v4l2_event_data {
    100 	/*word 0*/
    101 	unsigned int command;
    102 	/*word 1*/
    103 	unsigned int status;
    104 	/*word 2*/
    105 	unsigned int session_id;
    106 	/*word 3*/
    107 	unsigned int stream_id;
    108 	/*word 4*/
    109 	unsigned int map_op;
    110 	/*word 5*/
    111 	unsigned int map_buf_idx;
    112 	/*word 6*/
    113 	unsigned int notify;
    114 	/*word 7*/
    115 	unsigned int arg_value;
    116 	/*word 8*/
    117 	unsigned int ret_value;
    118 	/*word 9*/
    119 	unsigned int nop3;
    120 	/*word 10*/
    121 	unsigned int nop4;
    122 	/*word 11*/
    123 	unsigned int nop5;
    124 	/*word 12*/
    125 	unsigned int nop6;
    126 	/*word 13*/
    127 	unsigned int nop7;
    128 	/*word 14*/
    129 	unsigned int nop8;
    130 	/*word 15*/
    131 	unsigned int nop9;
    132 };
    133 
    134 /* map to v4l2_format.fmt.raw_data */
    135 struct msm_v4l2_format_data {
    136 	enum v4l2_buf_type type;
    137 	unsigned int width;
    138 	unsigned int height;
    139 	unsigned int pixelformat; /* FOURCC */
    140 	unsigned char num_planes;
    141 	unsigned int plane_sizes[VIDEO_MAX_PLANES];
    142 };
    143 
    144 /*  MSM Four-character-code (FOURCC) */
    145 #define msm_v4l2_fourcc(a, b, c, d)\
    146 	((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) |\
    147 	((__u32)(d) << 24))
    148 
    149 /* Composite stats */
    150 #define MSM_V4L2_PIX_FMT_STATS_COMB v4l2_fourcc('S', 'T', 'C', 'M')
    151 /* AEC stats */
    152 #define MSM_V4L2_PIX_FMT_STATS_AE   v4l2_fourcc('S', 'T', 'A', 'E')
    153 /* AF stats */
    154 #define MSM_V4L2_PIX_FMT_STATS_AF   v4l2_fourcc('S', 'T', 'A', 'F')
    155 /* AWB stats */
    156 #define MSM_V4L2_PIX_FMT_STATS_AWB  v4l2_fourcc('S', 'T', 'W', 'B')
    157 /* IHIST stats */
    158 #define MSM_V4L2_PIX_FMT_STATS_IHST v4l2_fourcc('I', 'H', 'S', 'T')
    159 /* Column count stats */
    160 #define MSM_V4L2_PIX_FMT_STATS_CS   v4l2_fourcc('S', 'T', 'C', 'S')
    161 /* Row count stats */
    162 #define MSM_V4L2_PIX_FMT_STATS_RS   v4l2_fourcc('S', 'T', 'R', 'S')
    163 /* Bayer Grid stats */
    164 #define MSM_V4L2_PIX_FMT_STATS_BG   v4l2_fourcc('S', 'T', 'B', 'G')
    165 /* Bayer focus stats */
    166 #define MSM_V4L2_PIX_FMT_STATS_BF   v4l2_fourcc('S', 'T', 'B', 'F')
    167 /* Bayer hist stats */
    168 #define MSM_V4L2_PIX_FMT_STATS_BHST v4l2_fourcc('B', 'H', 'S', 'T')
    169 
    170 #endif /* __LINUX_MSMB_CAMERA_H */
    171