cam_cpas_api.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _CAM_CPAS_API_H_
  6. #define _CAM_CPAS_API_H_
  7. #include <linux/device.h>
  8. #include <linux/platform_device.h>
  9. #include <media/cam_cpas.h>
  10. #include "cam_soc_util.h"
  11. #define CAM_HW_IDENTIFIER_LENGTH 128
  12. /* Default AXI Bandwidth vote */
  13. #define CAM_CPAS_DEFAULT_AXI_BW 1024
  14. #define CAM_CPAS_MAX_PATHS_PER_CLIENT 15
  15. #define CAM_CPAS_API_PATH_DATA_STD_START 512
  16. /* Qos Selection mask */
  17. #define CAM_CPAS_QOS_DEFAULT_SETTINGS_MASK 0x1
  18. #define CAM_CPAS_QOS_CUSTOM_SETTINGS_MASK 0x2
  19. /**
  20. * enum cam_cpas_reg_base - Enum for register base identifier. These
  21. * are the identifiers used in generic register
  22. * write/read APIs provided by cpas driver.
  23. */
  24. enum cam_cpas_reg_base {
  25. CAM_CPAS_REG_CPASTOP,
  26. CAM_CPAS_REG_CAMNOC,
  27. CAM_CPAS_REG_CAMSS,
  28. CAM_CPAS_REG_RPMH,
  29. CAM_CPAS_REG_MAX
  30. };
  31. /**
  32. * enum cam_cpas_camera_version Enum for Titan Camera Versions
  33. */
  34. enum cam_cpas_camera_version {
  35. CAM_CPAS_CAMERA_VERSION_NONE = 0,
  36. CAM_CPAS_CAMERA_VERSION_150 = 0x00010500,
  37. CAM_CPAS_CAMERA_VERSION_170 = 0x00010700,
  38. CAM_CPAS_CAMERA_VERSION_175 = 0x00010705,
  39. CAM_CPAS_CAMERA_VERSION_480 = 0x00040800,
  40. CAM_CPAS_CAMERA_VERSION_520 = 0x00050200,
  41. CAM_CPAS_CAMERA_VERSION_540 = 0x00050400,
  42. CAM_CPAS_CAMERA_VERSION_580 = 0x00050800,
  43. CAM_CPAS_CAMERA_VERSION_545 = 0x00050405,
  44. CAM_CPAS_CAMERA_VERSION_570 = 0x00050700,
  45. CAM_CPAS_CAMERA_VERSION_MAX
  46. };
  47. /**
  48. * enum cam_cpas_version Enum for Titan CPAS Versions
  49. */
  50. enum cam_cpas_version {
  51. CAM_CPAS_VERSION_NONE = 0,
  52. CAM_CPAS_VERSION_100 = 0x10000000,
  53. CAM_CPAS_VERSION_101 = 0x10000001,
  54. CAM_CPAS_VERSION_110 = 0x10010000,
  55. CAM_CPAS_VERSION_120 = 0x10020000,
  56. CAM_CPAS_VERSION_130 = 0x10030000,
  57. CAM_CPAS_VERSION_200 = 0x20000000,
  58. CAM_CPAS_VERSION_MAX
  59. };
  60. /**
  61. * enum cam_cpas_camera_version_map_id Enum for camera version map id
  62. * This enum is mapped with cam_cpas_camera_version
  63. */
  64. enum cam_cpas_camera_version_map_id {
  65. CAM_CPAS_CAMERA_VERSION_ID_150 = 0x0,
  66. CAM_CPAS_CAMERA_VERSION_ID_170 = 0x1,
  67. CAM_CPAS_CAMERA_VERSION_ID_175 = 0x2,
  68. CAM_CPAS_CAMERA_VERSION_ID_480 = 0x3,
  69. CAM_CPAS_CAMERA_VERSION_ID_580 = 0x4,
  70. CAM_CPAS_CAMERA_VERSION_ID_520 = 0x5,
  71. CAM_CPAS_CAMERA_VERSION_ID_540 = 0x6,
  72. CAM_CPAS_CAMERA_VERSION_ID_545 = 0x7,
  73. CAM_CPAS_CAMERA_VERSION_ID_570 = 0x8,
  74. CAM_CPAS_CAMERA_VERSION_ID_MAX
  75. };
  76. /**
  77. * enum cam_cpas_version_map_id Enum for cpas version map id
  78. * This enum is mapped with cam_cpas_version
  79. */
  80. enum cam_cpas_version_map_id {
  81. CAM_CPAS_VERSION_ID_100 = 0x0,
  82. CAM_CPAS_VERSION_ID_101 = 0x1,
  83. CAM_CPAS_VERSION_ID_110 = 0x2,
  84. CAM_CPAS_VERSION_ID_120 = 0x3,
  85. CAM_CPAS_VERSION_ID_130 = 0x4,
  86. CAM_CPAS_VERSION_ID_200 = 0x5,
  87. CAM_CPAS_VERSION_ID_MAX
  88. };
  89. /**
  90. * enum cam_cpas_hw_version - Enum for Titan CPAS HW Versions
  91. */
  92. enum cam_cpas_hw_version {
  93. CAM_CPAS_TITAN_NONE = 0,
  94. CAM_CPAS_TITAN_150_V100 = 0x150100,
  95. CAM_CPAS_TITAN_170_V100 = 0x170100,
  96. CAM_CPAS_TITAN_170_V110 = 0x170110,
  97. CAM_CPAS_TITAN_170_V120 = 0x170120,
  98. CAM_CPAS_TITAN_170_V200 = 0x170200,
  99. CAM_CPAS_TITAN_175_V100 = 0x175100,
  100. CAM_CPAS_TITAN_175_V101 = 0x175101,
  101. CAM_CPAS_TITAN_175_V120 = 0x175120,
  102. CAM_CPAS_TITAN_175_V130 = 0x175130,
  103. CAM_CPAS_TITAN_480_V100 = 0x480100,
  104. CAM_CPAS_TITAN_580_V100 = 0x580100,
  105. CAM_CPAS_TITAN_540_V100 = 0x540100,
  106. CAM_CPAS_TITAN_520_V100 = 0x520100,
  107. CAM_CPAS_TITAN_545_V100 = 0x545100,
  108. CAM_CPAS_TITAN_570_V200 = 0x570200,
  109. CAM_CPAS_TITAN_MAX
  110. };
  111. /**
  112. * enum cam_camnoc_irq_type - Enum for camnoc irq types
  113. *
  114. * @CAM_CAMNOC_IRQ_SLAVE_ERROR: Each slave port in CAMNOC (3 QSB ports and
  115. * 1 QHB port) has an error logger. The error
  116. * observed at any slave port is logged into
  117. * the error logger register and an IRQ is
  118. * triggered
  119. * @CAM_CAMNOC_IRQ_IFE_UBWC_STATS_ENCODE_ERROR: Triggered if any error detected
  120. * in the IFE UBWC-Stats encoder
  121. * instance
  122. * @CAM_CAMNOC_IRQ_IFE02_UBWC_ENCODE_ERROR : Triggered if any error detected
  123. * in the IFE0 UBWC encoder instance
  124. * @CAM_CAMNOC_IRQ_IFE13_UBWC_ENCODE_ERROR : Triggered if any error detected
  125. * in the IFE1 or IFE3 UBWC encoder
  126. * instance
  127. * @CAM_CAMNOC_IRQ_IFE0_UBWC_ENCODE_ERROR : Triggered if any error detected
  128. * in the IFE0 UBWC encoder instance
  129. * @CAM_CAMNOC_IRQ_IFE1_WR_UBWC_ENCODE_ERROR : Triggered if any error detected
  130. * in the IFE1 UBWC encoder
  131. * instance
  132. * @CAM_CAMNOC_IRQ_IPE1_BPS_UBWC_DECODE_ERROR: Triggered if any error detected
  133. * in the IPE1/BPS read path decoder
  134. * instance
  135. * @CAM_CAMNOC_IRQ_IPE0_UBWC_DECODE_ERROR : Triggered if any error detected
  136. * in the IPE0 read path decoder
  137. * instance
  138. * @CAM_CAMNOC_IRQ_IPE_BPS_UBWC_DECODE_ERROR: Triggered if any error detected
  139. * in the IPE/BPS UBWC decoder
  140. * instance
  141. * @CAM_CAMNOC_IRQ_IPE_BPS_UBWC_ENCODE_ERROR: Triggered if any error detected
  142. * in the IPE/BPS UBWC encoder
  143. * instance
  144. * @CAM_CAMNOC_IRQ_AHB_TIMEOUT : Triggered when the QHS_ICP slave
  145. * times out after 4000 AHB cycles
  146. */
  147. enum cam_camnoc_irq_type {
  148. CAM_CAMNOC_IRQ_SLAVE_ERROR,
  149. CAM_CAMNOC_IRQ_IFE_UBWC_STATS_ENCODE_ERROR,
  150. CAM_CAMNOC_IRQ_IFE_UBWC_STATS_1_ENCODE_ERROR,
  151. CAM_CAMNOC_IRQ_IFE02_UBWC_ENCODE_ERROR,
  152. CAM_CAMNOC_IRQ_IFE13_UBWC_ENCODE_ERROR,
  153. CAM_CAMNOC_IRQ_IFE0_UBWC_ENCODE_ERROR,
  154. CAM_CAMNOC_IRQ_IFE1_WRITE_UBWC_ENCODE_ERROR,
  155. CAM_CAMNOC_IRQ_IPE1_BPS_UBWC_DECODE_ERROR,
  156. CAM_CAMNOC_IRQ_IPE0_UBWC_DECODE_ERROR,
  157. CAM_CAMNOC_IRQ_IPE_BPS_UBWC_DECODE_ERROR,
  158. CAM_CAMNOC_IRQ_IPE_BPS_UBWC_ENCODE_ERROR,
  159. CAM_CAMNOC_IRQ_AHB_TIMEOUT,
  160. };
  161. /**
  162. * struct cam_camnoc_irq_slave_err_data : Data for Slave error.
  163. *
  164. * @mainctrl : Err logger mainctrl info
  165. * @errvld : Err logger errvld info
  166. * @errlog0_low : Err logger errlog0_low info
  167. * @errlog0_high : Err logger errlog0_high info
  168. * @errlog1_low : Err logger errlog1_low info
  169. * @errlog1_high : Err logger errlog1_high info
  170. * @errlog2_low : Err logger errlog2_low info
  171. * @errlog2_high : Err logger errlog2_high info
  172. * @errlog3_low : Err logger errlog3_low info
  173. * @errlog3_high : Err logger errlog3_high info
  174. *
  175. */
  176. struct cam_camnoc_irq_slave_err_data {
  177. union {
  178. struct {
  179. uint32_t stall_en : 1; /* bit 0 */
  180. uint32_t fault_en : 1; /* bit 1 */
  181. uint32_t rsv : 30; /* bits 2-31 */
  182. };
  183. uint32_t value;
  184. } mainctrl;
  185. union {
  186. struct {
  187. uint32_t err_vld : 1; /* bit 0 */
  188. uint32_t rsv : 31; /* bits 1-31 */
  189. };
  190. uint32_t value;
  191. } errvld;
  192. union {
  193. struct {
  194. uint32_t loginfo_vld : 1; /* bit 0 */
  195. uint32_t word_error : 1; /* bit 1 */
  196. uint32_t non_secure : 1; /* bit 2 */
  197. uint32_t device : 1; /* bit 3 */
  198. uint32_t opc : 3; /* bits 4 - 6 */
  199. uint32_t rsv0 : 1; /* bit 7 */
  200. uint32_t err_code : 3; /* bits 8 - 10 */
  201. uint32_t sizef : 3; /* bits 11 - 13 */
  202. uint32_t rsv1 : 2; /* bits 14 - 15 */
  203. uint32_t addr_space : 6; /* bits 16 - 21 */
  204. uint32_t rsv2 : 10; /* bits 22 - 31 */
  205. };
  206. uint32_t value;
  207. } errlog0_low;
  208. union {
  209. struct {
  210. uint32_t len1 : 10; /* bits 0 - 9 */
  211. uint32_t rsv : 22; /* bits 10 - 31 */
  212. };
  213. uint32_t value;
  214. } errlog0_high;
  215. union {
  216. struct {
  217. uint32_t path : 16; /* bits 0 - 15 */
  218. uint32_t rsv : 16; /* bits 16 - 31 */
  219. };
  220. uint32_t value;
  221. } errlog1_low;
  222. union {
  223. struct {
  224. uint32_t extid : 18; /* bits 0 - 17 */
  225. uint32_t rsv : 14; /* bits 18 - 31 */
  226. };
  227. uint32_t value;
  228. } errlog1_high;
  229. union {
  230. struct {
  231. uint32_t errlog2_lsb : 32; /* bits 0 - 31 */
  232. };
  233. uint32_t value;
  234. } errlog2_low;
  235. union {
  236. struct {
  237. uint32_t errlog2_msb : 16; /* bits 0 - 16 */
  238. uint32_t rsv : 16; /* bits 16 - 31 */
  239. };
  240. uint32_t value;
  241. } errlog2_high;
  242. union {
  243. struct {
  244. uint32_t errlog3_lsb : 32; /* bits 0 - 31 */
  245. };
  246. uint32_t value;
  247. } errlog3_low;
  248. union {
  249. struct {
  250. uint32_t errlog3_msb : 32; /* bits 0 - 31 */
  251. };
  252. uint32_t value;
  253. } errlog3_high;
  254. };
  255. /**
  256. * struct cam_camnoc_irq_ubwc_enc_data : Data for UBWC Encode error.
  257. *
  258. * @encerr_status : Encode error status
  259. *
  260. */
  261. struct cam_camnoc_irq_ubwc_enc_data {
  262. union {
  263. struct {
  264. uint32_t encerrstatus : 3; /* bits 0 - 2 */
  265. uint32_t rsv : 29; /* bits 3 - 31 */
  266. };
  267. uint32_t value;
  268. } encerr_status;
  269. };
  270. /**
  271. * struct cam_camnoc_irq_ubwc_dec_data : Data for UBWC Decode error.
  272. *
  273. * @decerr_status : Decoder error status
  274. * @thr_err : Set to 1 if
  275. * At least one of the bflc_len fields in the bit steam exceeds
  276. * its threshold value. This error is possible only for
  277. * RGBA1010102, TP10, and RGB565 formats
  278. * @fcl_err : Set to 1 if
  279. * Fast clear with a legal non-RGB format
  280. * @len_md_err : Set to 1 if
  281. * The calculated burst length does not match burst length
  282. * specified by the metadata value
  283. * @format_err : Set to 1 if
  284. * Illegal format
  285. * 1. bad format :2,3,6
  286. * 2. For 32B MAL, metadata=6
  287. * 3. For 32B MAL RGB565, Metadata != 0,1,7
  288. * 4. For 64B MAL RGB565, metadata[3:1] == 1,2
  289. *
  290. */
  291. struct cam_camnoc_irq_ubwc_dec_data {
  292. union {
  293. struct {
  294. uint32_t thr_err : 1; /* bit 0 */
  295. uint32_t fcl_err : 1; /* bit 1 */
  296. uint32_t len_md_err : 1; /* bit 2 */
  297. uint32_t format_err : 1; /* bit 3 */
  298. uint32_t rsv : 28; /* bits 4 - 31 */
  299. };
  300. uint32_t value;
  301. } decerr_status;
  302. };
  303. struct cam_camnoc_irq_ahb_timeout_data {
  304. uint32_t data;
  305. };
  306. /**
  307. * struct cam_cpas_irq_data : CAMNOC IRQ data
  308. *
  309. * @irq_type : To identify the type of IRQ
  310. * @u : Union of irq err data information
  311. * @slave_err : Data for Slave error.
  312. * Valid if type is CAM_CAMNOC_IRQ_SLAVE_ERROR
  313. * @enc_err : Data for UBWC Encode error.
  314. * Valid if type is one of below:
  315. * CAM_CAMNOC_IRQ_IFE02_UBWC_ENCODE_ERROR
  316. * CAM_CAMNOC_IRQ_IFE13_UBWC_ENCODE_ERROR
  317. * CAM_CAMNOC_IRQ_IPE_BPS_UBWC_ENCODE_ERROR
  318. * @dec_err : Data for UBWC Decode error.
  319. * Valid if type is CAM_CAMNOC_IRQ_IPE_BPS_UBWC_DECODE_ERROR
  320. * @ahb_err : Data for Slave error.
  321. * Valid if type is CAM_CAMNOC_IRQ_AHB_TIMEOUT
  322. *
  323. */
  324. struct cam_cpas_irq_data {
  325. enum cam_camnoc_irq_type irq_type;
  326. union {
  327. struct cam_camnoc_irq_slave_err_data slave_err;
  328. struct cam_camnoc_irq_ubwc_enc_data enc_err;
  329. struct cam_camnoc_irq_ubwc_dec_data dec_err;
  330. struct cam_camnoc_irq_ahb_timeout_data ahb_err;
  331. } u;
  332. };
  333. /**
  334. * struct cam_cpas_register_params : Register params for cpas client
  335. *
  336. * @identifier : Input identifier string which is the device label
  337. * from dt like vfe, ife, jpeg etc
  338. * @cell_index : Input integer identifier pointing to the cell index
  339. * from dt of the device. This can be used to form a
  340. * unique string with @identifier like vfe0, ife1,
  341. * jpeg0, etc
  342. * @dev : device handle
  343. * @userdata : Input private data which will be passed as
  344. * an argument while callback.
  345. * @cam_cpas_callback : Input callback pointer for triggering the
  346. * callbacks from CPAS driver.
  347. * @client_handle : CPAS client handle
  348. * @userdata : User data given at the time of register
  349. * @event_type : event type
  350. * @event_data : event data
  351. * @client_handle : Output Unique handle generated for this register
  352. *
  353. */
  354. struct cam_cpas_register_params {
  355. char identifier[CAM_HW_IDENTIFIER_LENGTH];
  356. uint32_t cell_index;
  357. struct device *dev;
  358. void *userdata;
  359. bool (*cam_cpas_client_cb)(
  360. uint32_t client_handle,
  361. void *userdata,
  362. struct cam_cpas_irq_data *irq_data);
  363. uint32_t client_handle;
  364. };
  365. /**
  366. * enum cam_vote_type - Enum for voting type
  367. *
  368. * @CAM_VOTE_ABSOLUTE : Absolute vote
  369. * @CAM_VOTE_DYNAMIC : Dynamic vote
  370. */
  371. enum cam_vote_type {
  372. CAM_VOTE_ABSOLUTE,
  373. CAM_VOTE_DYNAMIC,
  374. };
  375. /**
  376. * struct cam_ahb_vote : AHB vote
  377. *
  378. * @type : AHB voting type.
  379. * CAM_VOTE_ABSOLUTE : vote based on the value 'level' is set
  380. * CAM_VOTE_DYNAMIC : vote calculated dynamically using 'freq'
  381. * and 'dev' handle is set
  382. * @level : AHB vote level
  383. * @freq : AHB vote dynamic frequency
  384. *
  385. */
  386. struct cam_ahb_vote {
  387. enum cam_vote_type type;
  388. union {
  389. enum cam_vote_level level;
  390. unsigned long freq;
  391. } vote;
  392. };
  393. /**
  394. * struct cam_axi_vote : AXI vote
  395. *
  396. * @num_paths: Number of paths on which BW vote is sent to CPAS
  397. * @axi_path: Per path BW vote info
  398. *
  399. */
  400. struct cam_axi_vote {
  401. uint32_t num_paths;
  402. struct cam_axi_per_path_bw_vote axi_path[CAM_CPAS_MAX_PATHS_PER_CLIENT];
  403. };
  404. /**
  405. * cam_cpas_register_client()
  406. *
  407. * @brief: API to register cpas client
  408. *
  409. * @register_params: Input params to register as a client to CPAS
  410. *
  411. * @return 0 on success.
  412. *
  413. */
  414. int cam_cpas_register_client(
  415. struct cam_cpas_register_params *register_params);
  416. /**
  417. * cam_cpas_unregister_client()
  418. *
  419. * @brief: API to unregister cpas client
  420. *
  421. * @client_handle: Client handle to be unregistered
  422. *
  423. * @return 0 on success.
  424. *
  425. */
  426. int cam_cpas_unregister_client(uint32_t client_handle);
  427. /**
  428. * cam_cpas_start()
  429. *
  430. * @brief: API to start cpas client hw. Clients have to vote for minimal
  431. * bandwidth requirements for AHB, AXI. Use cam_cpas_update_ahb_vote
  432. * to scale bandwidth after start.
  433. *
  434. * @client_handle: client cpas handle
  435. * @ahb_vote : Pointer to ahb vote info
  436. * @axi_vote : Pointer to axi bandwidth vote info
  437. *
  438. * If AXI vote is not applicable to a particular client, use the value exposed
  439. * by CAM_CPAS_DEFAULT_AXI_BW as the default vote request.
  440. *
  441. * @return 0 on success.
  442. *
  443. */
  444. int cam_cpas_start(
  445. uint32_t client_handle,
  446. struct cam_ahb_vote *ahb_vote,
  447. struct cam_axi_vote *axi_vote);
  448. /**
  449. * cam_cpas_stop()
  450. *
  451. * @brief: API to stop cpas client hw. Bandwidth for AHB, AXI votes
  452. * would be removed for this client on this call. Clients should not
  453. * use cam_cpas_update_ahb_vote or cam_cpas_update_axi_vote
  454. * to remove their bandwidth vote.
  455. *
  456. * @client_handle: client cpas handle
  457. *
  458. * @return 0 on success.
  459. *
  460. */
  461. int cam_cpas_stop(uint32_t client_handle);
  462. /**
  463. * cam_cpas_update_ahb_vote()
  464. *
  465. * @brief: API to update AHB vote requirement. Use this function only
  466. * between cam_cpas_start and cam_cpas_stop in case clients wants
  467. * to scale to different vote level. Do not use this function to de-vote,
  468. * removing client's vote is implicit on cam_cpas_stop
  469. *
  470. * @client_handle : Client cpas handle
  471. * @ahb_vote : Pointer to ahb vote info
  472. *
  473. * @return 0 on success.
  474. *
  475. */
  476. int cam_cpas_update_ahb_vote(
  477. uint32_t client_handle,
  478. struct cam_ahb_vote *ahb_vote);
  479. /**
  480. * cam_cpas_update_axi_vote()
  481. *
  482. * @brief: API to update AXI vote requirement. Use this function only
  483. * between cam_cpas_start and cam_cpas_stop in case clients wants
  484. * to scale to different vote level. Do not use this function to de-vote,
  485. * removing client's vote is implicit on cam_cpas_stop
  486. *
  487. * @client_handle : Client cpas handle
  488. * @axi_vote : Pointer to axi bandwidth vote info
  489. *
  490. * @return 0 on success.
  491. *
  492. */
  493. int cam_cpas_update_axi_vote(
  494. uint32_t client_handle,
  495. struct cam_axi_vote *axi_vote);
  496. /**
  497. * cam_cpas_reg_write()
  498. *
  499. * @brief: API to write a register value in CPAS register space
  500. *
  501. * @client_handle : Client cpas handle
  502. * @reg_base : Register base identifier
  503. * @offset : Offset from the register base address
  504. * @mb : Whether to do reg write with memory barrier
  505. * @value : Value to be written in register
  506. *
  507. * @return 0 on success.
  508. *
  509. */
  510. int cam_cpas_reg_write(
  511. uint32_t client_handle,
  512. enum cam_cpas_reg_base reg_base,
  513. uint32_t offset,
  514. bool mb,
  515. uint32_t value);
  516. /**
  517. * cam_cpas_reg_read()
  518. *
  519. * @brief: API to read a register value from CPAS register space
  520. *
  521. * @client_handle : Client cpas handle
  522. * @reg_base : Register base identifier
  523. * @offset : Offset from the register base address
  524. * @mb : Whether to do reg read with memory barrier
  525. * @value : Value to be red from register
  526. *
  527. * @return 0 on success.
  528. *
  529. */
  530. int cam_cpas_reg_read(
  531. uint32_t client_handle,
  532. enum cam_cpas_reg_base reg_base,
  533. uint32_t offset,
  534. bool mb,
  535. uint32_t *value);
  536. /**
  537. * cam_cpas_get_hw_info()
  538. *
  539. * @brief: API to get camera hw information
  540. *
  541. * @camera_family : Camera family type. One of
  542. * CAM_FAMILY_CAMERA_SS
  543. * CAM_FAMILY_CPAS_SS
  544. * @camera_version : Camera platform version
  545. * @cpas_version : Camera cpas version
  546. * @cam_caps : Camera capability
  547. * @cam_fuse_info : Camera fuse info
  548. *
  549. * @return 0 on success.
  550. *
  551. */
  552. int cam_cpas_get_hw_info(
  553. uint32_t *camera_family,
  554. struct cam_hw_version *camera_version,
  555. struct cam_hw_version *cpas_version,
  556. uint32_t *cam_caps,
  557. struct cam_cpas_fuse_info *cam_fuse_info);
  558. /**
  559. * cam_cpas_get_cpas_hw_version()
  560. *
  561. * @brief: API to get camera cpas hw version
  562. *
  563. * @hw_version : Camera cpas hw version
  564. *
  565. * @return 0 on success.
  566. *
  567. */
  568. int cam_cpas_get_cpas_hw_version(
  569. uint32_t *hw_version);
  570. /**
  571. * cam_cpas_is_feature_supported()
  572. *
  573. * @brief: API to get camera features
  574. *
  575. * @flag : Camera hw features to check
  576. *
  577. * @return 1 if feature is supported
  578. *
  579. */
  580. int cam_cpas_is_feature_supported(
  581. uint32_t flag);
  582. /**
  583. * cam_cpas_axi_util_path_type_to_string()
  584. *
  585. * @brief: API to get string for given path type
  586. *
  587. * @path_data_type : Path type
  588. *
  589. * @return string.
  590. *
  591. */
  592. const char *cam_cpas_axi_util_path_type_to_string(
  593. uint32_t path_data_type);
  594. /**
  595. * cam_cpas_axi_util_trans_type_to_string()
  596. *
  597. * @brief: API to get string for given transaction type
  598. *
  599. * @path_data_type : Transaction type
  600. *
  601. * @return string.
  602. *
  603. */
  604. const char *cam_cpas_axi_util_trans_type_to_string(
  605. uint32_t path_data_type);
  606. /**
  607. * cam_cpas_log_votes()
  608. *
  609. * @brief: API to print the all bw votes of axi client. It also print the
  610. * applied camnoc axi clock vote value and ahb vote value
  611. *
  612. * @return 0 on success.
  613. *
  614. */
  615. void cam_cpas_log_votes(void);
  616. /**
  617. * cam_cpas_select_qos_settings()
  618. *
  619. * @brief: API to select specific qos settings based on usecase requirements
  620. *
  621. * @return 0 on success.
  622. *
  623. */
  624. int cam_cpas_select_qos_settings(uint32_t selection_mask);
  625. /**
  626. * cam_cpas_notify_event()
  627. *
  628. * @brief: API that clients can notify about their events. CPAS save the event
  629. * and any other useful information related to this event. This will
  630. * be printed while cpas state dump - cam_cpas_log_votes.
  631. * One such example is IFE notifiying SOF or EPOCH to cpas and cpas
  632. * saving axi clock information (camnoc_axi, mnoc_hf) at that point
  633. * and printing latest history on IFE overflow.
  634. *
  635. * @identifier_string: Identifier string passed by caller
  636. * @identifier_value: Identifier value passed by caller
  637. *
  638. * @return 0 on success.
  639. *
  640. */
  641. int cam_cpas_notify_event(const char *identifier_string,
  642. int32_t identifier_value);
  643. #endif /* _CAM_CPAS_API_H_ */