cam_cpas_api.h 20 KB

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