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. * @CAM_REQ_MGR_SYNC_MODE_INITIAL_SYNC: Req mgr will apply initial sync
  76. * mode for this request. Only first few request before sync mode will apply
  77. * transition sync mode.
  78. */
  79. #define CAM_REQ_MGR_SYNC_MODE_NO_SYNC 0
  80. #define CAM_REQ_MGR_SYNC_MODE_SYNC 1
  81. #define CAM_REQ_MGR_SYNC_MODE_INITIAL_SYNC 2
  82. /**
  83. * struct cam_req_mgr_event_data
  84. * @session_hdl: session handle
  85. * @link_hdl: link handle
  86. * @frame_id: frame id
  87. * @reserved: reserved for 64 bit aligngment
  88. * @req_id: request id
  89. * @tv_sec: timestamp in seconds
  90. * @tv_usec: timestamp in micro seconds
  91. */
  92. struct cam_req_mgr_event_data {
  93. __s32 session_hdl;
  94. __s32 link_hdl;
  95. __s32 frame_id;
  96. __s32 reserved;
  97. __s64 req_id;
  98. __u64 tv_sec;
  99. __u64 tv_usec;
  100. };
  101. /**
  102. * struct cam_req_mgr_session_info
  103. * @session_hdl: In/Output param - session_handle
  104. * @opcode1: CAM_REQ_MGR_CREATE_SESSION
  105. * @opcode2: CAM_REQ_MGR_DESTROY_SESSION
  106. */
  107. struct cam_req_mgr_session_info {
  108. __s32 session_hdl;
  109. __s32 reserved;
  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. __s32 session_hdl;
  121. __u32 num_devices;
  122. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES];
  123. __s32 link_hdl;
  124. };
  125. struct cam_req_mgr_link_info_v2 {
  126. __s32 session_hdl;
  127. __u32 num_devices;
  128. __s32 dev_hdls[CAM_REQ_MGR_MAX_HANDLES_V2];
  129. __s32 link_hdl;
  130. };
  131. struct cam_req_mgr_ver_info {
  132. __u32 version;
  133. union {
  134. struct cam_req_mgr_link_info link_info_v1;
  135. struct cam_req_mgr_link_info_v2 link_info_v2;
  136. } u;
  137. };
  138. /**
  139. * struct cam_req_mgr_unlink_info
  140. * @session_hdl: input param - session handle
  141. * @link_hdl: input param - link handle
  142. * @opcode: CAM_REQ_MGR_UNLINK
  143. */
  144. struct cam_req_mgr_unlink_info {
  145. __s32 session_hdl;
  146. __s32 link_hdl;
  147. };
  148. /**
  149. * struct cam_req_mgr_flush_info
  150. * @brief: User can tell drivers to flush a particular request id or
  151. * flush all requests from its pending processing queue. Flush is a
  152. * blocking call and driver shall ensure all requests are flushed
  153. * before returning.
  154. * @session_hdl: Input param - Identifier for CSL session
  155. * @link_hdl: Input Param -Identifier for link
  156. * @flush_type: User can cancel a particular req id or can flush
  157. * all requests in queue
  158. * @reserved: reserved for 64 bit aligngment
  159. * @req_id: field is valid only if flush type is cancel request
  160. * for flush all this field value is not considered.
  161. * @opcode: CAM_REQ_MGR_FLUSH_REQ
  162. */
  163. struct cam_req_mgr_flush_info {
  164. __s32 session_hdl;
  165. __s32 link_hdl;
  166. __u32 flush_type;
  167. __u32 reserved;
  168. __s64 req_id;
  169. };
  170. /** struct cam_req_mgr_sched_info
  171. * @session_hdl: Input param - Identifier for CSL session
  172. * @link_hdl: Input Param -Identifier for link
  173. * inluding itself.
  174. * @bubble_enable: Input Param - Cam req mgr will do bubble recovery if this
  175. * flag is set.
  176. * @sync_mode: Type of Sync mode for this request
  177. * @additional_timeout: Additional timeout value (in ms) associated with
  178. * this request. This value needs to be 0 in cases where long exposure is
  179. * not configured for the sensor.The max timeout that will be supported
  180. * is 50000 ms
  181. * @reserved: Reserved
  182. * @req_id: Input Param - Request Id from which all requests will be flushed
  183. */
  184. struct cam_req_mgr_sched_request {
  185. __s32 session_hdl;
  186. __s32 link_hdl;
  187. __s32 bubble_enable;
  188. __s32 sync_mode;
  189. __s32 additional_timeout;
  190. __s32 reserved;
  191. __s64 req_id;
  192. };
  193. /**
  194. * struct cam_req_mgr_sync_mode
  195. * @session_hdl: Input param - Identifier for CSL session
  196. * @sync_mode: Input Param - Type of sync mode
  197. * @num_links: Input Param - Num of links in sync mode (Valid only
  198. * when sync_mode is one of SYNC enabled modes)
  199. * @link_hdls: Input Param - Array of link handles to be in sync mode
  200. * (Valid only when sync_mode is one of SYNC
  201. * enabled modes)
  202. * @master_link_hdl: Input Param - To dictate which link's SOF drives system
  203. * (Valid only when sync_mode is one of SYNC
  204. * enabled modes)
  205. *
  206. * @opcode: CAM_REQ_MGR_SYNC_MODE
  207. */
  208. struct cam_req_mgr_sync_mode {
  209. __s32 session_hdl;
  210. __s32 sync_mode;
  211. __s32 num_links;
  212. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  213. __s32 master_link_hdl;
  214. __s32 reserved;
  215. };
  216. /**
  217. * struct cam_req_mgr_link_control
  218. * @ops: Link operations: activate/deactive
  219. * @session_hdl: Input param - Identifier for CSL session
  220. * @num_links: Input Param - Num of links
  221. * @reserved: reserved field
  222. * @init_timeout: To account for INIT exposure settings (ms)
  223. * If there is no change in exp settings
  224. * field needs to assigned to 0ms.
  225. * @link_hdls: Input Param - Links to be activated/deactivated
  226. *
  227. * @opcode: CAM_REQ_MGR_LINK_CONTROL
  228. */
  229. struct cam_req_mgr_link_control {
  230. __s32 ops;
  231. __s32 session_hdl;
  232. __s32 num_links;
  233. __s32 reserved;
  234. __s32 init_timeout[MAX_LINKS_PER_SESSION];
  235. __s32 link_hdls[MAX_LINKS_PER_SESSION];
  236. };
  237. /**
  238. * cam_req_mgr specific opcode ids
  239. */
  240. #define CAM_REQ_MGR_CREATE_DEV_NODES (CAM_COMMON_OPCODE_MAX + 1)
  241. #define CAM_REQ_MGR_CREATE_SESSION (CAM_COMMON_OPCODE_MAX + 2)
  242. #define CAM_REQ_MGR_DESTROY_SESSION (CAM_COMMON_OPCODE_MAX + 3)
  243. #define CAM_REQ_MGR_LINK (CAM_COMMON_OPCODE_MAX + 4)
  244. #define CAM_REQ_MGR_UNLINK (CAM_COMMON_OPCODE_MAX + 5)
  245. #define CAM_REQ_MGR_SCHED_REQ (CAM_COMMON_OPCODE_MAX + 6)
  246. #define CAM_REQ_MGR_FLUSH_REQ (CAM_COMMON_OPCODE_MAX + 7)
  247. #define CAM_REQ_MGR_SYNC_MODE (CAM_COMMON_OPCODE_MAX + 8)
  248. #define CAM_REQ_MGR_ALLOC_BUF (CAM_COMMON_OPCODE_MAX + 9)
  249. #define CAM_REQ_MGR_MAP_BUF (CAM_COMMON_OPCODE_MAX + 10)
  250. #define CAM_REQ_MGR_RELEASE_BUF (CAM_COMMON_OPCODE_MAX + 11)
  251. #define CAM_REQ_MGR_CACHE_OPS (CAM_COMMON_OPCODE_MAX + 12)
  252. #define CAM_REQ_MGR_LINK_CONTROL (CAM_COMMON_OPCODE_MAX + 13)
  253. #define CAM_REQ_MGR_LINK_V2 (CAM_COMMON_OPCODE_MAX + 14)
  254. #define CAM_REQ_MGR_REQUEST_DUMP (CAM_COMMON_OPCODE_MAX + 15)
  255. /* end of cam_req_mgr opcodes */
  256. #define CAM_MEM_FLAG_HW_READ_WRITE (1<<0)
  257. #define CAM_MEM_FLAG_HW_READ_ONLY (1<<1)
  258. #define CAM_MEM_FLAG_HW_WRITE_ONLY (1<<2)
  259. #define CAM_MEM_FLAG_KMD_ACCESS (1<<3)
  260. #define CAM_MEM_FLAG_UMD_ACCESS (1<<4)
  261. #define CAM_MEM_FLAG_PROTECTED_MODE (1<<5)
  262. #define CAM_MEM_FLAG_CMD_BUF_TYPE (1<<6)
  263. #define CAM_MEM_FLAG_PIXEL_BUF_TYPE (1<<7)
  264. #define CAM_MEM_FLAG_STATS_BUF_TYPE (1<<8)
  265. #define CAM_MEM_FLAG_PACKET_BUF_TYPE (1<<9)
  266. #define CAM_MEM_FLAG_CACHE (1<<10)
  267. #define CAM_MEM_FLAG_HW_SHARED_ACCESS (1<<11)
  268. #define CAM_MEM_FLAG_CDSP_OUTPUT (1<<12)
  269. #define CAM_MEM_FLAG_DISABLE_DELAYED_UNMAP (1<<13)
  270. #define CAM_MEM_FLAG_KMD_DEBUG_FLAG (1<<14)
  271. #define CAM_MEM_FLAG_EVA_NOPIXEL (1<<15)
  272. #define CAM_MEM_MMU_MAX_HANDLE 16
  273. /* Maximum allowed buffers in existence */
  274. #define CAM_MEM_BUFQ_MAX 2048
  275. #define CAM_MEM_MGR_SECURE_BIT_POS 15
  276. #define CAM_MEM_MGR_HDL_IDX_SIZE 15
  277. #define CAM_MEM_MGR_HDL_FD_SIZE 16
  278. #define CAM_MEM_MGR_HDL_IDX_END_POS 16
  279. #define CAM_MEM_MGR_HDL_FD_END_POS 32
  280. #define CAM_MEM_MGR_HDL_IDX_MASK ((1 << CAM_MEM_MGR_HDL_IDX_SIZE) - 1)
  281. #define GET_MEM_HANDLE(idx, fd) \
  282. ((idx & CAM_MEM_MGR_HDL_IDX_MASK) | \
  283. (fd << (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE))) \
  284. #define GET_FD_FROM_HANDLE(hdl) \
  285. (hdl >> (CAM_MEM_MGR_HDL_FD_END_POS - CAM_MEM_MGR_HDL_FD_SIZE)) \
  286. #define CAM_MEM_MGR_GET_HDL_IDX(hdl) (hdl & CAM_MEM_MGR_HDL_IDX_MASK)
  287. #define CAM_MEM_MGR_SET_SECURE_HDL(hdl, flag) \
  288. ((flag) ? (hdl |= (1 << CAM_MEM_MGR_SECURE_BIT_POS)) : \
  289. ((hdl) &= ~(1 << CAM_MEM_MGR_SECURE_BIT_POS)))
  290. #define CAM_MEM_MGR_IS_SECURE_HDL(hdl) \
  291. (((hdl) & \
  292. (1<<CAM_MEM_MGR_SECURE_BIT_POS)) >> CAM_MEM_MGR_SECURE_BIT_POS)
  293. /**
  294. * memory allocation type
  295. */
  296. #define CAM_MEM_DMA_NONE 0
  297. #define CAM_MEM_DMA_BIDIRECTIONAL 1
  298. #define CAM_MEM_DMA_TO_DEVICE 2
  299. #define CAM_MEM_DMA_FROM_DEVICE 3
  300. /**
  301. * memory cache operation
  302. */
  303. #define CAM_MEM_CLEAN_CACHE 1
  304. #define CAM_MEM_INV_CACHE 2
  305. #define CAM_MEM_CLEAN_INV_CACHE 3
  306. /**
  307. * struct cam_mem_alloc_out_params
  308. * @buf_handle: buffer handle
  309. * @fd: output buffer file descriptor
  310. * @vaddr: virtual address pointer
  311. */
  312. struct cam_mem_alloc_out_params {
  313. __u32 buf_handle;
  314. __s32 fd;
  315. __u64 vaddr;
  316. };
  317. /**
  318. * struct cam_mem_map_out_params
  319. * @buf_handle: buffer handle
  320. * @size: size of the buffer being mapped
  321. * @vaddr: virtual address pointer
  322. */
  323. struct cam_mem_map_out_params {
  324. __u32 buf_handle;
  325. __u32 size;
  326. __u64 vaddr;
  327. };
  328. /**
  329. * struct cam_mem_mgr_alloc_cmd
  330. * @len: size of buffer to allocate
  331. * @align: alignment of the buffer
  332. * @mmu_hdls: array of mmu handles
  333. * @num_hdl: number of handles
  334. * @flags: flags of the buffer
  335. * @out: out params
  336. */
  337. /* CAM_REQ_MGR_ALLOC_BUF */
  338. struct cam_mem_mgr_alloc_cmd {
  339. __u64 len;
  340. __u64 align;
  341. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  342. __u32 num_hdl;
  343. __u32 flags;
  344. struct cam_mem_alloc_out_params out;
  345. };
  346. /**
  347. * struct cam_mem_mgr_map_cmd
  348. * @mmu_hdls: array of mmu handles
  349. * @num_hdl: number of handles
  350. * @flags: flags of the buffer
  351. * @fd: output buffer file descriptor
  352. * @reserved: reserved field
  353. * @out: out params
  354. */
  355. /* CAM_REQ_MGR_MAP_BUF */
  356. struct cam_mem_mgr_map_cmd {
  357. __s32 mmu_hdls[CAM_MEM_MMU_MAX_HANDLE];
  358. __u32 num_hdl;
  359. __u32 flags;
  360. __s32 fd;
  361. __u32 reserved;
  362. struct cam_mem_map_out_params out;
  363. };
  364. /**
  365. * struct cam_mem_mgr_map_cmd
  366. * @buf_handle: buffer handle
  367. * @reserved: reserved field
  368. */
  369. /* CAM_REQ_MGR_RELEASE_BUF */
  370. struct cam_mem_mgr_release_cmd {
  371. __s32 buf_handle;
  372. __u32 reserved;
  373. };
  374. /**
  375. * struct cam_mem_mgr_map_cmd
  376. * @buf_handle: buffer handle
  377. * @ops: cache operations
  378. */
  379. /* CAM_REQ_MGR_CACHE_OPS */
  380. struct cam_mem_cache_ops_cmd {
  381. __s32 buf_handle;
  382. __u32 mem_cache_ops;
  383. };
  384. /**
  385. * Request Manager : error message type
  386. * @CAM_REQ_MGR_ERROR_TYPE_DEVICE: Device error message, fatal to session
  387. * @CAM_REQ_MGR_ERROR_TYPE_REQUEST: Error on a single request, not fatal
  388. * @CAM_REQ_MGR_ERROR_TYPE_BUFFER: Buffer was not filled, not fatal
  389. * @CAM_REQ_MGR_ERROR_TYPE_RECOVERY: Fatal error, can be recovered
  390. * @CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE: SOF freeze, can be recovered
  391. * @CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY: Full recovery, can be recovered
  392. * @CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT: page fault, can be recovered
  393. */
  394. #define CAM_REQ_MGR_ERROR_TYPE_DEVICE 0
  395. #define CAM_REQ_MGR_ERROR_TYPE_REQUEST 1
  396. #define CAM_REQ_MGR_ERROR_TYPE_BUFFER 2
  397. #define CAM_REQ_MGR_ERROR_TYPE_RECOVERY 3
  398. #define CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE 4
  399. #define CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY 5
  400. #define CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT 6
  401. /**
  402. * Request Manager : Error codes
  403. * @CAM_REQ_MGR_ISP_UNREPORTED_ERROR : No Error Code reported
  404. * @CAM_REQ_MGR_LINK_STALLED_ERROR : Unable to apply requests on link
  405. * @CAM_REQ_MGR_CSID_FATAL_ERROR : CSID FATAL Error
  406. * @CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR : CSID OutputFIFO Overflow
  407. * @CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR : CSID Recovery Overflow
  408. * @CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR: CSID Lane fifo overflow
  409. * @CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH : CSID Pixel Count Mismatch
  410. * @CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION : Packet header received by the csid rx is corrupted
  411. * @CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA : Lesser data received in packet header than expected
  412. * @CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING : Fatal Error encountered while switching the sensors
  413. * @CAM_REQ_MGR_CSID_UNBOUNDED_FRAME : No EOF in the frame or the frame started with eof
  414. */
  415. #define CAM_REQ_MGR_ISP_UNREPORTED_ERROR 0
  416. #define CAM_REQ_MGR_LINK_STALLED_ERROR BIT(0)
  417. #define CAM_REQ_MGR_CSID_FATAL_ERROR BIT(1)
  418. #define CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR BIT(2)
  419. #define CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR BIT(3)
  420. #define CAM_REQ_MGR_CSID_LANE_FIFO_OVERFLOW_ERROR BIT(4)
  421. #define CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH BIT(5)
  422. #define CAM_REQ_MGR_CSID_RX_PKT_HDR_CORRUPTION BIT(6)
  423. #define CAM_REQ_MGR_CSID_MISSING_PKT_HDR_DATA BIT(7)
  424. #define CAM_REQ_MGR_CSID_ERR_ON_SENSOR_SWITCHING BIT(8)
  425. #define CAM_REQ_MGR_CSID_UNBOUNDED_FRAME BIT(9)
  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 */