cam_cpas_api.h 19 KB

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