cam_req_mgr.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __UAPI_LINUX_CAM_REQ_MGR_H
  6. #define __UAPI_LINUX_CAM_REQ_MGR_H
  7. #include <linux/videodev2.h>
  8. #include <linux/types.h>
  9. #include <linux/ioctl.h>
  10. #include <linux/media.h>
  11. #include <media/cam_defs.h>
  12. #define CAM_REQ_MGR_VNODE_NAME "cam-req-mgr-devnode"
  13. #define CAM_DEVICE_TYPE_BASE (MEDIA_ENT_F_OLD_BASE)
  14. #define CAM_VNODE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE)
  15. #define CAM_SENSOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 1)
  16. #define CAM_IFE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 2)
  17. #define CAM_ICP_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 3)
  18. #define CAM_LRME_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 4)
  19. #define CAM_JPEG_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 5)
  20. #define CAM_FD_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 6)
  21. #define CAM_CPAS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 7)
  22. #define CAM_CSIPHY_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 8)
  23. #define CAM_ACTUATOR_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 9)
  24. #define CAM_CCI_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 10)
  25. #define CAM_FLASH_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 11)
  26. #define CAM_EEPROM_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 12)
  27. #define CAM_OIS_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 13)
  28. #define CAM_CUSTOM_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 14)
  29. #define CAM_OPE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 15)
  30. #define CAM_TFE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 16)
  31. #define CAM_CRE_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 17)
  32. #define CAM_TPG_DEVICE_TYPE (CAM_DEVICE_TYPE_BASE + 18)
  33. /* cam_req_mgr hdl info */
  34. #define CAM_REQ_MGR_HDL_IDX_POS 8
  35. #define CAM_REQ_MGR_HDL_IDX_MASK ((1 << CAM_REQ_MGR_HDL_IDX_POS) - 1)
  36. #define CAM_REQ_MGR_GET_HDL_IDX(hdl) (hdl & CAM_REQ_MGR_HDL_IDX_MASK)
  37. /**
  38. * Max handles supported by cam_req_mgr
  39. * It includes both session and device handles
  40. */
  41. #define CAM_REQ_MGR_MAX_HANDLES 64
  42. #define CAM_REQ_MGR_MAX_HANDLES_V2 256
  43. #define MAX_LINKS_PER_SESSION 2
  44. /* V4L event type which user space will subscribe to */
  45. #define V4L_EVENT_CAM_REQ_MGR_EVENT (V4L2_EVENT_PRIVATE_START + 0)
  46. /* Specific event ids to get notified in user space */
  47. #define V4L_EVENT_CAM_REQ_MGR_SOF 0
  48. #define V4L_EVENT_CAM_REQ_MGR_ERROR 1
  49. #define V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS 2
  50. #define V4L_EVENT_CAM_REQ_MGR_CUSTOM_EVT 3
  51. #define V4L_EVENT_CAM_REQ_MGR_NODE_EVENT 4
  52. #define V4L_EVENT_CAM_REQ_MGR_SOF_UNIFIED_TS 5
  53. /* SOF Event status */
  54. #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0
  55. #define CAM_REQ_MGR_SOF_EVENT_ERROR 1
  56. /* Link control operations */
  57. #define CAM_REQ_MGR_LINK_ACTIVATE 0
  58. #define CAM_REQ_MGR_LINK_DEACTIVATE 1
  59. /**
  60. * Request Manager : flush_type
  61. * @CAM_REQ_MGR_FLUSH_TYPE_ALL: Req mgr will remove all the pending
  62. * requests from input/processing queue.
  63. * @CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ: Req mgr will remove only particular
  64. * request id from input/processing queue.
  65. * @CAM_REQ_MGR_FLUSH_TYPE_MAX: Max number of the flush type
  66. * @opcode: CAM_REQ_MGR_FLUSH_REQ
  67. */
  68. #define CAM_REQ_MGR_FLUSH_TYPE_ALL 0
  69. #define CAM_REQ_MGR_FLUSH_TYPE_CANCEL_REQ 1
  70. #define CAM_REQ_MGR_FLUSH_TYPE_MAX 2
  71. /**
  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. * struct cam_req_mgr_event_data
  81. * @session_hdl: session handle
  82. * @link_hdl: link handle
  83. * @frame_id: frame id
  84. * @reserved: reserved for 64 bit aligngment
  85. * @req_id: request id
  86. * @tv_sec: timestamp in seconds
  87. * @tv_usec: timestamp in micro seconds
  88. */
  89. struct cam_req_mgr_event_data {
  90. __s32 session_hdl;
  91. __s32 link_hdl;
  92. __s32 frame_id;
  93. __s32 reserved;
  94. __s64 req_id;
  95. __u64 tv_sec;
  96. __u64 tv_usec;
  97. };
  98. /**
  99. * struct cam_req_mgr_session_info
  100. * @session_hdl: In/Output param - session_handle
  101. * @opcode1: CAM_REQ_MGR_CREATE_SESSION
  102. * @opcode2: CAM_REQ_MGR_DESTROY_SESSION
  103. */
  104. struct cam_req_mgr_session_info {
  105. __s32 session_hdl;
  106. __s32 reserved;
  107. };
  108. /**
  109. * struct cam_req_mgr_link_info
  110. * @session_hdl: Input param - Identifier for CSL session
  111. * @num_devices: Input Param - Num of devices to be linked
  112. * @dev_hdls: Input param - List of device handles to be linked
  113. * @link_hdl: Output Param -Identifier for link
  114. * @opcode: CAM_REQ_MGR_LINK
  115. */
  116. struct cam_req_mgr_link_info {
  117. __s32 session_hdl;
  118. __u32 num_devices;
  119. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES];
  120. __s32 link_hdl;
  121. };
  122. struct cam_req_mgr_link_info_v2 {
  123. __s32 session_hdl;
  124. __u32 num_devices;
  125. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES_V2];
  126. __s32 link_hdl;
  127. };
  128. struct cam_req_mgr_ver_info {
  129. __u32 version;
  130. union {
  131. struct cam_req_mgr_link_info link_info_v1;
  132. struct cam_req_mgr_link_info_v2 link_info_v2;
  133. } u;
  134. };
  135. /**
  136. * struct cam_req_mgr_unlink_info
  137. * @session_hdl: input param - session handle
  138. * @link_hdl: input param - link handle
  139. * @opcode: CAM_REQ_MGR_UNLINK
  140. */
  141. struct cam_req_mgr_unlink_info {
  142. __s32 session_hdl;
  143. __s32 link_hdl;
  144. };
  145. /**
  146. * struct cam_req_mgr_flush_info
  147. * @brief: User can tell drivers to flush a particular request id or
  148. * flush all requests from its pending processing queue. Flush is a
  149. * blocking call and driver shall ensure all requests are flushed
  150. * before returning.
  151. * @session_hdl: Input param - Identifier for CSL session
  152. * @link_hdl: Input Param -Identifier for link
  153. * @flush_type: User can cancel a particular req id or can flush
  154. * all requests in queue
  155. * @reserved: reserved for 64 bit aligngment
  156. * @req_id: field is valid only if flush type is cancel request
  157. * for flush all this field value is not considered.
  158. * @opcode: CAM_REQ_MGR_FLUSH_REQ
  159. */
  160. struct cam_req_mgr_flush_info {
  161. __s32 session_hdl;
  162. __s32 link_hdl;
  163. __u32 flush_type;
  164. __u32 reserved;
  165. __s64 req_id;
  166. };
  167. /** struct cam_req_mgr_sched_info
  168. * @session_hdl: Input param - Identifier for CSL session
  169. * @link_hdl: Input Param -Identifier for link
  170. * inluding itself.
  171. * @bubble_enable: Input Param - Cam req mgr will do bubble recovery if this
  172. * flag is set.
  173. * @sync_mode: Type of Sync mode for this request
  174. * @additional_timeout: Additional timeout value (in ms) associated with
  175. * this request. This value needs to be 0 in cases where long exposure is
  176. * not configured for the sensor.The max timeout that will be supported
  177. * is 50000 ms
  178. * @reserved: Reserved
  179. * @req_id: Input Param - Request Id from which all requests will be flushed
  180. */
  181. struct cam_req_mgr_sched_request {
  182. __s32 session_hdl;
  183. __s32 link_hdl;
  184. __s32 bubble_enable;
  185. __s32 sync_mode;
  186. __s32 additional_timeout;
  187. __s32 reserved;
  188. __s64 req_id;
  189. };
  190. /**
  191. * struct cam_req_mgr_sync_mode
  192. * @session_hdl: Input param - Identifier for CSL session
  193. * @sync_mode: Input Param - Type of sync mode
  194. * @num_links: Input Param - Num of links in sync mode (Valid only
  195. * when sync_mode is one of SYNC enabled modes)
  196. * @link_hdls: Input Param - Array of link handles to be in sync mode
  197. * (Valid only when sync_mode is one of SYNC
  198. * enabled modes)
  199. * @master_link_hdl: Input Param - To dictate which link's SOF drives system
  200. * (Valid only when sync_mode is one of SYNC
  201. * enabled modes)
  202. *
  203. * @opcode: CAM_REQ_MGR_SYNC_MODE
  204. */
  205. struct cam_req_mgr_sync_mode {
  206. __s32 session_hdl;
  207. __s32 sync_mode;
  208. __s32 num_links;
  209. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  210. __s32 master_link_hdl;
  211. __s32 reserved;
  212. };
  213. /**
  214. * struct cam_req_mgr_link_control
  215. * @ops: Link operations: activate/deactive
  216. * @session_hdl: Input param - Identifier for CSL session
  217. * @num_links: Input Param - Num of links
  218. * @reserved: reserved field
  219. * @init_timeout: To account for INIT exposure settings (ms)
  220. * If there is no change in exp settings
  221. * field needs to assigned to 0ms.
  222. * @link_hdls: Input Param - Links to be activated/deactivated
  223. *
  224. * @opcode: CAM_REQ_MGR_LINK_CONTROL
  225. */
  226. struct cam_req_mgr_link_control {
  227. __s32 ops;
  228. __s32 session_hdl;
  229. __s32 num_links;
  230. __s32 reserved;
  231. __s32 init_timeout[MAX_LINKS_PER_SESSION];
  232. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  233. };
  234. /**
  235. * cam_req_mgr specific opcode ids
  236. */
  237. #define CAM_REQ_MGR_CREATE_DEV_NODES (CAM_COMMON_OPCODE_MAX + 1)
  238. #define CAM_REQ_MGR_CREATE_SESSION (CAM_COMMON_OPCODE_MAX + 2)
  239. #define CAM_REQ_MGR_DESTROY_SESSION (CAM_COMMON_OPCODE_MAX + 3)
  240. #define CAM_REQ_MGR_LINK (CAM_COMMON_OPCODE_MAX + 4)
  241. #define CAM_REQ_MGR_UNLINK (CAM_COMMON_OPCODE_MAX + 5)
  242. #define CAM_REQ_MGR_SCHED_REQ (CAM_COMMON_OPCODE_MAX + 6)
  243. #define CAM_REQ_MGR_FLUSH_REQ (CAM_COMMON_OPCODE_MAX + 7)
  244. #define CAM_REQ_MGR_SYNC_MODE (CAM_COMMON_OPCODE_MAX + 8)
  245. #define CAM_REQ_MGR_ALLOC_BUF (CAM_COMMON_OPCODE_MAX + 9)
  246. #define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10)
  247. #define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11)
  248. #define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12)
  249. #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13)
  250. #define CAM_REQ_MGR_LINK_V2 (CAM_COMMON_OPCODE_MAX + 14)
  251. #define CAM_REQ_MGR_REQUEST_DUMP (CAM_COMMON_OPCODE_MAX + 15)
  252. /* end of cam_req_mgr opcodes */
  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)
  264. #define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11)
  265. #define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12)
  266. #define CAM_MEM_FLAG_DISABLE_DELAYED_UNMAP (1<<13)
  267. #define CAM_MEM_FLAG_KMD_DEBUG_FLAG (1<<14)
  268. #define CAM_MEM_FLAG_EVA_NOPIXEL (1<<15)
  269. #define CAM_MEM_MMU_MAX_HANDLE 16
  270. /* Maximum allowed buffers in existence */
  271. #define CAM_MEM_BUFQ_MAX 2048
  272. #define CAM_MEM_MGR_SECURE_BIT_POS 15
  273. #define CAM_MEM_MGR_HDL_IDX_SIZE 15
  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. #define CAM_MEM_MGR_HDL_IDX_MASK ((1 << CAM_MEM_MGR_HDL_IDX_SIZE) - 1)
  278. #define GET_MEM_HANDLE(idx, fd) \
  279. ((idx & CAM_MEM_MGR_HDL_IDX_MASK) | \
  280. (fd << (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE))) \
  281. #define GET_FD_FROM_HANDLE(hdl) \
  282. (hdl >> (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE)) \
  283. #define CAM_MEM_MGR_GET_HDL_IDX(hdl) (hdl & CAM_MEM_MGR_HDL_IDX_MASK)
  284. #define CAM_MEM_MGR_SET_SECURE_HDL(hdl, flag) \
  285. ((flag) ? (hdl |= (1 << CAM_MEM_MGR_SECURE_BIT_POS)) : \
  286. ((hdl) &= ~(1 << CAM_MEM_MGR_SECURE_BIT_POS)))
  287. #define CAM_MEM_MGR_IS_SECURE_HDL(hdl) \
  288. (((hdl) & \
  289. (1<<CAM_MEM_MGR_SECURE_BIT_POS)) >> CAM_MEM_MGR_SECURE_BIT_POS)
  290. /**
  291. * memory allocation type
  292. */
  293. #define CAM_MEM_DMA_NONE 0
  294. #define CAM_MEM_DMA_BIDIRECTIONAL 1
  295. #define CAM_MEM_DMA_TO_DEVICE 2
  296. #define CAM_MEM_DMA_FROM_DEVICE 3
  297. /**
  298. * memory cache operation
  299. */
  300. #define CAM_MEM_CLEAN_CACHE 1
  301. #define CAM_MEM_INV_CACHE 2
  302. #define CAM_MEM_CLEAN_INV_CACHE 3
  303. /**
  304. * struct cam_mem_alloc_out_params
  305. * @buf_handle: buffer handle
  306. * @fd: output buffer file descriptor
  307. * @vaddr: virtual address pointer
  308. */
  309. struct cam_mem_alloc_out_params {
  310. __u32 buf_handle;
  311. __s32 fd;
  312. __u64 vaddr;
  313. };
  314. /**
  315. * struct cam_mem_map_out_params
  316. * @buf_handle: buffer handle
  317. * @size: size of the buffer being mapped
  318. * @vaddr: virtual address pointer
  319. */
  320. struct cam_mem_map_out_params {
  321. __u32 buf_handle;
  322. __u32 size;
  323. __u64 vaddr;
  324. };
  325. /**
  326. * struct cam_mem_mgr_alloc_cmd
  327. * @len: size of buffer to allocate
  328. * @align: alignment of the buffer
  329. * @mmu_hdls: array of mmu handles
  330. * @num_hdl: number of handles
  331. * @flags: flags of the buffer
  332. * @out: out params
  333. */
  334. /* CAM_REQ_MGR_ALLOC_BUF */
  335. struct cam_mem_mgr_alloc_cmd {
  336. __u64 len;
  337. __u64 align;
  338. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  339. __u32 num_hdl;
  340. __u32 flags;
  341. struct cam_mem_alloc_out_params out;
  342. };
  343. /**
  344. * struct cam_mem_mgr_map_cmd
  345. * @mmu_hdls: array of mmu handles
  346. * @num_hdl: number of handles
  347. * @flags: flags of the buffer
  348. * @fd: output buffer file descriptor
  349. * @reserved: reserved field
  350. * @out: out params
  351. */
  352. /* CAM_REQ_MGR_MAP_BUF */
  353. struct cam_mem_mgr_map_cmd {
  354. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  355. __u32 num_hdl;
  356. __u32 flags;
  357. __s32 fd;
  358. __u32 reserved;
  359. struct cam_mem_map_out_params out;
  360. };
  361. /**
  362. * struct cam_mem_mgr_map_cmd
  363. * @buf_handle: buffer handle
  364. * @reserved: reserved field
  365. */
  366. /* CAM_REQ_MGR_RELEASE_BUF */
  367. struct cam_mem_mgr_release_cmd {
  368. __s32 buf_handle;
  369. __u32 reserved;
  370. };
  371. /**
  372. * struct cam_mem_mgr_map_cmd
  373. * @buf_handle: buffer handle
  374. * @ops: cache operations
  375. */
  376. /* CAM_REQ_MGR_CACHE_OPS */
  377. struct cam_mem_cache_ops_cmd {
  378. __s32 buf_handle;
  379. __u32 mem_cache_ops;
  380. };
  381. /**
  382. * Request Manager : error message type
  383. * @CAM_REQ_MGR_ERROR_TYPE_DEVICE: Device error message, fatal to session
  384. * @CAM_REQ_MGR_ERROR_TYPE_REQUEST: Error on a single request, not fatal
  385. * @CAM_REQ_MGR_ERROR_TYPE_BUFFER: Buffer was not filled, not fatal
  386. * @CAM_REQ_MGR_ERROR_TYPE_RECOVERY: Fatal error, can be recovered
  387. * @CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE: SOF freeze, can be recovered
  388. * @CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY: Full recovery, can be recovered
  389. * @CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT: page fault, can be recovered
  390. */
  391. #define CAM_REQ_MGR_ERROR_TYPE_DEVICE 0
  392. #define CAM_REQ_MGR_ERROR_TYPE_REQUEST 1
  393. #define CAM_REQ_MGR_ERROR_TYPE_BUFFER 2
  394. #define CAM_REQ_MGR_ERROR_TYPE_RECOVERY 3
  395. #define CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE 4
  396. #define CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY 5
  397. #define CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT 6
  398. /**
  399. * Request Manager : Error codes
  400. * @CAM_REQ_MGR_ISP_UNREPORTED_ERROR : No Error Code reported
  401. * @CAM_REQ_MGR_LINK_STALLED_ERROR : Unable to apply requests on link
  402. * @CAM_REQ_MGR_CSID_FATAL_ERROR : CSID FATAL Error
  403. * @CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR : CSID OutputFIFO Overflow
  404. * @CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR : CSID Recovery Overflow
  405. * @CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR: CSID Lane fifo overflow
  406. * @CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH : CSID Pixel Count Mismatch
  407. * @CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION : Packet header received by the csid rx is corrupted
  408. * @CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA : Lesser data received in packet header than expected
  409. * @CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING : Fatal Error encountered while switching the sensors
  410. * @CAM_REQ_MGR_CSID_UNBOUNDED_FRAME : No EOF in the frame or the frame started with eof
  411. */
  412. #define CAM_REQ_MGR_ISP_UNREPORTED_ERROR 0
  413. #define CAM_REQ_MGR_LINK_STALLED_ERROR BIT(0)
  414. #define CAM_REQ_MGR_CSID_FATAL_ERROR BIT(1)
  415. #define CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR BIT(2)
  416. #define CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR BIT(3)
  417. #define CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR BIT(4)
  418. #define CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH BIT(5)
  419. #define CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION BIT(6)
  420. #define CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA BIT(7)
  421. #define CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING BIT(8)
  422. #define CAM_REQ_MGR_CSID_UNBOUNDED_FRAME BIT(9)
  423. /**
  424. * struct cam_req_mgr_error_msg
  425. * @error_type: type of error
  426. * @request_id: request id of frame
  427. * @device_hdl: device handle
  428. * @linke_hdl: link_hdl
  429. * @resource_size: size of the resource
  430. * @error_code: Error code reported by the event.
  431. * Note: This field is a bit field.
  432. */
  433. struct cam_req_mgr_error_msg {
  434. __u32 error_type;
  435. __u32 request_id;
  436. __s32 device_hdl;
  437. __s32 link_hdl;
  438. __u32 resource_size;
  439. __u32 error_code;
  440. };
  441. /**
  442. * struct cam_req_mgr_frame_msg
  443. * @request_id: request id of the frame
  444. * @frame_id: frame id of the frame
  445. * @timestamp: timestamp of the frame
  446. * @link_hdl: link handle associated with this message
  447. * @sof_status: sof status success or fail
  448. * @frame_id_meta: refers to the meta for
  449. * that frame in specific usecases
  450. * @reserved: reserved
  451. */
  452. struct cam_req_mgr_frame_msg {
  453. __u64 request_id;
  454. __u64 frame_id;
  455. __u64 timestamp;
  456. __s32 link_hdl;
  457. __u32 sof_status;
  458. __u32 frame_id_meta;
  459. __u32 reserved;
  460. };
  461. /**
  462. * enum cam_req_msg_timestamp_type - Identifies index of timestamps
  463. *
  464. * @CAM_REQ_SOF_QTIMER_TIMESTAMP: SOF qtimer timestamp
  465. * @CAM_REQ_BOOT_TIMESTAMP: SOF boot timestamp
  466. * @CAM_REQ_TIMESTAMP_TYPE: Max enum index for timestamp type
  467. *
  468. */
  469. enum cam_req_msg_timestamp_type {
  470. CAM_REQ_SOF_QTIMER_TIMESTAMP = 0,
  471. CAM_REQ_BOOT_TIMESTAMP,
  472. CAM_REQ_TIMESTAMP_MAX
  473. };
  474. /**
  475. * struct cam_req_mgr_frame_msg
  476. * @request_id: request id of the frame
  477. * @frame_id: frame id of the frame
  478. * @timestamps: array for all the supported timestamps
  479. * @link_hdl: link handle associated with this message
  480. * @frame_id_meta: refers to the meta for
  481. * that frame in specific usecases
  482. * @reserved: reserved for future addtions and max size for structure can be 64 bytes
  483. */
  484. struct cam_req_mgr_frame_msg_v2 {
  485. __u64 request_id;
  486. __u64 frame_id;
  487. __u64 timestamps[CAM_REQ_TIMESTAMP_MAX];
  488. __s32 link_hdl;
  489. __u32 frame_id_meta;
  490. __u32 reserved[4];
  491. };
  492. /**
  493. * struct cam_req_mgr_custom_msg
  494. * @custom_type: custom type
  495. * @request_id: request id of the frame
  496. * @frame_id: frame id of the frame
  497. * @timestamp: timestamp of the frame
  498. * @link_hdl: link handle associated with this message
  499. * @custom_data: custom data
  500. */
  501. struct cam_req_mgr_custom_msg {
  502. __u32 custom_type;
  503. __u64 request_id;
  504. __u64 frame_id;
  505. __u64 timestamp;
  506. __s32 link_hdl;
  507. __u64 custom_data;
  508. };
  509. /**
  510. * Request Manager Node Msg Event Types
  511. * @CAM_REQ_MGR_NO_EVENT : Event type not reported by the hardware
  512. * @CAM_REQ_MGR_RETRY_EVENT : Retry request reported from the hardware
  513. */
  514. #define CAM_REQ_MGR_NO_EVENT 0
  515. #define CAM_REQ_MGR_RETRY_EVENT 1
  516. /**
  517. * Request Manager Node Msg Event Cause
  518. * @CAM_REQ_MGR_CAUSE_UNREPORTED : Event cause not reported by the hardware
  519. * @CAM_REQ_MGR_JPEG_THUBNAIL_SIZE_ERROR : JPEG Thumbnail encode size exceeds the threshold size
  520. */
  521. #define CAM_REQ_MGR_CAUSE_UNREPORTED 0
  522. #define CAM_REQ_MGR_JPEG_THUBNAIL_SIZE_ERROR 1
  523. /**
  524. * struct cam_req_mgr_node_msg
  525. * @device_hdl : Device handle of the device reporting the error
  526. * @link_hdl : link hdl for real time devices
  527. * @event_type : Type of the event
  528. * @event_cause : Cause of the event
  529. * @request_id : Request id
  530. * @custom_data : custom data
  531. * @reserved : Reserved field
  532. */
  533. struct cam_req_mgr_node_msg {
  534. __s32 device_hdl;
  535. __s32 link_hdl;
  536. __u32 event_type;
  537. __u32 event_cause;
  538. __u64 request_id;
  539. __u64 custom_data;
  540. __u32 reserved[2];
  541. };
  542. /**
  543. * struct cam_req_mgr_message
  544. * @session_hdl: session to which the frame belongs to
  545. * @reserved: reserved field
  546. * @u: union which can either be error/frame/custom/node message
  547. */
  548. struct cam_req_mgr_message {
  549. __s32 session_hdl;
  550. __s32 reserved;
  551. union {
  552. struct cam_req_mgr_error_msg err_msg;
  553. struct cam_req_mgr_frame_msg frame_msg;
  554. struct cam_req_mgr_frame_msg_v2 frame_msg_v2;
  555. struct cam_req_mgr_custom_msg custom_msg;
  556. struct cam_req_mgr_node_msg node_msg;
  557. } u;
  558. };
  559. #endif /* __UAPI_LINUX_CAM_REQ_MGR_H */