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