Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 1 | #ifndef __UAPI_LINUX_CAM_REQ_MGR_H |
| 2 | #define __UAPI_LINUX_CAM_REQ_MGR_H |
| 3 | |
| 4 | #include <linux/videodev2.h> |
| 5 | #include <linux/types.h> |
| 6 | #include <linux/ioctl.h> |
| 7 | #include <linux/media.h> |
| 8 | #include <media/cam_defs.h> |
| 9 | |
| 10 | #define CAM_REQ_MGR_VNODE_NAME "cam-req-mgr-devnode" |
| 11 | |
Viswanadha Raju Thotakura | 92928c2 | 2017-04-03 22:25:10 -0700 | [diff] [blame] | 12 | #define CAM_DEVICE_TYPE_BASE (MEDIA_ENT_F_OLD_BASE) |
| 13 | #define CAM_VNODE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE) |
| 14 | #define CAM_SENSOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 1) |
| 15 | #define CAM_IFE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 2) |
| 16 | #define CAM_ICP_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 3) |
| 17 | #define CAM_LRME_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 4) |
| 18 | #define CAM_JPEG_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 5) |
| 19 | #define CAM_FD_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 6) |
| 20 | #define CAM_CPAS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 7) |
| 21 | #define CAM_CSIPHY_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 8) |
| 22 | #define CAM_ACTUATOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 9) |
Viswanadha Raju Thotakura | ca44867 | 2017-04-08 22:35:10 -0700 | [diff] [blame] | 23 | #define CAM_CCI_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 10) |
Jigarkumar Zala | db3f849 | 2017-04-20 14:14:29 -0700 | [diff] [blame] | 24 | #define CAM_FLASH_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 11) |
Vivek Veenam | 2ad8de1 | 2017-04-04 18:56:22 +0530 | [diff] [blame] | 25 | #define CAM_EEPROM_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 12) |
Vivek Veenam | 281516b | 2017-08-17 17:39:04 +0530 | [diff] [blame] | 26 | #define CAM_OIS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 13) |
Om Parkash | 48b8c00 | 2018-12-13 20:18:20 +0530 | [diff] [blame] | 27 | #define CAM_IRLED_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 14) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 28 | |
| 29 | /* cam_req_mgr hdl info */ |
| 30 | #define CAM_REQ_MGR_HDL_IDX_POS 8 |
| 31 | #define CAM_REQ_MGR_HDL_IDX_MASK ((1 << CAM_REQ_MGR_HDL_IDX_POS) - 1) |
| 32 | #define CAM_REQ_MGR_GET_HDL_IDX(hdl) (hdl & CAM_REQ_MGR_HDL_IDX_MASK) |
| 33 | |
| 34 | /** |
| 35 | * Max handles supported by cam_req_mgr |
| 36 | * It includes both session and device handles |
| 37 | */ |
| 38 | #define CAM_REQ_MGR_MAX_HANDLES 64 |
Raja Mallik | 477ca24 | 2019-06-21 14:23:32 +0530 | [diff] [blame] | 39 | #define CAM_REQ_MGR_MAX_HANDLES_V2 128 |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 40 | #define MAX_LINKS_PER_SESSION 2 |
| 41 | |
| 42 | /* V4L event type which user space will subscribe to */ |
| 43 | #define V4L_EVENT_CAM_REQ_MGR_EVENT (V4L2_EVENT_PRIVATE_START + 0) |
| 44 | |
| 45 | /* Specific event ids to get notified in user space */ |
Karthik Anantha Ram | c93754c | 2018-03-28 14:21:14 -0700 | [diff] [blame] | 46 | #define V4L_EVENT_CAM_REQ_MGR_SOF 0 |
| 47 | #define V4L_EVENT_CAM_REQ_MGR_ERROR 1 |
| 48 | #define V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS 2 |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 49 | |
Jing Zhou | dedc476 | 2017-06-19 17:45:36 +0530 | [diff] [blame] | 50 | /* SOF Event status */ |
| 51 | #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0 |
| 52 | #define CAM_REQ_MGR_SOF_EVENT_ERROR 1 |
| 53 | |
Jing Zhou | 0f64533 | 2017-11-17 12:16:40 -0800 | [diff] [blame] | 54 | /* Link control operations */ |
| 55 | #define CAM_REQ_MGR_LINK_ACTIVATE 0 |
| 56 | #define CAM_REQ_MGR_LINK_DEACTIVATE 1 |
| 57 | |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Request Manager : flush_type |
| 60 | * @CAM_REQ_MGR_FLUSH_TYPE_ALL: Req mgr will remove all the pending |
| 61 | * requests from input/processing queue. |
| 62 | * @CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ: Req mgr will remove only particular |
| 63 | * request id from input/processing queue. |
| 64 | * @CAM_REQ_MGR_FLUSH_TYPE_MAX: Max number of the flush type |
| 65 | * @opcode: CAM_REQ_MGR_FLUSH_REQ |
| 66 | */ |
| 67 | #define CAM_REQ_MGR_FLUSH_TYPE_ALL 0 |
| 68 | #define CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ 1 |
| 69 | #define CAM_REQ_MGR_FLUSH_TYPE_MAX 2 |
| 70 | |
| 71 | /** |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 72 | * Request Manager : Sync Mode type |
| 73 | * @CAM_REQ_MGR_SYNC_MODE_NO_SYNC: Req mgr will apply non-sync mode for this |
| 74 | * request. |
| 75 | * @CAM_REQ_MGR_SYNC_MODE_SYNC: Req mgr will apply sync mode for this request. |
| 76 | */ |
| 77 | #define CAM_REQ_MGR_SYNC_MODE_NO_SYNC 0 |
| 78 | #define CAM_REQ_MGR_SYNC_MODE_SYNC 1 |
| 79 | |
| 80 | /** |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 81 | * struct cam_req_mgr_event_data |
| 82 | * @session_hdl: session handle |
| 83 | * @link_hdl: link handle |
| 84 | * @frame_id: frame id |
| 85 | * @reserved: reserved for 64 bit aligngment |
| 86 | * @req_id: request id |
| 87 | * @tv_sec: timestamp in seconds |
| 88 | * @tv_usec: timestamp in micro seconds |
| 89 | */ |
| 90 | struct cam_req_mgr_event_data { |
| 91 | int32_t session_hdl; |
| 92 | int32_t link_hdl; |
| 93 | int32_t frame_id; |
| 94 | int32_t reserved; |
| 95 | int64_t req_id; |
| 96 | uint64_t tv_sec; |
| 97 | uint64_t tv_usec; |
| 98 | }; |
| 99 | |
| 100 | /** |
| 101 | * struct cam_req_mgr_session_info |
| 102 | * @session_hdl: In/Output param - session_handle |
| 103 | * @opcode1: CAM_REQ_MGR_CREATE_SESSION |
| 104 | * @opcode2: CAM_REQ_MGR_DESTROY_SESSION |
| 105 | */ |
| 106 | struct cam_req_mgr_session_info { |
| 107 | int32_t session_hdl; |
| 108 | int32_t reserved; |
| 109 | }; |
| 110 | |
| 111 | /** |
| 112 | * struct cam_req_mgr_link_info |
| 113 | * @session_hdl: Input param - Identifier for CSL session |
| 114 | * @num_devices: Input Param - Num of devices to be linked |
| 115 | * @dev_hdls: Input param - List of device handles to be linked |
| 116 | * @link_hdl: Output Param -Identifier for link |
| 117 | * @opcode: CAM_REQ_MGR_LINK |
| 118 | */ |
| 119 | struct cam_req_mgr_link_info { |
| 120 | int32_t session_hdl; |
| 121 | uint32_t num_devices; |
| 122 | int32_t dev_hdls[CAM_REQ_MGR_MAX_HANDLES]; |
| 123 | int32_t link_hdl; |
| 124 | }; |
| 125 | |
Raja Mallik | 477ca24 | 2019-06-21 14:23:32 +0530 | [diff] [blame] | 126 | struct cam_req_mgr_link_info_v2 { |
| 127 | int32_t session_hdl; |
| 128 | uint32_t num_devices; |
| 129 | int32_t dev_hdls[CAM_REQ_MGR_MAX_HANDLES_V2]; |
| 130 | int32_t link_hdl; |
| 131 | }; |
| 132 | |
| 133 | struct cam_req_mgr_ver_info { |
| 134 | uint32_t version; |
| 135 | union { |
| 136 | struct cam_req_mgr_link_info link_info_v1; |
| 137 | struct cam_req_mgr_link_info_v2 link_info_v2; |
| 138 | } u; |
| 139 | }; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 140 | /** |
| 141 | * struct cam_req_mgr_unlink_info |
| 142 | * @session_hdl: input param - session handle |
| 143 | * @link_hdl: input param - link handle |
| 144 | * @opcode: CAM_REQ_MGR_UNLINK |
| 145 | */ |
| 146 | struct cam_req_mgr_unlink_info { |
| 147 | int32_t session_hdl; |
| 148 | int32_t link_hdl; |
| 149 | }; |
| 150 | |
| 151 | /** |
| 152 | * struct cam_req_mgr_flush_info |
| 153 | * @brief: User can tell drivers to flush a particular request id or |
| 154 | * flush all requests from its pending processing queue. Flush is a |
| 155 | * blocking call and driver shall ensure all requests are flushed |
| 156 | * before returning. |
| 157 | * @session_hdl: Input param - Identifier for CSL session |
| 158 | * @link_hdl: Input Param -Identifier for link |
| 159 | * @flush_type: User can cancel a particular req id or can flush |
| 160 | * all requests in queue |
| 161 | * @reserved: reserved for 64 bit aligngment |
| 162 | * @req_id: field is valid only if flush type is cancel request |
| 163 | * for flush all this field value is not considered. |
| 164 | * @opcode: CAM_REQ_MGR_FLUSH_REQ |
| 165 | */ |
| 166 | struct cam_req_mgr_flush_info { |
| 167 | int32_t session_hdl; |
| 168 | int32_t link_hdl; |
| 169 | uint32_t flush_type; |
| 170 | uint32_t reserved; |
| 171 | int64_t req_id; |
| 172 | }; |
| 173 | |
| 174 | /** struct cam_req_mgr_sched_info |
| 175 | * @session_hdl: Input param - Identifier for CSL session |
| 176 | * @link_hdl: Input Param -Identifier for link |
| 177 | * inluding itself. |
| 178 | * @bubble_enable: Input Param - Cam req mgr will do bubble recovery if this |
| 179 | * flag is set. |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 180 | * @sync_mode: Type of Sync mode for this request |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 181 | * @req_id: Input Param - Request Id from which all requests will be flushed |
| 182 | */ |
| 183 | struct cam_req_mgr_sched_request { |
| 184 | int32_t session_hdl; |
| 185 | int32_t link_hdl; |
| 186 | int32_t bubble_enable; |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 187 | int32_t sync_mode; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 188 | int64_t req_id; |
| 189 | }; |
| 190 | |
| 191 | /** |
| 192 | * struct cam_req_mgr_sync_mode |
| 193 | * @session_hdl: Input param - Identifier for CSL session |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 194 | * @sync_mode: Input Param - Type of sync mode |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 195 | * @num_links: Input Param - Num of links in sync mode (Valid only |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 196 | * when sync_mode is one of SYNC enabled modes) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 197 | * @link_hdls: Input Param - Array of link handles to be in sync mode |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 198 | * (Valid only when sync_mode is one of SYNC |
| 199 | * enabled modes) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 200 | * @master_link_hdl: Input Param - To dictate which link's SOF drives system |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 201 | * (Valid only when sync_mode is one of SYNC |
| 202 | * enabled modes) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 203 | * |
| 204 | * @opcode: CAM_REQ_MGR_SYNC_MODE |
| 205 | */ |
| 206 | struct cam_req_mgr_sync_mode { |
| 207 | int32_t session_hdl; |
Pavan Kumar Chilamkurthi | 547dd8f | 2017-11-07 16:48:59 -0800 | [diff] [blame] | 208 | int32_t sync_mode; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 209 | int32_t num_links; |
| 210 | int32_t link_hdls[MAX_LINKS_PER_SESSION]; |
| 211 | int32_t master_link_hdl; |
| 212 | int32_t reserved; |
| 213 | }; |
| 214 | |
| 215 | /** |
Jing Zhou | 0f64533 | 2017-11-17 12:16:40 -0800 | [diff] [blame] | 216 | * struct cam_req_mgr_link_control |
| 217 | * @ops: Link operations: activate/deactive |
| 218 | * @session_hdl: Input param - Identifier for CSL session |
| 219 | * @num_links: Input Param - Num of links |
| 220 | * @reserved: reserved field |
| 221 | * @link_hdls: Input Param - Links to be activated/deactivated |
| 222 | * |
| 223 | * @opcode: CAM_REQ_MGR_LINK_CONTROL |
| 224 | */ |
| 225 | struct cam_req_mgr_link_control { |
| 226 | int32_t ops; |
| 227 | int32_t session_hdl; |
| 228 | int32_t num_links; |
| 229 | int32_t reserved; |
| 230 | int32_t link_hdls[MAX_LINKS_PER_SESSION]; |
| 231 | }; |
| 232 | |
| 233 | /** |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 234 | * cam_req_mgr specific opcode ids |
| 235 | */ |
| 236 | #define CAM_REQ_MGR_CREATE_DEV_NODES (CAM_COMMON_OPCODE_MAX + 1) |
| 237 | #define CAM_REQ_MGR_CREATE_SESSION (CAM_COMMON_OPCODE_MAX + 2) |
| 238 | #define CAM_REQ_MGR_DESTROY_SESSION (CAM_COMMON_OPCODE_MAX + 3) |
| 239 | #define CAM_REQ_MGR_LINK (CAM_COMMON_OPCODE_MAX + 4) |
| 240 | #define CAM_REQ_MGR_UNLINK (CAM_COMMON_OPCODE_MAX + 5) |
| 241 | #define CAM_REQ_MGR_SCHED_REQ (CAM_COMMON_OPCODE_MAX + 6) |
| 242 | #define CAM_REQ_MGR_FLUSH_REQ (CAM_COMMON_OPCODE_MAX + 7) |
| 243 | #define CAM_REQ_MGR_SYNC_MODE (CAM_COMMON_OPCODE_MAX + 8) |
| 244 | #define CAM_REQ_MGR_ALLOC_BUF (CAM_COMMON_OPCODE_MAX + 9) |
| 245 | #define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10) |
| 246 | #define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11) |
| 247 | #define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12) |
Jing Zhou | 0f64533 | 2017-11-17 12:16:40 -0800 | [diff] [blame] | 248 | #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13) |
Raja Mallik | 477ca24 | 2019-06-21 14:23:32 +0530 | [diff] [blame] | 249 | #define CAM_REQ_MGR_LINK_V2 (CAM_COMMON_OPCODE_MAX + 14) |
Raja Mallik | 971acc6 | 2019-08-29 14:36:19 +0530 | [diff] [blame^] | 250 | #define CAM_REQ_MGR_REQUEST_DUMP (CAM_COMMON_OPCODE_MAX + 15) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 251 | /* end of cam_req_mgr opcodes */ |
| 252 | |
| 253 | #define CAM_MEM_FLAG_HW_READ_WRITE (1<<0) |
| 254 | #define CAM_MEM_FLAG_HW_READ_ONLY (1<<1) |
| 255 | #define CAM_MEM_FLAG_HW_WRITE_ONLY (1<<2) |
| 256 | #define CAM_MEM_FLAG_KMD_ACCESS (1<<3) |
| 257 | #define CAM_MEM_FLAG_UMD_ACCESS (1<<4) |
| 258 | #define CAM_MEM_FLAG_PROTECTED_MODE (1<<5) |
| 259 | #define CAM_MEM_FLAG_CMD_BUF_TYPE (1<<6) |
| 260 | #define CAM_MEM_FLAG_PIXEL_BUF_TYPE (1<<7) |
| 261 | #define CAM_MEM_FLAG_STATS_BUF_TYPE (1<<8) |
| 262 | #define CAM_MEM_FLAG_PACKET_BUF_TYPE (1<<9) |
| 263 | #define CAM_MEM_FLAG_CACHE (1<<10) |
Seemanta Dutta | 1c827da | 2017-04-05 17:34:05 -0700 | [diff] [blame] | 264 | #define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11) |
Raja Mallik | 08a0620 | 2018-12-13 15:22:54 +0530 | [diff] [blame] | 265 | #define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12) |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 266 | |
| 267 | #define CAM_MEM_MMU_MAX_HANDLE 16 |
| 268 | |
| 269 | /* Maximum allowed buffers in existence */ |
| 270 | #define CAM_MEM_BUFQ_MAX 1024 |
| 271 | |
Lakshmi Narayana Kalavala | 2c71428 | 2017-09-08 12:27:36 -0700 | [diff] [blame] | 272 | #define CAM_MEM_MGR_SECURE_BIT_POS 15 |
| 273 | #define CAM_MEM_MGR_HDL_IDX_SIZE 15 |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 274 | #define CAM_MEM_MGR_HDL_FD_SIZE 16 |
| 275 | #define CAM_MEM_MGR_HDL_IDX_END_POS 16 |
| 276 | #define CAM_MEM_MGR_HDL_FD_END_POS 32 |
| 277 | |
| 278 | #define CAM_MEM_MGR_HDL_IDX_MASK ((1 << CAM_MEM_MGR_HDL_IDX_SIZE) - 1) |
| 279 | |
| 280 | #define GET_MEM_HANDLE(idx, fd) \ |
Lakshmi Narayana Kalavala | 2c71428 | 2017-09-08 12:27:36 -0700 | [diff] [blame] | 281 | ((idx & CAM_MEM_MGR_HDL_IDX_MASK) | \ |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 282 | (fd << (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE))) \ |
| 283 | |
Suraj Dongre | 2681192 | 2018-06-27 19:30:01 -0700 | [diff] [blame] | 284 | #define GET_FD_FROM_HANDLE(hdl) \ |
| 285 | (hdl >> (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE)) \ |
| 286 | |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 287 | #define CAM_MEM_MGR_GET_HDL_IDX(hdl) (hdl & CAM_MEM_MGR_HDL_IDX_MASK) |
| 288 | |
Lakshmi Narayana Kalavala | 2c71428 | 2017-09-08 12:27:36 -0700 | [diff] [blame] | 289 | #define CAM_MEM_MGR_SET_SECURE_HDL(hdl, flag) \ |
| 290 | ((flag) ? (hdl |= (1 << CAM_MEM_MGR_SECURE_BIT_POS)) : \ |
| 291 | ((hdl) &= ~(1 << CAM_MEM_MGR_SECURE_BIT_POS))) |
| 292 | |
| 293 | #define CAM_MEM_MGR_IS_SECURE_HDL(hdl) \ |
| 294 | (((hdl) & \ |
| 295 | (1<<CAM_MEM_MGR_SECURE_BIT_POS)) >> CAM_MEM_MGR_SECURE_BIT_POS) |
| 296 | |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 297 | /** |
| 298 | * memory allocation type |
| 299 | */ |
| 300 | #define CAM_MEM_DMA_NONE 0 |
| 301 | #define CAM_MEM_DMA_BIDIRECTIONAL 1 |
| 302 | #define CAM_MEM_DMA_TO_DEVICE 2 |
| 303 | #define CAM_MEM_DMA_FROM_DEVICE 3 |
| 304 | |
| 305 | |
| 306 | /** |
| 307 | * memory cache operation |
| 308 | */ |
| 309 | #define CAM_MEM_CLEAN_CACHE 1 |
| 310 | #define CAM_MEM_INV_CACHE 2 |
| 311 | #define CAM_MEM_CLEAN_INV_CACHE 3 |
| 312 | |
| 313 | |
| 314 | /** |
| 315 | * struct cam_mem_alloc_out_params |
| 316 | * @buf_handle: buffer handle |
| 317 | * @fd: output buffer file descriptor |
| 318 | * @vaddr: virtual address pointer |
| 319 | */ |
| 320 | struct cam_mem_alloc_out_params { |
| 321 | uint32_t buf_handle; |
| 322 | int32_t fd; |
| 323 | uint64_t vaddr; |
| 324 | }; |
| 325 | |
| 326 | /** |
| 327 | * struct cam_mem_map_out_params |
| 328 | * @buf_handle: buffer handle |
| 329 | * @reserved: reserved for future |
| 330 | * @vaddr: virtual address pointer |
| 331 | */ |
| 332 | struct cam_mem_map_out_params { |
| 333 | uint32_t buf_handle; |
| 334 | uint32_t reserved; |
| 335 | uint64_t vaddr; |
| 336 | }; |
| 337 | |
| 338 | /** |
| 339 | * struct cam_mem_mgr_alloc_cmd |
| 340 | * @len: size of buffer to allocate |
| 341 | * @align: alignment of the buffer |
| 342 | * @mmu_hdls: array of mmu handles |
| 343 | * @num_hdl: number of handles |
| 344 | * @flags: flags of the buffer |
| 345 | * @out: out params |
| 346 | */ |
| 347 | /* CAM_REQ_MGR_ALLOC_BUF */ |
| 348 | struct cam_mem_mgr_alloc_cmd { |
| 349 | uint64_t len; |
| 350 | uint64_t align; |
| 351 | int32_t mmu_hdls[CAM_MEM_MMU_MAX_HANDLE]; |
| 352 | uint32_t num_hdl; |
| 353 | uint32_t flags; |
| 354 | struct cam_mem_alloc_out_params out; |
| 355 | }; |
| 356 | |
| 357 | /** |
| 358 | * struct cam_mem_mgr_map_cmd |
| 359 | * @mmu_hdls: array of mmu handles |
| 360 | * @num_hdl: number of handles |
| 361 | * @flags: flags of the buffer |
| 362 | * @fd: output buffer file descriptor |
| 363 | * @reserved: reserved field |
| 364 | * @out: out params |
| 365 | */ |
| 366 | |
| 367 | /* CAM_REQ_MGR_MAP_BUF */ |
| 368 | struct cam_mem_mgr_map_cmd { |
| 369 | int32_t mmu_hdls[CAM_MEM_MMU_MAX_HANDLE]; |
| 370 | uint32_t num_hdl; |
| 371 | uint32_t flags; |
| 372 | int32_t fd; |
| 373 | uint32_t reserved; |
| 374 | struct cam_mem_map_out_params out; |
| 375 | }; |
| 376 | |
| 377 | /** |
| 378 | * struct cam_mem_mgr_map_cmd |
| 379 | * @buf_handle: buffer handle |
| 380 | * @reserved: reserved field |
| 381 | */ |
| 382 | /* CAM_REQ_MGR_RELEASE_BUF */ |
| 383 | struct cam_mem_mgr_release_cmd { |
| 384 | int32_t buf_handle; |
| 385 | uint32_t reserved; |
| 386 | }; |
| 387 | |
| 388 | /** |
| 389 | * struct cam_mem_mgr_map_cmd |
| 390 | * @buf_handle: buffer handle |
| 391 | * @ops: cache operations |
| 392 | */ |
| 393 | /* CAM_REQ_MGR_CACHE_OPS */ |
| 394 | struct cam_mem_cache_ops_cmd { |
| 395 | int32_t buf_handle; |
| 396 | uint32_t mem_cache_ops; |
| 397 | }; |
| 398 | |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 399 | /** |
| 400 | * Request Manager : error message type |
| 401 | * @CAM_REQ_MGR_ERROR_TYPE_DEVICE: Device error message, fatal to session |
| 402 | * @CAM_REQ_MGR_ERROR_TYPE_REQUEST: Error on a single request, not fatal |
| 403 | * @CAM_REQ_MGR_ERROR_TYPE_BUFFER: Buffer was not filled, not fatal |
Raja Mallik | ff6c75b | 2019-01-29 16:52:37 +0530 | [diff] [blame] | 404 | * @CAM_REQ_MGR_ERROR_TYPE_RECOVERY: Fatal error, can be recovered |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 405 | */ |
| 406 | #define CAM_REQ_MGR_ERROR_TYPE_DEVICE 0 |
| 407 | #define CAM_REQ_MGR_ERROR_TYPE_REQUEST 1 |
| 408 | #define CAM_REQ_MGR_ERROR_TYPE_BUFFER 2 |
Raja Mallik | ff6c75b | 2019-01-29 16:52:37 +0530 | [diff] [blame] | 409 | #define CAM_REQ_MGR_ERROR_TYPE_RECOVERY 3 |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 410 | |
| 411 | /** |
| 412 | * struct cam_req_mgr_error_msg |
| 413 | * @error_type: type of error |
| 414 | * @request_id: request id of frame |
| 415 | * @device_hdl: device handle |
Harsh Shah | 67fa231 | 2017-10-30 04:03:07 -0700 | [diff] [blame] | 416 | * @linke_hdl: link_hdl |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 417 | * @resource_size: size of the resource |
| 418 | */ |
| 419 | struct cam_req_mgr_error_msg { |
| 420 | uint32_t error_type; |
| 421 | uint32_t request_id; |
| 422 | int32_t device_hdl; |
Harsh Shah | 67fa231 | 2017-10-30 04:03:07 -0700 | [diff] [blame] | 423 | int32_t link_hdl; |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 424 | uint64_t resource_size; |
| 425 | }; |
| 426 | |
| 427 | /** |
| 428 | * struct cam_req_mgr_frame_msg |
Jing Zhou | dedc476 | 2017-06-19 17:45:36 +0530 | [diff] [blame] | 429 | * @request_id: request id of the frame |
| 430 | * @frame_id: frame id of the frame |
| 431 | * @timestamp: timestamp of the frame |
| 432 | * @link_hdl: link handle associated with this message |
| 433 | * @sof_status: sof status success or fail |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 434 | */ |
| 435 | struct cam_req_mgr_frame_msg { |
| 436 | uint64_t request_id; |
Jing Zhou | dedc476 | 2017-06-19 17:45:36 +0530 | [diff] [blame] | 437 | uint64_t frame_id; |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 438 | uint64_t timestamp; |
Jing Zhou | dedc476 | 2017-06-19 17:45:36 +0530 | [diff] [blame] | 439 | int32_t link_hdl; |
| 440 | uint32_t sof_status; |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 441 | }; |
| 442 | |
| 443 | /** |
| 444 | * struct cam_req_mgr_message |
| 445 | * @session_hdl: session to which the frame belongs to |
| 446 | * @reserved: reserved field |
| 447 | * @u: union which can either be error or frame message |
| 448 | */ |
| 449 | struct cam_req_mgr_message { |
| 450 | int32_t session_hdl; |
Harsh Shah | 36a23e3 | 2017-10-26 16:29:54 -0700 | [diff] [blame] | 451 | int32_t reserved; |
Seemanta Dutta | 85afac7 | 2017-05-05 11:45:57 -0700 | [diff] [blame] | 452 | union { |
| 453 | struct cam_req_mgr_error_msg err_msg; |
| 454 | struct cam_req_mgr_frame_msg frame_msg; |
| 455 | } u; |
| 456 | }; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 457 | #endif /* __UAPI_LINUX_CAM_REQ_MGR_H */ |