qdf_ipa_wdi3.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. /*
  2. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /**
  17. * DOC: qdf_ipa_wdi3.h
  18. * This file provides OS abstraction for IPA WDI APIs.
  19. */
  20. #ifndef _QDF_IPA_WDI3_H
  21. #define _QDF_IPA_WDI3_H
  22. #ifdef IPA_OFFLOAD
  23. #ifdef CONFIG_IPA_WDI_UNIFIED_API
  24. #include <qdf_ipa.h>
  25. #include <i_qdf_ipa_wdi3.h>
  26. /**
  27. * qdf_ipa_wdi_version_t - IPA WDI version
  28. */
  29. typedef __qdf_ipa_wdi_version_t qdf_ipa_wdi_version_t;
  30. /**
  31. * qdf_ipa_wdi_init_in_params_t - wdi init input parameters
  32. */
  33. typedef __qdf_ipa_wdi_init_in_params_t qdf_ipa_wdi_init_in_params_t;
  34. /**
  35. * qdf_ipa_wdi_init_out_params_t - wdi init output parameters
  36. */
  37. typedef __qdf_ipa_wdi_init_out_params_t qdf_ipa_wdi_init_out_params_t;
  38. /**
  39. * qdf_ipa_wdi_pipe_setup_info_smmu_t - WDI TX/Rx configuration
  40. */
  41. typedef __qdf_ipa_wdi_pipe_setup_info_smmu_t qdf_ipa_wdi_pipe_setup_info_smmu_t;
  42. typedef __qdf_ipa_ep_cfg_t qdf_ipa_ep_cfg_t;
  43. /**
  44. * qdf_ipa_wdi_init - Client should call this function to
  45. * init WDI IPA offload data path
  46. *
  47. * Note: Should not be called from atomic context and only
  48. * after checking IPA readiness using ipa_register_ipa_ready_cb()
  49. *
  50. * @Return 0 on success, negative on failure
  51. */
  52. static inline int qdf_ipa_wdi_init(qdf_ipa_wdi_init_in_params_t *in,
  53. qdf_ipa_wdi_init_out_params_t *out)
  54. {
  55. return __qdf_ipa_wdi_init(in, out);
  56. }
  57. /**
  58. * qdf_ipa_wdi_cleanup - Client should call this function to
  59. * clean up WDI IPA offload data path
  60. *
  61. * @Return 0 on success, negative on failure
  62. */
  63. static inline int qdf_ipa_wdi_cleanup(void)
  64. {
  65. return __qdf_ipa_wdi_cleanup();
  66. }
  67. /**
  68. * qdf_ipa_wdi_hdr_info_t - Header to install on IPA HW
  69. */
  70. typedef __qdf_ipa_wdi_hdr_info_t qdf_ipa_wdi_hdr_info_t;
  71. /**
  72. * qdf_ipa_wdi_reg_intf_in_params_t - parameters for uC offload
  73. * interface registration
  74. */
  75. typedef __qdf_ipa_wdi_reg_intf_in_params_t qdf_ipa_wdi_reg_intf_in_params_t;
  76. /**
  77. * qdf_ipa_wdi_pipe_setup_info_t - WDI TX/Rx configuration
  78. */
  79. typedef __qdf_ipa_wdi_pipe_setup_info_t qdf_ipa_wdi_pipe_setup_info_t;
  80. /**
  81. * qdf_ipa_wdi_conn_in_params_t - information provided by
  82. * uC offload client
  83. */
  84. typedef __qdf_ipa_wdi_conn_in_params_t qdf_ipa_wdi_conn_in_params_t;
  85. /**
  86. * qdf_ipa_wdi_conn_out_params_t - information provided
  87. * to WLAN druver
  88. */
  89. typedef __qdf_ipa_wdi_conn_out_params_t qdf_ipa_wdi_conn_out_params_t;
  90. /**
  91. * qdf_ipa_wdi_perf_profile_t - To set BandWidth profile
  92. */
  93. typedef __qdf_ipa_wdi_perf_profile_t qdf_ipa_wdi_perf_profile_t;
  94. /**
  95. * qdf_ipa_wdi_reg_intf - Client should call this function to
  96. * init WDI IPA offload data path
  97. *
  98. * Note: Should not be called from atomic context and only
  99. * after checking IPA readiness using ipa_register_ipa_ready_cb()
  100. *
  101. * @Return 0 on success, negative on failure
  102. */
  103. static inline int qdf_ipa_wdi_reg_intf(
  104. qdf_ipa_wdi_reg_intf_in_params_t *in)
  105. {
  106. return __qdf_ipa_wdi_reg_intf(in);
  107. }
  108. /**
  109. * qdf_ipa_wdi_dereg_intf - Client Driver should call this
  110. * function to deregister before unload and after disconnect
  111. *
  112. * @Return 0 on success, negative on failure
  113. */
  114. static inline int qdf_ipa_wdi_dereg_intf(const char *netdev_name)
  115. {
  116. return __qdf_ipa_wdi_dereg_intf(netdev_name);
  117. }
  118. /**
  119. * qdf_ipa_wdi_conn_pipes - Client should call this
  120. * function to connect pipes
  121. *
  122. * @in: [in] input parameters from client
  123. * @out: [out] output params to client
  124. *
  125. * Note: Should not be called from atomic context and only
  126. * after checking IPA readiness using ipa_register_ipa_ready_cb()
  127. *
  128. * @Return 0 on success, negative on failure
  129. */
  130. static inline int qdf_ipa_wdi_conn_pipes(qdf_ipa_wdi_conn_in_params_t *in,
  131. qdf_ipa_wdi_conn_out_params_t *out)
  132. {
  133. return __qdf_ipa_wdi_conn_pipes(in, out);
  134. }
  135. /**
  136. * qdf_ipa_wdi_disconn_pipes() - Client should call this
  137. * function to disconnect pipes
  138. *
  139. * Note: Should not be called from atomic context
  140. *
  141. * Returns: 0 on success, negative on failure
  142. */
  143. static inline int qdf_ipa_wdi_disconn_pipes(void)
  144. {
  145. return __qdf_ipa_wdi_disconn_pipes();
  146. }
  147. /**
  148. * qdf_ipa_wdi_enable_pipes() - Client should call this
  149. * function to enable IPA offload data path
  150. *
  151. * Note: Should not be called from atomic context
  152. *
  153. * Returns: 0 on success, negative on failure
  154. */
  155. static inline int qdf_ipa_wdi_enable_pipes(void)
  156. {
  157. return __qdf_ipa_wdi_enable_pipes();
  158. }
  159. /**
  160. * qdf_ipa_wdi_disable_pipes() - Client should call this
  161. * function to disable IPA offload data path
  162. *
  163. * Note: Should not be called from atomic context
  164. *
  165. * Returns: 0 on success, negative on failure
  166. */
  167. static inline int qdf_ipa_wdi_disable_pipes(void)
  168. {
  169. return __qdf_ipa_wdi_disable_pipes();
  170. }
  171. /**
  172. * qdf_ipa_wdi_set_perf_profile() - Client should call this function to
  173. * set IPA clock bandwidth based on data rates
  174. *
  175. * @profile: [in] BandWidth profile to use
  176. *
  177. * Returns: 0 on success, negative on failure
  178. */
  179. static inline int qdf_ipa_wdi_set_perf_profile(
  180. qdf_ipa_wdi_perf_profile_t *profile)
  181. {
  182. return __qdf_ipa_wdi_set_perf_profile(profile);
  183. }
  184. /**
  185. * qdf_ipa_wdi_create_smmu_mapping() - Client should call this function to
  186. * create smmu mapping
  187. *
  188. * @num_buffers: [in] number of buffers
  189. * @info: [in] wdi buffer info
  190. *
  191. * Returns: 0 on success, negative on failure
  192. */
  193. static inline int qdf_ipa_wdi_create_smmu_mapping(uint32_t num_buffers,
  194. qdf_ipa_wdi_buffer_info_t *info)
  195. {
  196. return __qdf_ipa_wdi_create_smmu_mapping(num_buffers, info);
  197. }
  198. /**
  199. * qdf_ipa_wdi_release_smmu_mapping() - Client should call this function to
  200. * release smmu mapping
  201. *
  202. * @num_buffers: [in] number of buffers
  203. * @info: [in] wdi buffer info
  204. *
  205. * Returns: 0 on success, negative on failure
  206. */
  207. static inline int qdf_ipa_wdi_release_smmu_mapping(uint32_t num_buffers,
  208. qdf_ipa_wdi_buffer_info_t *info)
  209. {
  210. return __qdf_ipa_wdi_release_smmu_mapping(num_buffers, info);
  211. }
  212. #else /* CONFIG_IPA_WDI_UNIFIED_API */
  213. #include <i_qdf_ipa_wdi3.h>
  214. /**
  215. * qdf_ipa_wdi3_hdr_info_t - Header to install on IPA HW
  216. */
  217. typedef __qdf_ipa_wdi3_hdr_info_t qdf_ipa_wdi3_hdr_info_t;
  218. /**
  219. * qdf_ipa_wdi3_reg_intf_in_params_t - parameters for uC offload
  220. * interface registration
  221. */
  222. typedef __qdf_ipa_wdi3_reg_intf_in_params_t qdf_ipa_wdi3_reg_intf_in_params_t;
  223. /**
  224. * qdf_ipa_wdi3_setup_info_t - WDI3 TX/Rx configuration
  225. */
  226. typedef __qdf_ipa_wdi3_setup_info_t qdf_ipa_wdi3_setup_info_t;
  227. /**
  228. * qdf_ipa_wdi3_conn_in_params_t - information provided by
  229. * uC offload client
  230. */
  231. typedef __qdf_ipa_wdi3_conn_in_params_t qdf_ipa_wdi3_conn_in_params_t;
  232. /**
  233. * qdf_ipa_wdi3_conn_out_params_t - information provided
  234. * to WLAN druver
  235. */
  236. typedef __qdf_ipa_wdi3_conn_out_params_t qdf_ipa_wdi3_conn_out_params_t;
  237. /**
  238. * qdf_ipa_wdi3_perf_profile_t - To set BandWidth profile
  239. */
  240. typedef __qdf_ipa_wdi3_perf_profile_t qdf_ipa_wdi3_perf_profile_t;
  241. /**
  242. * qdf_ipa_wdi3_reg_intf - Client should call this function to
  243. * init WDI3 IPA offload data path
  244. *
  245. * Note: Should not be called from atomic context and only
  246. * after checking IPA readiness using ipa_register_ipa_ready_cb()
  247. *
  248. * @Return 0 on success, negative on failure
  249. */
  250. static inline int qdf_ipa_wdi3_reg_intf(
  251. struct ipa_wdi3_reg_intf_in_params *in)
  252. {
  253. return __qdf_ipa_wdi3_reg_intf(in);
  254. }
  255. /**
  256. * qdf_ipa_wdi3_dereg_intf - Client Driver should call this
  257. * function to deregister before unload and after disconnect
  258. *
  259. * @Return 0 on success, negative on failure
  260. */
  261. static inline int qdf_ipa_wdi3_dereg_intf(const char *netdev_name)
  262. {
  263. return __qdf_ipa_wdi3_dereg_intf(netdev_name);
  264. }
  265. /**
  266. * qdf_ipa_wdi3_conn_pipes - Client should call this
  267. * function to connect pipes
  268. *
  269. * @in: [in] input parameters from client
  270. * @out: [out] output params to client
  271. *
  272. * Note: Should not be called from atomic context and only
  273. * after checking IPA readiness using ipa_register_ipa_ready_cb()
  274. *
  275. * @Return 0 on success, negative on failure
  276. */
  277. static inline int qdf_ipa_wdi3_conn_pipes(struct ipa_wdi3_conn_in_params *in,
  278. struct ipa_wdi3_conn_out_params *out)
  279. {
  280. return __qdf_ipa_wdi3_conn_pipes(in, out);
  281. }
  282. /**
  283. * qdf_ipa_wdi3_disconn_pipes() - Client should call this
  284. * function to disconnect pipes
  285. *
  286. * Note: Should not be called from atomic context
  287. *
  288. * Returns: 0 on success, negative on failure
  289. */
  290. static inline int qdf_ipa_wdi3_disconn_pipes(void)
  291. {
  292. return __qdf_ipa_wdi3_disconn_pipes();
  293. }
  294. /**
  295. * qdf_ipa_wdi3_enable_pipes() - Client should call this
  296. * function to enable IPA offload data path
  297. *
  298. * Note: Should not be called from atomic context
  299. *
  300. * Returns: 0 on success, negative on failure
  301. */
  302. static inline int qdf_ipa_wdi3_enable_pipes(void)
  303. {
  304. return __qdf_ipa_wdi3_enable_pipes();
  305. }
  306. /**
  307. * qdf_ipa_wdi3_disable_pipes() - Client should call this
  308. * function to disable IPA offload data path
  309. *
  310. * Note: Should not be called from atomic context
  311. *
  312. * Returns: 0 on success, negative on failure
  313. */
  314. static inline int qdf_ipa_wdi3_disable_pipes(void)
  315. {
  316. return __qdf_ipa_wdi3_disable_pipes();
  317. }
  318. /**
  319. * qdf_ipa_wdi3_set_perf_profile() - Client should call this function to
  320. * set IPA clock bandwidth based on data rates
  321. *
  322. * @profile: [in] BandWidth profile to use
  323. *
  324. * Returns: 0 on success, negative on failure
  325. */
  326. static inline int qdf_ipa_wdi3_set_perf_profile(
  327. struct ipa_wdi3_perf_profile *profile)
  328. {
  329. return __qdf_ipa_wdi3_set_perf_profile(profile);
  330. }
  331. #endif /* CONFIG_IPA_WDI_UNIFIED_API */
  332. #endif /* IPA_OFFLOAD */
  333. #endif /* _QDF_IPA_WDI3_H */