cam_isp_context.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CAM_ISP_CONTEXT_H_
  7. #define _CAM_ISP_CONTEXT_H_
  8. #include <linux/spinlock_types.h>
  9. #include <media/cam_isp.h>
  10. #include <media/cam_defs.h>
  11. #include <media/cam_tfe.h>
  12. #include "cam_context.h"
  13. #include "cam_isp_hw_mgr_intf.h"
  14. #include "cam_req_mgr_workq.h"
  15. #define CAM_IFE_QTIMER_MUL_FACTOR 10000
  16. #define CAM_IFE_QTIMER_DIV_FACTOR 192
  17. /*
  18. * Maximum hw resource - This number is based on the maximum
  19. * output port resource. The current maximum resource number
  20. * is 24.
  21. */
  22. #define CAM_ISP_CTX_RES_MAX 24
  23. /* max requests per ctx for isp */
  24. #define CAM_ISP_CTX_REQ_MAX 8
  25. /*
  26. * Maximum entries in state monitoring array for error logging
  27. */
  28. #define CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES 84
  29. /*
  30. * Threshold response time in us beyond which a request is not expected
  31. * to be with IFE hw
  32. */
  33. #define CAM_ISP_CTX_RESPONSE_TIME_THRESHOLD 100000
  34. /* Number of words for dumping isp context */
  35. #define CAM_ISP_CTX_DUMP_NUM_WORDS 5
  36. /* Number of words for dumping isp context events*/
  37. #define CAM_ISP_CTX_DUMP_EVENT_NUM_WORDS 3
  38. /* Number of words for dumping request info*/
  39. #define CAM_ISP_CTX_DUMP_REQUEST_NUM_WORDS 2
  40. /* Maximum entries in event record */
  41. #define CAM_ISP_CTX_EVENT_RECORD_MAX_ENTRIES 8
  42. /* Maximum length of tag while dumping */
  43. #define CAM_ISP_CONTEXT_DUMP_TAG_MAX_LEN 128
  44. /* AEB error count threshold */
  45. #define CAM_ISP_CONTEXT_AEB_ERROR_CNT_MAX 6
  46. /* Debug Buffer length*/
  47. #define CAM_ISP_CONTEXT_DBG_BUF_LEN 300
  48. /* Maximum entries in frame record */
  49. #define CAM_ISP_CTX_MAX_FRAME_RECORDS 5
  50. /*
  51. * Congestion count threshold
  52. */
  53. #define CAM_ISP_CONTEXT_CONGESTION_CNT_MAX 3
  54. /* forward declaration */
  55. struct cam_isp_context;
  56. /* cam isp context irq handling function type */
  57. typedef int (*cam_isp_hw_event_cb_func)(struct cam_isp_context *ctx_isp,
  58. void *evt_data);
  59. /**
  60. * enum cam_isp_ctx_activated_substate - sub states for activated
  61. *
  62. */
  63. enum cam_isp_ctx_activated_substate {
  64. CAM_ISP_CTX_ACTIVATED_SOF,
  65. CAM_ISP_CTX_ACTIVATED_APPLIED,
  66. CAM_ISP_CTX_ACTIVATED_EPOCH,
  67. CAM_ISP_CTX_ACTIVATED_BUBBLE,
  68. CAM_ISP_CTX_ACTIVATED_BUBBLE_APPLIED,
  69. CAM_ISP_CTX_ACTIVATED_HW_ERROR,
  70. CAM_ISP_CTX_ACTIVATED_HALT,
  71. CAM_ISP_CTX_ACTIVATED_MAX,
  72. };
  73. /**
  74. * enum cam_isp_ctx_event_type - events for a request
  75. *
  76. */
  77. enum cam_isp_ctx_event {
  78. CAM_ISP_CTX_EVENT_SUBMIT,
  79. CAM_ISP_CTX_EVENT_APPLY,
  80. CAM_ISP_CTX_EVENT_EPOCH,
  81. CAM_ISP_CTX_EVENT_RUP,
  82. CAM_ISP_CTX_EVENT_BUFDONE,
  83. CAM_ISP_CTX_EVENT_MAX
  84. };
  85. /**
  86. * enum cam_isp_state_change_trigger - Different types of ISP events
  87. *
  88. */
  89. enum cam_isp_state_change_trigger {
  90. CAM_ISP_STATE_CHANGE_TRIGGER_ERROR,
  91. CAM_ISP_STATE_CHANGE_TRIGGER_APPLIED,
  92. CAM_ISP_STATE_CHANGE_TRIGGER_REG_UPDATE,
  93. CAM_ISP_STATE_CHANGE_TRIGGER_SOF,
  94. CAM_ISP_STATE_CHANGE_TRIGGER_EPOCH,
  95. CAM_ISP_STATE_CHANGE_TRIGGER_DONE,
  96. CAM_ISP_STATE_CHANGE_TRIGGER_EOF,
  97. CAM_ISP_STATE_CHANGE_TRIGGER_FLUSH,
  98. CAM_ISP_STATE_CHANGE_TRIGGER_SEC_EVT_SOF,
  99. CAM_ISP_STATE_CHANGE_TRIGGER_SEC_EVT_EPOCH,
  100. CAM_ISP_STATE_CHANGE_TRIGGER_FRAME_DROP,
  101. CAM_ISP_STATE_CHANGE_TRIGGER_CDM_DONE,
  102. CAM_ISP_STATE_CHANGE_TRIGGER_MAX
  103. };
  104. #define CAM_ISP_CTX_DISABLE_RECOVERY_AEB BIT(0)
  105. #define CAM_ISP_CTX_DISABLE_RECOVERY_BUS_OVERFLOW BIT(1)
  106. #define CAM_ISP_CTX_DISABLE_RECOVERY_BUBBLE BIT(2)
  107. /**
  108. * struct cam_isp_ctx_debug - Contains debug parameters
  109. *
  110. * @dentry: Debugfs entry
  111. * @enable_state_monitor_dump: Enable isp state monitor dump
  112. * @enable_cdm_cmd_buff_dump: Enable CDM Command buffer dump
  113. * @disable_internal_recovery: Disable internal kernel recovery mask
  114. *
  115. */
  116. struct cam_isp_ctx_debug {
  117. struct dentry *dentry;
  118. uint32_t enable_state_monitor_dump;
  119. uint8_t enable_cdm_cmd_buff_dump;
  120. uint32_t disable_internal_recovery_mask;
  121. };
  122. /**
  123. * struct cam_isp_ctx_irq_ops - Function table for handling IRQ callbacks
  124. *
  125. * @irq_ops: Array of handle function pointers.
  126. *
  127. */
  128. struct cam_isp_ctx_irq_ops {
  129. cam_isp_hw_event_cb_func irq_ops[CAM_ISP_HW_EVENT_MAX];
  130. };
  131. /**
  132. * struct cam_isp_ctx_req - ISP context request object
  133. *
  134. * @base: Common request object ponter
  135. * @cfg: ISP hardware configuration array
  136. * @num_cfg: Number of ISP hardware configuration entries
  137. * @fence_map_out: Output fence mapping array
  138. * @num_fence_map_out: Number of the output fence map
  139. * @fence_map_in: Input fence mapping array
  140. * @num_fence_map_in: Number of input fence map
  141. * @num_acked: Count to track acked entried for output.
  142. * If count equals the number of fence out, it means
  143. * the request has been completed.
  144. * @num_deferred_acks: Number of buf_dones/acks that are deferred to
  145. * handle or signalled in special scenarios.
  146. * Increment this count instead of num_acked and
  147. * handle the events later where eventually
  148. * increment num_acked.
  149. * @deferred_fence_map_index Saves the indices of fence_map_out for which
  150. * handling of buf_done is deferred.
  151. * @bubble_report: Flag to track if bubble report is active on
  152. * current request
  153. * @hw_update_data: HW update data for this request
  154. * @reapply_type: Determines type of settings to be re-applied
  155. * @event_timestamp: Timestamp for different stage of request
  156. * @cdm_reset_before_apply: For bubble re-apply when buf done not coming set
  157. * to True
  158. *
  159. */
  160. struct cam_isp_ctx_req {
  161. struct cam_ctx_request *base;
  162. struct cam_hw_update_entry *cfg;
  163. uint32_t num_cfg;
  164. struct cam_hw_fence_map_entry *fence_map_out;
  165. uint32_t num_fence_map_out;
  166. struct cam_hw_fence_map_entry *fence_map_in;
  167. uint32_t num_fence_map_in;
  168. uint32_t num_acked;
  169. uint32_t num_deferred_acks;
  170. uint32_t deferred_fence_map_index[CAM_ISP_CTX_RES_MAX];
  171. int32_t bubble_report;
  172. struct cam_isp_prepare_hw_update_data hw_update_data;
  173. enum cam_hw_config_reapply_type reapply_type;
  174. ktime_t event_timestamp
  175. [CAM_ISP_CTX_EVENT_MAX];
  176. bool bubble_detected;
  177. bool cdm_reset_before_apply;
  178. };
  179. /**
  180. * struct cam_isp_context_state_monitor - ISP context state
  181. * monitoring for
  182. * debug purposes
  183. *
  184. * @curr_state: Current sub state that received req
  185. * @trigger: Event type of incoming req
  186. * @req_id: Request id
  187. * @frame_id: Frame id based on SOFs
  188. * @evt_time_stamp Current time stamp
  189. *
  190. */
  191. struct cam_isp_context_state_monitor {
  192. enum cam_isp_ctx_activated_substate curr_state;
  193. enum cam_isp_state_change_trigger trigger;
  194. uint64_t req_id;
  195. int64_t frame_id;
  196. struct timespec64 evt_time_stamp;
  197. };
  198. /**
  199. * struct cam_isp_context_req_id_info - ISP context request id
  200. * information for bufdone.
  201. *
  202. *@last_bufdone_req_id: Last bufdone request id
  203. *
  204. */
  205. struct cam_isp_context_req_id_info {
  206. int64_t last_bufdone_req_id;
  207. };
  208. /**
  209. *
  210. *
  211. * struct cam_isp_context_event_record - Information for last 20 Events
  212. * for a request; Submit, Apply, EPOCH, RUP, Buf done.
  213. *
  214. * @req_id: Last applied request id
  215. * @timestamp: Timestamp for the event
  216. *
  217. */
  218. struct cam_isp_context_event_record {
  219. uint64_t req_id;
  220. ktime_t timestamp;
  221. };
  222. /**
  223. *
  224. *
  225. * struct cam_isp_context_frame_timing_record - Frame timing events
  226. *
  227. * @sof_ts: SOF timestamp
  228. * @eof_ts: EOF ts
  229. * @epoch_ts: EPOCH ts
  230. * @secondary_sof_ts: Secondary SOF ts
  231. *
  232. */
  233. struct cam_isp_context_frame_timing_record {
  234. struct timespec64 sof_ts;
  235. struct timespec64 eof_ts;
  236. struct timespec64 epoch_ts;
  237. struct timespec64 secondary_sof_ts;
  238. };
  239. /**
  240. *
  241. *
  242. * struct cam_isp_context_debug_monitors - ISP context debug monitors
  243. *
  244. * @state_monitor_head: State machine monitor head
  245. * @state_monitor: State machine monitor info
  246. * @event_record_head: Request Event monitor head
  247. * @event_record: Request event monitor info
  248. * @frame_monitor_head: Frame timing monitor head
  249. * @frame_monitor: Frame timing event monitor
  250. *
  251. */
  252. struct cam_isp_context_debug_monitors {
  253. /* State machine monitoring */
  254. atomic64_t state_monitor_head;
  255. struct cam_isp_context_state_monitor state_monitor[
  256. CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES];
  257. /* Req event monitor */
  258. atomic64_t event_record_head[
  259. CAM_ISP_CTX_EVENT_MAX];
  260. struct cam_isp_context_event_record event_record[
  261. CAM_ISP_CTX_EVENT_MAX][CAM_ISP_CTX_EVENT_RECORD_MAX_ENTRIES];
  262. /* Frame timing monitor */
  263. atomic64_t frame_monitor_head;
  264. struct cam_isp_context_frame_timing_record frame_monitor[
  265. CAM_ISP_CTX_MAX_FRAME_RECORDS];
  266. };
  267. /**
  268. * struct cam_isp_context - ISP context object
  269. *
  270. * @base: Common context object pointer
  271. * @frame_id: Frame id tracking for the isp context
  272. * @frame_id_meta: Frame id read every epoch for the ctx
  273. * meta from the sensor
  274. * @substate_actiavted: Current substate for the activated state.
  275. * @process_bubble: Atomic variable to check if ctx is still
  276. * processing bubble.
  277. * @substate_machine: ISP substate machine for external interface
  278. * @substate_machine_irq: ISP substate machine for irq handling
  279. * @req_base: Common request object storage
  280. * @req_isp: ISP private request object storage
  281. * @hw_ctx: HW object returned by the acquire device command
  282. * @sof_timestamp_val: Captured time stamp value at sof hw event
  283. * @boot_timestamp: Boot time stamp for a given req_id
  284. * @active_req_cnt: Counter for the active request
  285. * @reported_req_id: Last reported request id
  286. * @subscribe_event: The irq event mask that CRM subscribes to, IFE
  287. * will invoke CRM cb at those event.
  288. * @last_applied_req_id: Last applied request id
  289. * @recovery_req_id: Req ID flagged for internal recovery
  290. * @last_sof_timestamp: SOF timestamp of the last frame
  291. * @bubble_frame_cnt: Count of the frame after bubble
  292. * @aeb_error_cnt: Count number of times a specific AEB error scenario is
  293. * enountered
  294. * @out_of_sync_cnt: Out of sync error count for AEB
  295. * @congestion_cnt: Count number of times congestion was encountered
  296. * consecutively
  297. * @state_monitor_head: Write index to the state monitoring array
  298. * @req_info Request id information about last buf done
  299. * @dbg_monitors: Debug monitors for ISP context
  300. * @rdi_only_context: Get context type information.
  301. * true, if context is rdi only context
  302. * @offline_context: Indicate whether context is for offline IFE
  303. * @vfps_aux_context: Indicate whether context is for VFPS aux link
  304. * @resume_hw_in_flushed: Indicate whether resume hw in flushed state in vfps case
  305. * @hw_acquired: Indicate whether HW resources are acquired
  306. * @init_received: Indicate whether init config packet is received
  307. * @split_acquire: Indicate whether a separate acquire is expected
  308. * @custom_enabled: Custom HW enabled for this ctx
  309. * @use_frame_header_ts: Use frame header for qtimer ts
  310. * @support_consumed_addr: Indicate whether HW has last consumed addr reg
  311. * @sof_dbg_irq_en: Indicates whether ISP context has enabled debug irqs
  312. * @apply_in_progress Whether request apply is in progress
  313. * @use_default_apply: Use default settings in case of frame skip
  314. * @init_timestamp: Timestamp at which this context is initialized
  315. * @isp_device_type: ISP device type
  316. * @rxd_epoch: Indicate whether epoch has been received. Used to
  317. * decide whether to apply request in offline ctx
  318. * @workq: Worker thread for offline ife
  319. * @trigger_id: ID provided by CRM for each ctx on the link
  320. * @last_bufdone_err_apply_req_id: last bufdone error apply request id
  321. * @v4l2_event_sub_ids contains individual bits representing subscribed v4l2 ids
  322. * @evt_inject_params: event injection parameters
  323. * @aeb_enabled: Indicate if stream is for AEB
  324. * @last_sof_jiffies: Record the jiffies of last sof
  325. * @last_applied_jiffies: Record the jiffiest of last applied req
  326. * @vfe_bus_comp_grp: Vfe bus comp group record
  327. * @sfe_bus_comp_grp: Sfe bus comp group record
  328. * @mswitch_default_apply_delay_max_cnt: Max mode switch delay among all devices connected
  329. * on the same link as this ISP context
  330. * @mswitch_default_apply_delay_ref_cnt: Ref cnt for this context to decide when to apply
  331. * mode switch settings
  332. * @handle_mswitch: Indicates if IFE needs to explicitly handle mode switch
  333. * on frame skip callback from request manager.
  334. * This is decided based on the max mode switch delay published
  335. * by other devices on the link as part of link setup
  336. * @mode_switch_en: Indicates if mode switch is enabled
  337. *
  338. */
  339. struct cam_isp_context {
  340. struct cam_context *base;
  341. uint64_t frame_id;
  342. uint32_t frame_id_meta;
  343. uint32_t substate_activated;
  344. atomic_t process_bubble;
  345. struct cam_ctx_ops *substate_machine;
  346. struct cam_isp_ctx_irq_ops *substate_machine_irq;
  347. struct cam_ctx_request req_base[CAM_ISP_CTX_REQ_MAX];
  348. struct cam_isp_ctx_req req_isp[CAM_ISP_CTX_REQ_MAX];
  349. void *hw_ctx;
  350. uint64_t sof_timestamp_val;
  351. uint64_t boot_timestamp;
  352. int32_t active_req_cnt;
  353. int64_t reported_req_id;
  354. uint64_t reported_frame_id;
  355. uint32_t subscribe_event;
  356. int64_t last_applied_req_id;
  357. uint64_t recovery_req_id;
  358. uint64_t last_sof_timestamp;
  359. uint32_t bubble_frame_cnt;
  360. uint32_t aeb_error_cnt;
  361. uint32_t out_of_sync_cnt;
  362. uint32_t congestion_cnt;
  363. atomic64_t state_monitor_head;
  364. struct cam_isp_context_state_monitor cam_isp_ctx_state_monitor[
  365. CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES];
  366. struct cam_isp_context_req_id_info req_info;
  367. struct cam_isp_context_debug_monitors dbg_monitors;
  368. bool rdi_only_context;
  369. bool offline_context;
  370. bool vfps_aux_context;
  371. bool resume_hw_in_flushed;
  372. bool hw_acquired;
  373. bool init_received;
  374. bool split_acquire;
  375. bool custom_enabled;
  376. bool use_frame_header_ts;
  377. bool support_consumed_addr;
  378. bool sof_dbg_irq_en;
  379. atomic_t apply_in_progress;
  380. atomic_t internal_recovery_set;
  381. bool use_default_apply;
  382. unsigned int init_timestamp;
  383. uint32_t isp_device_type;
  384. atomic_t rxd_epoch;
  385. struct cam_req_mgr_core_workq *workq;
  386. int32_t trigger_id;
  387. int64_t last_bufdone_err_apply_req_id;
  388. uint32_t v4l2_event_sub_ids;
  389. struct cam_hw_inject_evt_param evt_inject_params;
  390. bool aeb_enabled;
  391. uint64_t last_sof_jiffies;
  392. uint64_t last_applied_jiffies;
  393. struct cam_isp_context_comp_record *vfe_bus_comp_grp;
  394. struct cam_isp_context_comp_record *sfe_bus_comp_grp;
  395. int32_t mswitch_default_apply_delay_max_cnt;
  396. atomic_t mswitch_default_apply_delay_ref_cnt;
  397. bool handle_mswitch;
  398. bool mode_switch_en;
  399. };
  400. /**
  401. * struct cam_isp_context_dump_header - ISP context dump header
  402. * @tag: Tag name for the header
  403. * @word_size: Size of word
  404. * @size: Size of data
  405. *
  406. */
  407. struct cam_isp_context_dump_header {
  408. uint8_t tag[CAM_ISP_CONTEXT_DUMP_TAG_MAX_LEN];
  409. uint64_t size;
  410. uint32_t word_size;
  411. };
  412. /** * struct cam_isp_ctx_req_mini_dump - ISP mini dumprequest
  413. *
  414. * @map_out: Output fence mapping
  415. * @map_in: Input fence mapping
  416. * @io_cfg: IO buffer configuration
  417. * @reapply_type: Determines type of settings to be re-applied
  418. * @request_id: Request ID
  419. * @num_fence_map_out: Number of the output fence map
  420. * @num_fence_map_in: Number of input fence map
  421. * @num_io_cfg: Number of ISP hardware configuration entries
  422. * @num_acked: Count to track acked entried for output.
  423. * @num_deferred_acks: Number of buf_dones/acks that are deferred to
  424. * handle or signalled in special scenarios.
  425. * Increment this count instead of num_acked and
  426. * handle the events later where eventually
  427. * increment num_acked.
  428. * @bubble_report: Flag to track if bubble report is active on
  429. * current request
  430. * @bubble_detected: Flag to track if bubble is detected
  431. * @cdm_reset_before_apply: For bubble re-apply when buf done not coming set
  432. * to True
  433. *
  434. */
  435. struct cam_isp_ctx_req_mini_dump {
  436. struct cam_hw_fence_map_entry *map_out;
  437. struct cam_hw_fence_map_entry *map_in;
  438. struct cam_buf_io_cfg *io_cfg;
  439. enum cam_hw_config_reapply_type reapply_type;
  440. uint64_t request_id;
  441. uint8_t num_fence_map_in;
  442. uint8_t num_fence_map_out;
  443. uint8_t num_io_cfg;
  444. uint8_t num_acked;
  445. uint8_t num_deferred_acks;
  446. bool bubble_report;
  447. bool bubble_detected;
  448. bool cdm_reset_before_apply;
  449. };
  450. /**
  451. * struct cam_isp_ctx_mini_dump_info - Isp context mini dump data
  452. *
  453. * @active_list: Active Req list
  454. * @pending_list: Pending req list
  455. * @wait_list: Wait Req List
  456. * @event_record: Event record
  457. * @sof_timestamp_val: Captured time stamp value at sof hw event
  458. * @boot_timestamp: Boot time stamp for a given req_id
  459. * @last_sof_timestamp: SOF timestamp of the last frame
  460. * @init_timestamp: Timestamp at which this context is initialized
  461. * @frame_id: Frame id read every epoch for the ctx
  462. * @reported_req_id: Last reported request id
  463. * @last_applied_req_id: Last applied request id
  464. * @frame_id_meta: Frame id for meta
  465. * @ctx_id: Context id
  466. * @subscribe_event: The irq event mask that CRM subscribes to, IFE
  467. * will invoke CRM cb at those event.
  468. * @bubble_frame_cnt: Count of the frame after bubble
  469. * @isp_device_type: ISP device type
  470. * @active_req_cnt: Counter for the active request
  471. * @trigger_id: ID provided by CRM for each ctx on the link
  472. * @substate_actiavted: Current substate for the activated state.
  473. * @rxd_epoch: Indicate whether epoch has been received. Used to
  474. * decide whether to apply request in offline ctx
  475. * @process_bubble: Atomic variable to check if ctx is still
  476. * processing bubble.
  477. * @apply_in_progress Whether request apply is in progress
  478. * @rdi_only_context: Get context type information.
  479. * true, if context is rdi only context
  480. * @offline_context: Indicate whether context is for offline IFE
  481. * @hw_acquired: Indicate whether HW resources are acquired
  482. * @init_received: Indicate whether init config packet is received
  483. * meta from the sensor
  484. * @split_acquire: Indicate whether a separate acquire is expected
  485. * @custom_enabled: Custom HW enabled for this ctx
  486. * @use_frame_header_ts: Use frame header for qtimer ts
  487. * @support_consumed_addr: Indicate whether HW has last consumed addr reg
  488. * @use_default_apply: Use default settings in case of frame skip
  489. *
  490. */
  491. struct cam_isp_ctx_mini_dump_info {
  492. struct cam_isp_ctx_req_mini_dump *active_list;
  493. struct cam_isp_ctx_req_mini_dump *pending_list;
  494. struct cam_isp_ctx_req_mini_dump *wait_list;
  495. struct cam_isp_context_event_record event_record[
  496. CAM_ISP_CTX_EVENT_MAX][CAM_ISP_CTX_EVENT_RECORD_MAX_ENTRIES];
  497. uint64_t sof_timestamp_val;
  498. uint64_t boot_timestamp;
  499. uint64_t last_sof_timestamp;
  500. uint64_t init_timestamp;
  501. int64_t frame_id;
  502. int64_t reported_req_id;
  503. int64_t last_applied_req_id;
  504. int64_t last_bufdone_err_apply_req_id;
  505. uint32_t frame_id_meta;
  506. uint8_t ctx_id;
  507. uint8_t subscribe_event;
  508. uint8_t bubble_frame_cnt;
  509. uint8_t isp_device_type;
  510. uint8_t active_req_cnt;
  511. uint8_t trigger_id;
  512. uint8_t substate_activated;
  513. uint8_t rxd_epoch;
  514. uint8_t process_bubble;
  515. uint8_t active_cnt;
  516. uint8_t pending_cnt;
  517. uint8_t wait_cnt;
  518. bool apply_in_progress;
  519. bool rdi_only_context;
  520. bool offline_context;
  521. bool hw_acquired;
  522. bool init_received;
  523. bool split_acquire;
  524. bool custom_enabled;
  525. bool use_frame_header_ts;
  526. bool support_consumed_addr;
  527. bool use_default_apply;
  528. };
  529. /**
  530. * cam_isp_context_init()
  531. *
  532. * @brief: Initialization function for the ISP context
  533. *
  534. * @ctx: ISP context obj to be initialized
  535. * @bridge_ops: Bridge call back funciton
  536. * @hw_intf: ISP hw manager interface
  537. * @ctx_id: ID for this context
  538. * @isp_device_type Isp device type
  539. * @img_iommu_hdl IOMMU HDL for image buffers
  540. *
  541. */
  542. int cam_isp_context_init(struct cam_isp_context *ctx,
  543. struct cam_context *ctx_base,
  544. struct cam_req_mgr_kmd_ops *bridge_ops,
  545. struct cam_hw_mgr_intf *hw_intf,
  546. uint32_t ctx_id,
  547. uint32_t isp_device_type,
  548. int img_iommu_hdl);
  549. /**
  550. * cam_isp_context_deinit()
  551. *
  552. * @brief: Deinitialize function for the ISP context
  553. *
  554. * @ctx: ISP context obj to be deinitialized
  555. *
  556. */
  557. int cam_isp_context_deinit(struct cam_isp_context *ctx);
  558. #endif /* __CAM_ISP_CONTEXT_H__ */