cam_cdm.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _CAM_CDM_H_
  6. #define _CAM_CDM_H_
  7. #include <linux/module.h>
  8. #include <linux/of_platform.h>
  9. #include <linux/random.h>
  10. #include <linux/spinlock_types.h>
  11. #include <linux/mutex.h>
  12. #include <linux/workqueue.h>
  13. #include <linux/bug.h>
  14. #include "cam_cdm_intf_api.h"
  15. #include "cam_soc_util.h"
  16. #include "cam_cpas_api.h"
  17. #include "cam_hw_intf.h"
  18. #include "cam_hw.h"
  19. #include "cam_debug_util.h"
  20. #define CAM_MAX_SW_CDM_VERSION_SUPPORTED 1
  21. #define CAM_SW_CDM_INDEX 0
  22. #define CAM_CDM_INFLIGHT_WORKS 5
  23. #define CAM_CDM_HW_RESET_TIMEOUT 300
  24. /*
  25. * Macros to get prepare and get information
  26. * from client CDM handles.
  27. */
  28. #define CAM_CDM_HW_ID_MASK 0xF
  29. #define CAM_CDM_HW_ID_SHIFT 0x10
  30. #define CAM_CDM_CLIENTS_ID_MASK 0xFF
  31. #define CAM_CDM_BL_FIFO_ID_MASK 0xF
  32. #define CAM_CDM_BL_FIFO_ID_SHIFT 0x8
  33. #define CAM_CDM_GET_HW_IDX(x) (((x) >> CAM_CDM_HW_ID_SHIFT) & \
  34. CAM_CDM_HW_ID_MASK)
  35. #define CAM_CDM_GET_BLFIFO_IDX(x) (((x) >> CAM_CDM_BL_FIFO_ID_SHIFT) & \
  36. CAM_CDM_BL_FIFO_ID_MASK)
  37. #define CAM_CDM_CREATE_CLIENT_HANDLE(hw_idx, priority, client_idx) \
  38. ((((hw_idx) & CAM_CDM_HW_ID_MASK) << CAM_CDM_HW_ID_SHIFT) | \
  39. (((priority) & CAM_CDM_BL_FIFO_ID_MASK) << CAM_CDM_BL_FIFO_ID_SHIFT)| \
  40. ((client_idx) & CAM_CDM_CLIENTS_ID_MASK))
  41. #define CAM_CDM_GET_CLIENT_IDX(x) ((x) & CAM_CDM_CLIENTS_ID_MASK)
  42. #define CAM_PER_CDM_MAX_REGISTERED_CLIENTS (CAM_CDM_CLIENTS_ID_MASK + 1)
  43. #define CAM_CDM_INTF_MGR_MAX_SUPPORTED_CDM (CAM_CDM_HW_ID_MASK + 1)
  44. /* Number of FIFO supported on CDM */
  45. #define CAM_CDM_NUM_BL_FIFO 0x4
  46. /* Max number of register set for different CDM */
  47. #define CAM_CDM_BL_FIFO_REG_NUM 0x4
  48. #define CAM_CDM_BL_FIFO_IRQ_REG_NUM 0x4
  49. #define CAM_CDM_BL_FIFO_PENDING_REQ_REG_NUM 0x2
  50. #define CAM_CDM_SCRATCH_REG_NUM 0xc
  51. #define CAM_CDM_COMP_WAIT_STATUS_REG_NUM 0x2
  52. #define CAM_CDM_PERF_MON_REG_NUM 0x2
  53. /* BL_FIFO configurations*/
  54. #define CAM_CDM_BL_FIFO_LENGTH_MAX_DEFAULT 0x40
  55. #define CAM_CDM_BL_FIFO_LENGTH_CFG_SHIFT 0x10
  56. #define CAM_CDM_BL_FIFO_REQ_SIZE_MAX 0x00
  57. #define CAM_CDM_BL_FIFO_REQ_SIZE_MAX_DIV2 0x01
  58. #define CAM_CDM_BL_FIFO_REQ_SIZE_MAX_DIV4 0x10
  59. #define CAM_CDM_BL_FIFO_REQ_SIZE_MAX_DIV8 0x11
  60. /* CDM core status bitmap */
  61. #define CAM_CDM_HW_INIT_STATUS 0x0
  62. #define CAM_CDM_FIFO_0_BLDONE_STATUS 0x0
  63. #define CAM_CDM_FIFO_1_BLDONE_STATUS 0x1
  64. #define CAM_CDM_FIFO_2_BLDONE_STATUS 0x2
  65. #define CAM_CDM_FIFO_3_BLDONE_STATUS 0x3
  66. #define CAM_CDM_RESET_HW_STATUS 0x4
  67. #define CAM_CDM_ERROR_HW_STATUS 0x5
  68. #define CAM_CDM_FLUSH_HW_STATUS 0x6
  69. /* Curent BL command masks and shifts */
  70. #define CAM_CDM_CURRENT_BL_LEN 0xFFFFF
  71. #define CAM_CDM_CURRENT_BL_ARB 0x100000
  72. #define CAM_CDM_CURRENT_BL_FIFO 0xC00000
  73. #define CAM_CDM_CURRENT_BL_TAG 0xFF000000
  74. #define CAM_CDM_CURRENT_BL_ARB_SHIFT 0x14
  75. #define CAM_CDM_CURRENT_BL_FIFO_SHIFT 0x16
  76. #define CAM_CDM_CURRENT_BL_TAG_SHIFT 0x18
  77. /* IRQ bit-masks */
  78. #define CAM_CDM_IRQ_STATUS_RST_DONE_MASK 0x1
  79. #define CAM_CDM_IRQ_STATUS_INLINE_IRQ_MASK 0x2
  80. #define CAM_CDM_IRQ_STATUS_BL_DONE_MASK 0x4
  81. #define CAM_CDM_IRQ_STATUS_ERROR_INV_CMD_MASK 0x10000
  82. #define CAM_CDM_IRQ_STATUS_ERROR_OVER_FLOW_MASK 0x20000
  83. #define CAM_CDM_IRQ_STATUS_ERROR_AHB_BUS_MASK 0x40000
  84. #define CAM_CDM_IRQ_STATUS_ERRORS \
  85. (CAM_CDM_IRQ_STATUS_ERROR_INV_CMD_MASK | \
  86. CAM_CDM_IRQ_STATUS_ERROR_OVER_FLOW_MASK | \
  87. CAM_CDM_IRQ_STATUS_ERROR_AHB_BUS_MASK)
  88. /* Structure to store hw version info */
  89. struct cam_version_reg {
  90. uint32_t hw_version;
  91. };
  92. /**
  93. * struct cam_cdm_irq_regs - CDM IRQ registers
  94. *
  95. * @irq_mask: register offset for irq_mask
  96. * @irq_clear: register offset for irq_clear
  97. * @irq_clear_cmd: register offset to initiate irq clear
  98. * @irq_set: register offset to set irq
  99. * @irq_set_cmd: register offset to issue set_irq from irq_set
  100. * @irq_status: register offset to look which irq is received
  101. */
  102. struct cam_cdm_irq_regs {
  103. uint32_t irq_mask;
  104. uint32_t irq_clear;
  105. uint32_t irq_clear_cmd;
  106. uint32_t irq_set;
  107. uint32_t irq_set_cmd;
  108. uint32_t irq_status;
  109. };
  110. /**
  111. * struct cam_cdm_bl_fifo_regs - BL_FIFO registers
  112. *
  113. * @bl_fifo_base: register offset to write bl_cmd base address
  114. * @bl_fifo_len: register offset to write bl_cmd length
  115. * @bl_fifo_store: register offset to commit the BL cmd
  116. * @bl_fifo_cfg: register offset to config BL_FIFO depth, etc.
  117. */
  118. struct cam_cdm_bl_fifo_regs {
  119. uint32_t bl_fifo_base;
  120. uint32_t bl_fifo_len;
  121. uint32_t bl_fifo_store;
  122. uint32_t bl_fifo_cfg;
  123. };
  124. /**
  125. * struct cam_cdm_bl_pending_req_reg_params - BL_FIFO pending registers
  126. *
  127. * @rb_offset: register offset pending bl request in BL_FIFO
  128. * @rb_mask: mask to get number of pending BLs in BL_FIFO
  129. * @rb_num_fifo: number of BL_FIFO's information in the register
  130. * @rb_next_fifo_shift: shift to get next fifo's pending BLs.
  131. */
  132. struct cam_cdm_bl_pending_req_reg_params {
  133. uint32_t rb_offset;
  134. uint32_t rb_mask;
  135. uint32_t rb_num_fifo;
  136. uint32_t rb_next_fifo_shift;
  137. };
  138. /**
  139. * struct cam_cdm_scratch_reg - scratch register
  140. *
  141. * @scratch_reg: offset of scratch register
  142. */
  143. struct cam_cdm_scratch_reg {
  144. uint32_t scratch_reg;
  145. };
  146. /* struct cam_cdm_perf_mon_regs - perf_mon registers */
  147. struct cam_cdm_perf_mon_regs {
  148. uint32_t perf_mon_ctrl;
  149. uint32_t perf_mon_0;
  150. uint32_t perf_mon_1;
  151. uint32_t perf_mon_2;
  152. };
  153. /**
  154. * struct cam_cdm_perf_mon_regs - perf mon counter's registers
  155. *
  156. * @count_cfg_0: register offset to configure perf measures
  157. * @always_count_val: register offset for always count value
  158. * @busy_count_val: register offset to get busy count
  159. * @stall_axi_count_val: register offset to get axi stall counts
  160. * @count_status: register offset to know if count status finished
  161. * for stall, busy and always.
  162. */
  163. struct cam_cdm_perf_regs {
  164. uint32_t count_cfg_0;
  165. uint32_t always_count_val;
  166. uint32_t busy_count_val;
  167. uint32_t stall_axi_count_val;
  168. uint32_t count_status;
  169. };
  170. /**
  171. * struct cam_cdm_icl_data_regs - CDM icl data registers
  172. *
  173. * @icl_last_data_0: register offset to log last known good command
  174. * @icl_last_data_1: register offset to log last known good command 1
  175. * @icl_last_data_2: register offset to log last known good command 2
  176. * @icl_inv_data: register offset to log CDM cmd that triggered
  177. * invalid command.
  178. */
  179. struct cam_cdm_icl_data_regs {
  180. uint32_t icl_last_data_0;
  181. uint32_t icl_last_data_1;
  182. uint32_t icl_last_data_2;
  183. uint32_t icl_inv_data;
  184. };
  185. /**
  186. * struct cam_cdm_icl_misc_regs - CDM icl misc registers
  187. *
  188. * @icl_inv_bl_addr: register offset to give address of bl_cmd that
  189. * gave invalid command
  190. * @icl_status: register offset for context that gave good BL
  191. * command and invalid command.
  192. */
  193. struct cam_cdm_icl_misc_regs {
  194. uint32_t icl_inv_bl_addr;
  195. uint32_t icl_status;
  196. };
  197. /**
  198. * struct cam_cdm_icl_regs - CDM icl registers
  199. *
  200. * @data_regs: structure with registers of all cdm good and invalid
  201. * BL command information.
  202. * @misc_regs: structure with registers for invalid command address
  203. * and context
  204. */
  205. struct cam_cdm_icl_regs {
  206. struct cam_cdm_icl_data_regs *data_regs;
  207. struct cam_cdm_icl_misc_regs *misc_regs;
  208. };
  209. /**
  210. * struct cam_cdm_comp_wait_status - BL_FIFO comp_event status register
  211. *
  212. * @comp_wait_status: register offset to give information on whether the
  213. * CDM is waiting for an event from another module
  214. */
  215. struct cam_cdm_comp_wait_status {
  216. uint32_t comp_wait_status;
  217. };
  218. /**
  219. * struct cam_cdm_common_reg_data - structure for register data
  220. *
  221. * @num_bl_fifo: number of FIFO are there in CDM
  222. * @num_bl_fifo_irq: number of FIFO irqs in CDM
  223. * @num_bl_pending_req_reg: number of pending_requests register in CDM
  224. * @num_scratch_reg: number of scratch registers in CDM
  225. */
  226. struct cam_cdm_common_reg_data {
  227. uint32_t num_bl_fifo;
  228. uint32_t num_bl_fifo_irq;
  229. uint32_t num_bl_pending_req_reg;
  230. uint32_t num_scratch_reg;
  231. };
  232. /**
  233. * struct cam_cdm_common_regs - common structure to get common registers
  234. * of CDM
  235. *
  236. * @cdm_hw_version: offset to read cdm_hw_version
  237. * @cam_version: offset to read the camera Titan architecture version
  238. * @rst_cmd: offset to reset the CDM
  239. * @cgc_cfg: offset to configure CDM CGC logic
  240. * @core_cfg: offset to configure CDM core with ARB_SEL, implicit
  241. * wait, etc.
  242. * @core_en: offset to pause/enable CDM
  243. * @fe_cfg: offset to configure CDM fetch engine
  244. * @bl_fifo_rb: offset to set BL_FIFO read back
  245. * @bl_fifo_base_rb: offset to read back base address on offset set by
  246. * bl_fifo_rb
  247. * @bl_fifo_len_rb: offset to read back base len and tag on offset set by
  248. * bl_fifo_rb
  249. * @usr_data: offset to read user data from GEN_IRQ commands
  250. * @wait_status: offset to read status for last WAIT command
  251. * @last_ahb_addr: offset to read back last AHB address generated by CDM
  252. * @last_ahb_data: offset to read back last AHB data generated by CDM
  253. * @core_debug: offset to configure CDM debug bus and debug features
  254. * @last_ahb_err_addr: offset to read back last AHB Error address generated
  255. * by CDM
  256. * @last_ahb_err_data: offset to read back last AHB Error data generated
  257. * by CDM
  258. * @current_bl_base: offset to read back current command buffer BASE address
  259. * value out of BL_FIFO
  260. * @current_bl_len: offset to read back current command buffer len, TAG,
  261. * context ID ARB value out of BL_FIFO
  262. * @current_used_ahb_base: offset to read back current base address used by
  263. * CDM to access camera register
  264. * @debug_status: offset to read back current CDM status
  265. * @bus_misr_cfg0: offset to enable bus MISR and configure sampling mode
  266. * @bus_misr_cfg1: offset to select from one of the six MISR's for reading
  267. * signature value
  268. * @bus_misr_rd_val: offset to read MISR signature
  269. * @pending_req: registers to read pending request in FIFO
  270. * @comp_wait: registers to read comp_event CDM is waiting for
  271. * @perf_mon: registers to read perf_mon information
  272. * @scratch: registers to read scratch register value
  273. * @perf_reg: registers to read performance counters value
  274. * @icl_reg: registers to read information related to good
  275. * and invalid commands in FIFO
  276. * @spare: spare register
  277. *
  278. */
  279. struct cam_cdm_common_regs {
  280. uint32_t cdm_hw_version;
  281. const struct cam_version_reg *cam_version;
  282. uint32_t rst_cmd;
  283. uint32_t cgc_cfg;
  284. uint32_t core_cfg;
  285. uint32_t core_en;
  286. uint32_t fe_cfg;
  287. uint32_t bl_fifo_rb;
  288. uint32_t bl_fifo_base_rb;
  289. uint32_t bl_fifo_len_rb;
  290. uint32_t usr_data;
  291. uint32_t wait_status;
  292. uint32_t last_ahb_addr;
  293. uint32_t last_ahb_data;
  294. uint32_t core_debug;
  295. uint32_t last_ahb_err_addr;
  296. uint32_t last_ahb_err_data;
  297. uint32_t current_bl_base;
  298. uint32_t current_bl_len;
  299. uint32_t current_used_ahb_base;
  300. uint32_t debug_status;
  301. uint32_t bus_misr_cfg0;
  302. uint32_t bus_misr_cfg1;
  303. uint32_t bus_misr_rd_val;
  304. const struct cam_cdm_bl_pending_req_reg_params
  305. *pending_req[CAM_CDM_BL_FIFO_PENDING_REQ_REG_NUM];
  306. const struct cam_cdm_comp_wait_status
  307. *comp_wait[CAM_CDM_COMP_WAIT_STATUS_REG_NUM];
  308. const struct cam_cdm_perf_mon_regs
  309. *perf_mon[CAM_CDM_PERF_MON_REG_NUM];
  310. const struct cam_cdm_scratch_reg
  311. *scratch[CAM_CDM_SCRATCH_REG_NUM];
  312. const struct cam_cdm_perf_regs *perf_reg;
  313. const struct cam_cdm_icl_regs *icl_reg;
  314. uint32_t spare;
  315. };
  316. /**
  317. * struct cam_cdm_hw_reg_offset - BL_FIFO comp_event status register
  318. *
  319. * @cmn_reg: pointer to structure to get common registers of a CDM
  320. * @bl_fifo_reg: pointer to structure to get BL_FIFO registers of a CDM
  321. * @irq_reg: pointer to structure to get IRQ registers of a CDM
  322. * @reg_data: pointer to structure to reg_data related to CDM
  323. * registers
  324. */
  325. struct cam_cdm_hw_reg_offset {
  326. const struct cam_cdm_common_regs *cmn_reg;
  327. const struct cam_cdm_bl_fifo_regs *bl_fifo_reg[CAM_CDM_BL_FIFO_REG_NUM];
  328. const struct cam_cdm_irq_regs *irq_reg[CAM_CDM_BL_FIFO_IRQ_REG_NUM];
  329. const struct cam_cdm_common_reg_data *reg_data;
  330. };
  331. /* enum cam_cdm_hw_process_intf_cmd - interface commands.*/
  332. enum cam_cdm_hw_process_intf_cmd {
  333. CAM_CDM_HW_INTF_CMD_ACQUIRE,
  334. CAM_CDM_HW_INTF_CMD_RELEASE,
  335. CAM_CDM_HW_INTF_CMD_SUBMIT_BL,
  336. CAM_CDM_HW_INTF_CMD_RESET_HW,
  337. CAM_CDM_HW_INTF_CMD_FLUSH_HW,
  338. CAM_CDM_HW_INTF_CMD_HANDLE_ERROR,
  339. CAM_CDM_HW_INTF_CMD_INVALID,
  340. };
  341. /* enum cam_cdm_flags - Bit fields for CDM flags used */
  342. enum cam_cdm_flags {
  343. CAM_CDM_FLAG_SHARED_CDM,
  344. CAM_CDM_FLAG_PRIVATE_CDM,
  345. };
  346. /* enum cam_cdm_type - Enum for possible CAM CDM types */
  347. enum cam_cdm_type {
  348. CAM_VIRTUAL_CDM,
  349. CAM_HW_CDM,
  350. };
  351. /* enum cam_cdm_mem_base_index - Enum for possible CAM CDM types */
  352. enum cam_cdm_mem_base_index {
  353. CAM_HW_CDM_BASE_INDEX,
  354. CAM_HW_CDM_MAX_INDEX = CAM_SOC_MAX_BLOCK,
  355. };
  356. /* enum cam_cdm_bl_cb_type - Enum for possible CAM CDM cb request types */
  357. enum cam_cdm_bl_cb_type {
  358. CAM_HW_CDM_BL_CB_CLIENT = 1,
  359. CAM_HW_CDM_BL_CB_INTERNAL,
  360. };
  361. /* enum cam_cdm_arbitration - Enum type of arbitration */
  362. enum cam_cdm_arbitration {
  363. CAM_CDM_ARBITRATION_NONE,
  364. CAM_CDM_ARBITRATION_ROUND_ROBIN,
  365. CAM_CDM_ARBITRATION_PRIORITY_BASED,
  366. CAM_CDM_ARBITRATION_MAX,
  367. };
  368. enum cam_cdm_hw_version {
  369. CAM_CDM_VERSION = 0,
  370. CAM_CDM_VERSION_1_0 = 0x10000000,
  371. CAM_CDM_VERSION_1_1 = 0x10010000,
  372. CAM_CDM_VERSION_1_2 = 0x10020000,
  373. CAM_CDM_VERSION_2_0 = 0x20000000,
  374. CAM_CDM_VERSION_MAX,
  375. };
  376. /* struct cam_cdm_client - struct for cdm clients data.*/
  377. struct cam_cdm_client {
  378. struct cam_cdm_acquire_data data;
  379. void __iomem *changebase_addr;
  380. uint32_t stream_on;
  381. uint32_t refcount;
  382. struct mutex lock;
  383. uint32_t handle;
  384. };
  385. /* struct cam_cdm_work_payload - struct for cdm work payload data.*/
  386. struct cam_cdm_work_payload {
  387. struct cam_hw_info *hw;
  388. uint32_t irq_status;
  389. uint32_t irq_data;
  390. int fifo_idx;
  391. struct work_struct work;
  392. };
  393. /* struct cam_cdm_bl_cb_request_entry - callback entry for work to process.*/
  394. struct cam_cdm_bl_cb_request_entry {
  395. uint8_t bl_tag;
  396. enum cam_cdm_bl_cb_type request_type;
  397. uint32_t client_hdl;
  398. void *userdata;
  399. uint32_t cookie;
  400. struct list_head entry;
  401. };
  402. /* struct cam_cdm_hw_intf_cmd_submit_bl - cdm interface submit command.*/
  403. struct cam_cdm_hw_intf_cmd_submit_bl {
  404. uint32_t handle;
  405. struct cam_cdm_bl_request *data;
  406. };
  407. /* struct cam_cdm_hw_mem - CDM hw memory struct */
  408. struct cam_cdm_hw_mem {
  409. int32_t handle;
  410. uint32_t vaddr;
  411. uintptr_t kmdvaddr;
  412. size_t size;
  413. };
  414. /* struct cam_cdm_bl_fifo - CDM hw memory struct */
  415. struct cam_cdm_bl_fifo {
  416. struct completion bl_complete;
  417. struct workqueue_struct *work_queue;
  418. struct list_head bl_request_list;
  419. struct mutex fifo_lock;
  420. uint8_t bl_tag;
  421. uint32_t bl_depth;
  422. };
  423. /**
  424. * struct cam_cdm - CDM hw device struct
  425. *
  426. * @index: index of CDM hardware
  427. * @name: cdm_name
  428. * @id: enum for possible CDM hardwares
  429. * @flags: enum to tell if CDM is private of shared
  430. * @reset_complete: completion event to make CDM wait for reset
  431. * @work_queue: workqueue to schedule work for virtual CDM
  432. * @bl_request_list: bl_request list for submitted commands in
  433. * virtual CDM
  434. * @version: CDM version with major, minor, incr and reserved
  435. * @hw_version: CDM version as read from the cdm_version register
  436. * @hw_family_version: version of hw family the CDM belongs to
  437. * @iommu_hdl: CDM iommu handle
  438. * @offsets: pointer to structure of CDM registers
  439. * @ops: CDM ops for generating cdm commands
  440. * @clients: CDM clients array currently active on CDM
  441. * @bl_fifo: structure with per fifo related attributes
  442. * @cdm_status: bitfield with bits assigned for different cdm status
  443. * @bl_tag: slot value at which the next bl cmd will be written
  444. * in case of virtual CDM
  445. * @gen_irq: memory region in which gen_irq command will be written
  446. * @cpas_handle: handle for cpas driver
  447. * @arbitration: type of arbitration to be used for the CDM
  448. */
  449. struct cam_cdm {
  450. uint32_t index;
  451. char name[128];
  452. enum cam_cdm_id id;
  453. enum cam_cdm_flags flags;
  454. struct completion reset_complete;
  455. struct workqueue_struct *work_queue;
  456. struct list_head bl_request_list;
  457. struct cam_hw_version version;
  458. uint32_t hw_version;
  459. uint32_t hw_family_version;
  460. struct cam_iommu_handle iommu_hdl;
  461. struct cam_cdm_hw_reg_offset *offsets;
  462. struct cam_cdm_utils_ops *ops;
  463. struct cam_cdm_client *clients[CAM_PER_CDM_MAX_REGISTERED_CLIENTS];
  464. struct cam_cdm_bl_fifo bl_fifo[CAM_CDM_BL_FIFO_MAX];
  465. unsigned long cdm_status;
  466. uint8_t bl_tag;
  467. struct cam_cdm_hw_mem gen_irq[CAM_CDM_BL_FIFO_MAX];
  468. uint32_t cpas_handle;
  469. enum cam_cdm_arbitration arbitration;
  470. };
  471. /* struct cam_cdm_private_dt_data - CDM hw custom dt data */
  472. struct cam_cdm_private_dt_data {
  473. bool dt_cdm_shared;
  474. uint32_t dt_num_supported_clients;
  475. const char *dt_cdm_client_name[CAM_PER_CDM_MAX_REGISTERED_CLIENTS];
  476. bool config_fifo;
  477. uint32_t fifo_depth[CAM_CDM_BL_FIFO_MAX];
  478. };
  479. /* struct cam_cdm_intf_devices - CDM mgr interface devices */
  480. struct cam_cdm_intf_devices {
  481. struct mutex lock;
  482. uint32_t refcount;
  483. struct cam_hw_intf *device;
  484. struct cam_cdm_private_dt_data *data;
  485. };
  486. /* struct cam_cdm_intf_mgr - CDM mgr interface device struct */
  487. struct cam_cdm_intf_mgr {
  488. bool probe_done;
  489. struct cam_cdm_intf_devices nodes[CAM_CDM_INTF_MGR_MAX_SUPPORTED_CDM];
  490. uint32_t cdm_count;
  491. uint32_t dt_supported_hw_cdm;
  492. int32_t refcount;
  493. };
  494. int cam_cdm_intf_register_hw_cdm(struct cam_hw_intf *hw,
  495. struct cam_cdm_private_dt_data *data, enum cam_cdm_type type,
  496. uint32_t *index);
  497. int cam_cdm_intf_deregister_hw_cdm(struct cam_hw_intf *hw,
  498. struct cam_cdm_private_dt_data *data, enum cam_cdm_type type,
  499. uint32_t index);
  500. #endif /* _CAM_CDM_H_ */