cam_cpas_hw_intf.h 3.7 KB

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