cam_req_mgr.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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. /* SOF Event status */
  53. #define CAM_REQ_MGR_SOF_EVENT_SUCCESS 0
  54. #define CAM_REQ_MGR_SOF_EVENT_ERROR 1
  55. /* Link control operations */
  56. #define CAM_REQ_MGR_LINK_ACTIVATE 0
  57. #define CAM_REQ_MGR_LINK_DEACTIVATE 1
  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. * Request Manager : Sync Mode type
  72. * @CAM_REQ_MGR_SYNC_MODE_NO_SYNC: Req mgr will apply non-sync mode for this
  73. * request.
  74. * @CAM_REQ_MGR_SYNC_MODE_SYNC: Req mgr will apply sync mode for this request.
  75. */
  76. #define CAM_REQ_MGR_SYNC_MODE_NO_SYNC 0
  77. #define CAM_REQ_MGR_SYNC_MODE_SYNC 1
  78. /**
  79. * struct cam_req_mgr_event_data
  80. * @session_hdl: session handle
  81. * @link_hdl: link handle
  82. * @frame_id: frame id
  83. * @reserved: reserved for 64 bit aligngment
  84. * @req_id: request id
  85. * @tv_sec: timestamp in seconds
  86. * @tv_usec: timestamp in micro seconds
  87. */
  88. struct cam_req_mgr_event_data {
  89. __s32 session_hdl;
  90. __s32 link_hdl;
  91. __s32 frame_id;
  92. __s32 reserved;
  93. __s64 req_id;
  94. __u64 tv_sec;
  95. __u64 tv_usec;
  96. };
  97. /**
  98. * struct cam_req_mgr_session_info
  99. * @session_hdl: In/Output param - session_handle
  100. * @opcode1: CAM_REQ_MGR_CREATE_SESSION
  101. * @opcode2: CAM_REQ_MGR_DESTROY_SESSION
  102. */
  103. struct cam_req_mgr_session_info {
  104. __s32 session_hdl;
  105. __s32 reserved;
  106. };
  107. /**
  108. * struct cam_req_mgr_link_info
  109. * @session_hdl: Input param - Identifier for CSL session
  110. * @num_devices: Input Param - Num of devices to be linked
  111. * @dev_hdls: Input param - List of device handles to be linked
  112. * @link_hdl: Output Param -Identifier for link
  113. * @opcode: CAM_REQ_MGR_LINK
  114. */
  115. struct cam_req_mgr_link_info {
  116. __s32 session_hdl;
  117. __u32 num_devices;
  118. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES];
  119. __s32 link_hdl;
  120. };
  121. struct cam_req_mgr_link_info_v2 {
  122. __s32 session_hdl;
  123. __u32 num_devices;
  124. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES_V2];
  125. __s32 link_hdl;
  126. };
  127. struct cam_req_mgr_ver_info {
  128. __u32 version;
  129. union {
  130. struct cam_req_mgr_link_info link_info_v1;
  131. struct cam_req_mgr_link_info_v2 link_info_v2;
  132. } u;
  133. };
  134. /**
  135. * struct cam_req_mgr_unlink_info
  136. * @session_hdl: input param - session handle
  137. * @link_hdl: input param - link handle
  138. * @opcode: CAM_REQ_MGR_UNLINK
  139. */
  140. struct cam_req_mgr_unlink_info {
  141. __s32 session_hdl;
  142. __s32 link_hdl;
  143. };
  144. /**
  145. * struct cam_req_mgr_flush_info
  146. * @brief: User can tell drivers to flush a particular request id or
  147. * flush all requests from its pending processing queue. Flush is a
  148. * blocking call and driver shall ensure all requests are flushed
  149. * before returning.
  150. * @session_hdl: Input param - Identifier for CSL session
  151. * @link_hdl: Input Param -Identifier for link
  152. * @flush_type: User can cancel a particular req id or can flush
  153. * all requests in queue
  154. * @reserved: reserved for 64 bit aligngment
  155. * @req_id: field is valid only if flush type is cancel request
  156. * for flush all this field value is not considered.
  157. * @opcode: CAM_REQ_MGR_FLUSH_REQ
  158. */
  159. struct cam_req_mgr_flush_info {
  160. __s32 session_hdl;
  161. __s32 link_hdl;
  162. __u32 flush_type;
  163. __u32 reserved;
  164. __s64 req_id;
  165. };
  166. /** struct cam_req_mgr_sched_info
  167. * @session_hdl: Input param - Identifier for CSL session
  168. * @link_hdl: Input Param -Identifier for link
  169. * inluding itself.
  170. * @bubble_enable: Input Param - Cam req mgr will do bubble recovery if this
  171. * flag is set.
  172. * @sync_mode: Type of Sync mode for this request
  173. * @additional_timeout: Additional timeout value (in ms) associated with
  174. * this request. This value needs to be 0 in cases where long exposure is
  175. * not configured for the sensor.The max timeout that will be supported
  176. * is 50000 ms
  177. * @reserved: Reserved
  178. * @req_id: Input Param - Request Id from which all requests will be flushed
  179. */
  180. struct cam_req_mgr_sched_request {
  181. __s32 session_hdl;
  182. __s32 link_hdl;
  183. __s32 bubble_enable;
  184. __s32 sync_mode;
  185. __s32 additional_timeout;
  186. __s32 reserved;
  187. __s64 req_id;
  188. };
  189. /**
  190. * struct cam_req_mgr_sync_mode
  191. * @session_hdl: Input param - Identifier for CSL session
  192. * @sync_mode: Input Param - Type of sync mode
  193. * @num_links: Input Param - Num of links in sync mode (Valid only
  194. * when sync_mode is one of SYNC enabled modes)
  195. * @link_hdls: Input Param - Array of link handles to be in sync mode
  196. * (Valid only when sync_mode is one of SYNC
  197. * enabled modes)
  198. * @master_link_hdl: Input Param - To dictate which link's SOF drives system
  199. * (Valid only when sync_mode is one of SYNC
  200. * enabled modes)
  201. *
  202. * @opcode: CAM_REQ_MGR_SYNC_MODE
  203. */
  204. struct cam_req_mgr_sync_mode {
  205. __s32 session_hdl;
  206. __s32 sync_mode;
  207. __s32 num_links;
  208. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  209. __s32 master_link_hdl;
  210. __s32 reserved;
  211. };
  212. /**
  213. * struct cam_req_mgr_link_control
  214. * @ops: Link operations: activate/deactive
  215. * @session_hdl: Input param - Identifier for CSL session
  216. * @num_links: Input Param - Num of links
  217. * @reserved: reserved field
  218. * @init_timeout: To account for INIT exposure settings (ms)
  219. * If there is no change in exp settings
  220. * field needs to assigned to 0ms.
  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. __s32 ops;
  227. __s32 session_hdl;
  228. __s32 num_links;
  229. __s32 reserved;
  230. __s32 init_timeout[MAX_LINKS_PER_SESSION];
  231. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  232. };
  233. /**
  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)
  248. #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13)
  249. #define CAM_REQ_MGR_LINK_V2 (CAM_COMMON_OPCODE_MAX + 14)
  250. #define CAM_REQ_MGR_REQUEST_DUMP (CAM_COMMON_OPCODE_MAX + 15)
  251. /* end of cam_req_mgr opcodes */
  252. #define CAM_MEM_FLAG_HW_READ_WRITE (1<<0)
  253. #define CAM_MEM_FLAG_HW_READ_ONLY (1<<1)
  254. #define CAM_MEM_FLAG_HW_WRITE_ONLY (1<<2)
  255. #define CAM_MEM_FLAG_KMD_ACCESS (1<<3)
  256. #define CAM_MEM_FLAG_UMD_ACCESS (1<<4)
  257. #define CAM_MEM_FLAG_PROTECTED_MODE (1<<5)
  258. #define CAM_MEM_FLAG_CMD_BUF_TYPE (1<<6)
  259. #define CAM_MEM_FLAG_PIXEL_BUF_TYPE (1<<7)
  260. #define CAM_MEM_FLAG_STATS_BUF_TYPE (1<<8)
  261. #define CAM_MEM_FLAG_PACKET_BUF_TYPE (1<<9)
  262. #define CAM_MEM_FLAG_CACHE (1<<10)
  263. #define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11)
  264. #define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12)
  265. #define CAM_MEM_FLAG_DISABLE_DELAYED_UNMAP (1<<13)
  266. #define CAM_MEM_FLAG_KMD_DEBUG_FLAG (1<<14)
  267. #define CAM_MEM_FLAG_EVA_NOPIXEL (1<<15)
  268. #define CAM_MEM_MMU_MAX_HANDLE 16
  269. /* Maximum allowed buffers in existence */
  270. #define CAM_MEM_BUFQ_MAX 2048
  271. #define CAM_MEM_MGR_SECURE_BIT_POS 15
  272. #define CAM_MEM_MGR_HDL_IDX_SIZE 15
  273. #define CAM_MEM_MGR_HDL_FD_SIZE 16
  274. #define CAM_MEM_MGR_HDL_IDX_END_POS 16
  275. #define CAM_MEM_MGR_HDL_FD_END_POS 32
  276. #define CAM_MEM_MGR_HDL_IDX_MASK ((1 << CAM_MEM_MGR_HDL_IDX_SIZE) - 1)
  277. #define GET_MEM_HANDLE(idx, fd) \
  278. ((idx & CAM_MEM_MGR_HDL_IDX_MASK) | \
  279. (fd << (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE))) \
  280. #define GET_FD_FROM_HANDLE(hdl) \
  281. (hdl >> (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE)) \
  282. #define CAM_MEM_MGR_GET_HDL_IDX(hdl) (hdl & CAM_MEM_MGR_HDL_IDX_MASK)
  283. #define CAM_MEM_MGR_SET_SECURE_HDL(hdl, flag) \
  284. ((flag) ? (hdl |= (1 << CAM_MEM_MGR_SECURE_BIT_POS)) : \
  285. ((hdl) &= ~(1 << CAM_MEM_MGR_SECURE_BIT_POS)))
  286. #define CAM_MEM_MGR_IS_SECURE_HDL(hdl) \
  287. (((hdl) & \
  288. (1<<CAM_MEM_MGR_SECURE_BIT_POS)) >> CAM_MEM_MGR_SECURE_BIT_POS)
  289. /**
  290. * memory allocation type
  291. */
  292. #define CAM_MEM_DMA_NONE 0
  293. #define CAM_MEM_DMA_BIDIRECTIONAL 1
  294. #define CAM_MEM_DMA_TO_DEVICE 2
  295. #define CAM_MEM_DMA_FROM_DEVICE 3
  296. /**
  297. * memory cache operation
  298. */
  299. #define CAM_MEM_CLEAN_CACHE 1
  300. #define CAM_MEM_INV_CACHE 2
  301. #define CAM_MEM_CLEAN_INV_CACHE 3
  302. /**
  303. * struct cam_mem_alloc_out_params
  304. * @buf_handle: buffer handle
  305. * @fd: output buffer file descriptor
  306. * @vaddr: virtual address pointer
  307. */
  308. struct cam_mem_alloc_out_params {
  309. __u32 buf_handle;
  310. __s32 fd;
  311. __u64 vaddr;
  312. };
  313. /**
  314. * struct cam_mem_map_out_params
  315. * @buf_handle: buffer handle
  316. * @size: size of the buffer being mapped
  317. * @vaddr: virtual address pointer
  318. */
  319. struct cam_mem_map_out_params {
  320. __u32 buf_handle;
  321. __u32 size;
  322. __u64 vaddr;
  323. };
  324. /**
  325. * struct cam_mem_mgr_alloc_cmd
  326. * @len: size of buffer to allocate
  327. * @align: alignment of the buffer
  328. * @mmu_hdls: array of mmu handles
  329. * @num_hdl: number of handles
  330. * @flags: flags of the buffer
  331. * @out: out params
  332. */
  333. /* CAM_REQ_MGR_ALLOC_BUF */
  334. struct cam_mem_mgr_alloc_cmd {
  335. __u64 len;
  336. __u64 align;
  337. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  338. __u32 num_hdl;
  339. __u32 flags;
  340. struct cam_mem_alloc_out_params out;
  341. };
  342. /**
  343. * struct cam_mem_mgr_map_cmd
  344. * @mmu_hdls: array of mmu handles
  345. * @num_hdl: number of handles
  346. * @flags: flags of the buffer
  347. * @fd: output buffer file descriptor
  348. * @reserved: reserved field
  349. * @out: out params
  350. */
  351. /* CAM_REQ_MGR_MAP_BUF */
  352. struct cam_mem_mgr_map_cmd {
  353. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  354. __u32 num_hdl;
  355. __u32 flags;
  356. __s32 fd;
  357. __u32 reserved;
  358. struct cam_mem_map_out_params out;
  359. };
  360. /**
  361. * struct cam_mem_mgr_map_cmd
  362. * @buf_handle: buffer handle
  363. * @reserved: reserved field
  364. */
  365. /* CAM_REQ_MGR_RELEASE_BUF */
  366. struct cam_mem_mgr_release_cmd {
  367. __s32 buf_handle;
  368. __u32 reserved;
  369. };
  370. /**
  371. * struct cam_mem_mgr_map_cmd
  372. * @buf_handle: buffer handle
  373. * @ops: cache operations
  374. */
  375. /* CAM_REQ_MGR_CACHE_OPS */
  376. struct cam_mem_cache_ops_cmd {
  377. __s32 buf_handle;
  378. __u32 mem_cache_ops;
  379. };
  380. /**
  381. * Request Manager : error message type
  382. * @CAM_REQ_MGR_ERROR_TYPE_DEVICE: Device error message, fatal to session
  383. * @CAM_REQ_MGR_ERROR_TYPE_REQUEST: Error on a single request, not fatal
  384. * @CAM_REQ_MGR_ERROR_TYPE_BUFFER: Buffer was not filled, not fatal
  385. * @CAM_REQ_MGR_ERROR_TYPE_RECOVERY: Fatal error, can be recovered
  386. * @CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE: SOF freeze, can be recovered
  387. * @CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY: Full recovery, can be recovered
  388. * @CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT: page fault, can be recovered
  389. */
  390. #define CAM_REQ_MGR_ERROR_TYPE_DEVICE 0
  391. #define CAM_REQ_MGR_ERROR_TYPE_REQUEST 1
  392. #define CAM_REQ_MGR_ERROR_TYPE_BUFFER 2
  393. #define CAM_REQ_MGR_ERROR_TYPE_RECOVERY 3
  394. #define CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE 4
  395. #define CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY 5
  396. #define CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT 6
  397. /**
  398. * Request Manager : Error codes
  399. * @CAM_REQ_MGR_ISP_UNREPORTED_ERROR : No Error Code reported
  400. * @CAM_REQ_MGR_LINK_STALLED_ERROR : Unable to apply requests on link
  401. * @CAM_REQ_MGR_CSID_FATAL_ERROR : CSID FATAL Error
  402. * @CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR : CSID OutputFIFO Overflow
  403. * @CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR : CSID Recovery Overflow
  404. * @CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR: CSID Lane fifo overflow
  405. * @CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH : CSID Pixel Count Mismatch
  406. * @CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION : Packet header received by the csid rx is corrupted
  407. * @CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA : Lesser data received in packet header than expected
  408. * @CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING : Fatal Error encountered while switching the sensors
  409. * @CAM_REQ_MGR_CSID_UNBOUNDED_FRAME : No EOF in the frame or the frame started with eof
  410. * @CAM_REQ_MGR_ICP_NO_MEMORY : ICP No Memory
  411. * @CAM_REQ_MGR_ICP_ERROR_SYSTEM_FAILURE : ICP system failure
  412. */
  413. #define CAM_REQ_MGR_ISP_UNREPORTED_ERROR 0
  414. #define CAM_REQ_MGR_LINK_STALLED_ERROR BIT(0)
  415. #define CAM_REQ_MGR_CSID_FATAL_ERROR BIT(1)
  416. #define CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR BIT(2)
  417. #define CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR BIT(3)
  418. #define CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR BIT(4)
  419. #define CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH BIT(5)
  420. #define CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION BIT(6)
  421. #define CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA BIT(7)
  422. #define CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING BIT(8)
  423. #define CAM_REQ_MGR_CSID_UNBOUNDED_FRAME BIT(9)
  424. #define CAM_REQ_MGR_ICP_NO_MEMORY BIT(10)
  425. #define CAM_REQ_MGR_ICP_SYSTEM_FAILURE BIT(11)
  426. /**
  427. * struct cam_req_mgr_error_msg
  428. * @error_type: type of error
  429. * @request_id: request id of frame
  430. * @device_hdl: device handle
  431. * @linke_hdl: link_hdl
  432. * @resource_size: size of the resource
  433. * @error_code: Error code reported by the event.
  434. * Note: This field is a bit field.
  435. */
  436. struct cam_req_mgr_error_msg {
  437. __u32 error_type;
  438. __u32 request_id;
  439. __s32 device_hdl;
  440. __s32 link_hdl;
  441. __u32 resource_size;
  442. __u32 error_code;
  443. };
  444. /**
  445. * struct cam_req_mgr_frame_msg
  446. * @request_id: request id of the frame
  447. * @frame_id: frame id of the frame
  448. * @timestamp: timestamp of the frame
  449. * @link_hdl: link handle associated with this message
  450. * @sof_status: sof status success or fail
  451. * @frame_id_meta: refers to the meta for
  452. * that frame in specific usecases
  453. * @reserved: reserved
  454. */
  455. struct cam_req_mgr_frame_msg {
  456. __u64 request_id;
  457. __u64 frame_id;
  458. __u64 timestamp;
  459. __s32 link_hdl;
  460. __u32 sof_status;
  461. __u32 frame_id_meta;
  462. __u32 reserved;
  463. };
  464. /**
  465. * struct cam_req_mgr_custom_msg
  466. * @custom_type: custom type
  467. * @request_id: request id of the frame
  468. * @frame_id: frame id of the frame
  469. * @timestamp: timestamp of the frame
  470. * @link_hdl: link handle associated with this message
  471. * @custom_data: custom data
  472. */
  473. struct cam_req_mgr_custom_msg {
  474. __u32 custom_type;
  475. __u64 request_id;
  476. __u64 frame_id;
  477. __u64 timestamp;
  478. __s32 link_hdl;
  479. __u64 custom_data;
  480. };
  481. /**
  482. * Request Manager Node Msg Event Types
  483. * @CAM_REQ_MGR_NO_EVENT : Event type not reported by the hardware
  484. * @CAM_REQ_MGR_RETRY_EVENT : Retry request reported from the hardware
  485. */
  486. #define CAM_REQ_MGR_NO_EVENT 0
  487. #define CAM_REQ_MGR_RETRY_EVENT 1
  488. /**
  489. * Request Manager Node Msg Event Cause
  490. * @CAM_REQ_MGR_CAUSE_UNREPORTED : Event cause not reported by the hardware
  491. * @CAM_REQ_MGR_JPEG_THUBNAIL_SIZE_ERROR : JPEG Thumbnail encode size exceeds the threshold size
  492. */
  493. #define CAM_REQ_MGR_CAUSE_UNREPORTED 0
  494. #define CAM_REQ_MGR_JPEG_THUBNAIL_SIZE_ERROR 1
  495. /**
  496. * struct cam_req_mgr_node_msg
  497. * @device_hdl : Device handle of the device reporting the error
  498. * @link_hdl : link hdl for real time devices
  499. * @event_type : Type of the event
  500. * @event_cause : Cause of the event
  501. * @request_id : Request id
  502. * @custom_data : custom data
  503. * @reserved : Reserved field
  504. */
  505. struct cam_req_mgr_node_msg {
  506. __s32 device_hdl;
  507. __s32 link_hdl;
  508. __u32 event_type;
  509. __u32 event_cause;
  510. __u64 request_id;
  511. __u64 custom_data;
  512. __u32 reserved[2];
  513. };
  514. /**
  515. * struct cam_req_mgr_message
  516. * @session_hdl: session to which the frame belongs to
  517. * @reserved: reserved field
  518. * @u: union which can either be error/frame/custom/node message
  519. */
  520. struct cam_req_mgr_message {
  521. __s32 session_hdl;
  522. __s32 reserved;
  523. union {
  524. struct cam_req_mgr_error_msg err_msg;
  525. struct cam_req_mgr_frame_msg frame_msg;
  526. struct cam_req_mgr_custom_msg custom_msg;
  527. struct cam_req_mgr_node_msg node_msg;
  528. } u;
  529. };
  530. #endif /* __UAPI_LINUX_CAM_REQ_MGR_H */