cam_cpas_hw_intf.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CAM_CPAS_HW_INTF_H_
  7. #define _CAM_CPAS_HW_INTF_H_
  8. #include <linux/platform_device.h>
  9. #include "cam_cpas_api.h"
  10. #include "cam_hw.h"
  11. #include "cam_hw_intf.h"
  12. #include "cam_debug_util.h"
  13. /* Number of times to retry while polling */
  14. #define CAM_CPAS_POLL_RETRY_CNT 5
  15. /* Minimum usecs to sleep while polling */
  16. #define CAM_CPAS_POLL_MIN_USECS 200
  17. /* Maximum usecs to sleep while polling */
  18. #define CAM_CPAS_POLL_MAX_USECS 250
  19. /* Number of times to retry while polling */
  20. #define CAM_CPAS_POLL_QH_RETRY_CNT 50
  21. /**
  22. * enum cam_cpas_hw_type - Enum for CPAS HW type
  23. */
  24. enum cam_cpas_hw_type {
  25. CAM_HW_CPASTOP,
  26. CAM_HW_CAMSSTOP,
  27. };
  28. /**
  29. * enum cam_cpas_hw_cmd_process - Enum for CPAS HW process command type
  30. */
  31. enum cam_cpas_hw_cmd_process {
  32. CAM_CPAS_HW_CMD_REGISTER_CLIENT,
  33. CAM_CPAS_HW_CMD_UNREGISTER_CLIENT,
  34. CAM_CPAS_HW_CMD_REG_WRITE,
  35. CAM_CPAS_HW_CMD_REG_READ,
  36. CAM_CPAS_HW_CMD_AHB_VOTE,
  37. CAM_CPAS_HW_CMD_AXI_VOTE,
  38. CAM_CPAS_HW_CMD_LOG_VOTE,
  39. CAM_CPAS_HW_CMD_SELECT_QOS,
  40. CAM_CPAS_HW_CMD_LOG_EVENT,
  41. CAM_CPAS_HW_CMD_GET_SCID,
  42. CAM_CPAS_HW_CMD_ACTIVATE_LLC,
  43. CAM_CPAS_HW_CMD_DEACTIVATE_LLC,
  44. CAM_CPAS_HW_CMD_DUMP_BUFF_FILL_INFO,
  45. CAM_CPAS_HW_CMD_CSID_INPUT_CORE_INFO_UPDATE,
  46. CAM_CPAS_HW_CMD_CSID_PROCESS_RESUME,
  47. CAM_CPAS_HW_CMD_ENABLE_DISABLE_DOMAIN_ID_CLK,
  48. CAM_CPAS_HW_CMD_INVALID,
  49. };
  50. /**
  51. * struct cam_cpas_hw_cmd_csid_input_core_info_update : CPAS cmd struct for updating acquired
  52. * csid core info to cpas
  53. *
  54. * @csid_idx: CSID core index
  55. * @sfe_idx: SFE core index corresponding to CSID core
  56. * @set_port: Indicates whether to set or reset port for given client
  57. *
  58. */
  59. struct cam_cpas_hw_cmd_csid_input_core_info_update {
  60. int csid_idx;
  61. int sfe_idx;
  62. bool set_port;
  63. };
  64. /**
  65. * struct cam_cpas_hw_cmd_reg_read_write : CPAS cmd struct for reg read, write
  66. *
  67. * @client_handle: Client handle
  68. * @reg_base: Register base type
  69. * @offset: Register offset
  70. * @value: Register value
  71. * @mb: Whether to do operation with memory barrier
  72. *
  73. */
  74. struct cam_cpas_hw_cmd_reg_read_write {
  75. uint32_t client_handle;
  76. enum cam_cpas_reg_base reg_base;
  77. uint32_t offset;
  78. uint32_t value;
  79. bool mb;
  80. };
  81. /**
  82. * struct cam_cpas_hw_cmd_ahb_vote : CPAS cmd struct for AHB vote
  83. *
  84. * @client_handle: Client handle
  85. * @ahb_vote: AHB voting info
  86. *
  87. */
  88. struct cam_cpas_hw_cmd_ahb_vote {
  89. uint32_t client_handle;
  90. struct cam_ahb_vote *ahb_vote;
  91. };
  92. /**
  93. * struct cam_cpas_hw_cmd_axi_vote : CPAS cmd struct for AXI vote
  94. *
  95. * @client_handle: Client handle
  96. * @axi_vote: axi bandwidth vote
  97. *
  98. */
  99. struct cam_cpas_hw_cmd_axi_vote {
  100. uint32_t client_handle;
  101. struct cam_axi_vote *axi_vote;
  102. };
  103. /**
  104. * struct cam_cpas_hw_cmd_start : CPAS cmd struct for start
  105. *
  106. * @client_handle: Client handle
  107. *
  108. */
  109. struct cam_cpas_hw_cmd_start {
  110. uint32_t client_handle;
  111. struct cam_ahb_vote *ahb_vote;
  112. struct cam_axi_vote *axi_vote;
  113. };
  114. /**
  115. * struct cam_cpas_hw_cmd_stop : CPAS cmd struct for stop
  116. *
  117. * @client_handle: Client handle
  118. *
  119. */
  120. struct cam_cpas_hw_cmd_stop {
  121. uint32_t client_handle;
  122. };
  123. /**
  124. * struct cam_cpas_hw_cmd_notify_event : CPAS cmd struct for notify event
  125. *
  126. * @identifier_string: Identifier string passed by caller
  127. * @identifier_value: Identifier value passed by caller
  128. *
  129. */
  130. struct cam_cpas_hw_cmd_notify_event {
  131. const char *identifier_string;
  132. int32_t identifier_value;
  133. };
  134. /**
  135. * struct cam_cpas_hw_caps : CPAS HW capabilities
  136. *
  137. * @camera_family: Camera family type
  138. * @camera_version: Camera version
  139. * @cpas_version: CPAS version
  140. * @camera_capability: Camera hw capabilities
  141. * @fuse_info: Fuse information
  142. *
  143. */
  144. struct cam_cpas_hw_caps {
  145. uint32_t camera_family;
  146. struct cam_hw_version camera_version;
  147. struct cam_hw_version cpas_version;
  148. uint32_t camera_capability;
  149. struct cam_cpas_fuse_info fuse_info;
  150. };
  151. int cam_cpas_hw_probe(struct platform_device *pdev,
  152. struct cam_hw_intf **hw_intf);
  153. int cam_cpas_hw_remove(struct cam_hw_intf *cpas_hw_intf);
  154. /**
  155. * @brief : API to register CPAS hw to platform framework.
  156. * @return struct platform_device pointer on on success, or ERR_PTR() on error.
  157. */
  158. int cam_cpas_dev_init_module(void);
  159. /**
  160. * @brief : API to remove CPAS interface from platform framework.
  161. */
  162. void cam_cpas_dev_exit_module(void);
  163. #endif /* _CAM_CPAS_HW_INTF_H_ */