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