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