wlan_spectral_utils_api.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  3. *
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _WLAN_SPECTRAL_UTILS_API_H_
  20. #define _WLAN_SPECTRAL_UTILS_API_H_
  21. #include <wlan_objmgr_cmn.h>
  22. #include <wlan_lmac_if_def.h>
  23. /* Forward declaration */
  24. struct direct_buf_rx_data;
  25. struct spectral_wmi_ops;
  26. struct spectral_tgt_ops;
  27. /**
  28. * wlan_spectral_is_feature_disabled() - Check if spectral feature is disabled
  29. * @psoc - the physical device object.
  30. *
  31. * Return : true if spectral is disabled, else false.
  32. */
  33. bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc);
  34. /**
  35. * wlan_spectral_init() - API to init spectral component
  36. *
  37. * This API is invoked from dispatcher init during all component init.
  38. * This API will register all required handlers for pdev and peer object
  39. * create/delete notification.
  40. *
  41. * Return: SUCCESS,
  42. * Failure
  43. */
  44. QDF_STATUS wlan_spectral_init(void);
  45. /**
  46. * wlan_spectral_deinit() - API to deinit spectral component
  47. *
  48. * This API is invoked from dispatcher deinit during all component deinit.
  49. * This API will unregister all registered handlers for pdev and peer object
  50. * create/delete notification.
  51. *
  52. * Return: SUCCESS,
  53. * Failure
  54. */
  55. QDF_STATUS wlan_spectral_deinit(void);
  56. /**
  57. * wlan_lmac_if_sptrl_register_rx_ops() - Register lmac interface Rx operations
  58. * @rx_ops: Pointer to lmac interface Rx operations structure
  59. *
  60. * API to register spectral related lmac interface Rx operations
  61. *
  62. * Return: None
  63. */
  64. void
  65. wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops);
  66. /**
  67. * wlan_register_spectral_wmi_ops() - Register Spectral WMI operations
  68. * @psoc - Pointer to psoc object
  69. * @wmi_ops - pointer to the structure holding the Spectral WMI
  70. * operations
  71. *
  72. * API to register Spectral WMI operations
  73. *
  74. * Return: QDF_STATUS
  75. */
  76. QDF_STATUS
  77. wlan_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc,
  78. struct spectral_wmi_ops *wmi_ops);
  79. /**
  80. * wlan_register_spectral_tgt_ops() - Register Spectral target operations
  81. * @psoc - Pointer to psoc object
  82. * @tgt_ops - pointer to the structure holding the Spectral target
  83. * operations
  84. *
  85. * API to register Spectral target operations
  86. *
  87. * Return: QDF_STATUS
  88. */
  89. QDF_STATUS
  90. wlan_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc,
  91. struct spectral_tgt_ops *tgt_ops);
  92. /**
  93. * struct spectral_legacy_cbacks - Spectral legacy callbacks
  94. * @vdev_get_chan_freq: Get channel frequency
  95. * @vdev_get_chan_freq_seg2: Get secondary 80 center frequency
  96. * @vdev_get_ch_width: Get channel width
  97. * @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency
  98. */
  99. struct spectral_legacy_cbacks {
  100. int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
  101. int16_t (*vdev_get_chan_freq_seg2)(struct wlan_objmgr_vdev *vdev);
  102. enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev);
  103. int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev,
  104. uint16_t *sec20chan_freq);
  105. };
  106. /**
  107. * spectral_vdev_get_chan_freq - Get vdev channel frequency
  108. * @vdev: vdev object
  109. *
  110. * Return: vdev operating frequency
  111. */
  112. int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev);
  113. /**
  114. * spectral_vdev_get_chan_freq_seg2 - Get vdev's secondary 80 center frequency
  115. * @vdev: vdev object
  116. *
  117. * Return: vdev secondary 80 center frequency
  118. */
  119. int16_t spectral_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev);
  120. /**
  121. * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequency
  122. * @vdev: vdev object
  123. * @sec20chan_freq: secondary channel frequency
  124. *
  125. * Return: secondary channel freq
  126. */
  127. int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
  128. uint16_t *sec20chan_freq);
  129. /**
  130. * spectral_register_legacy_cb() - Register spectral legacy callbacks
  131. * commands on spectral parameters
  132. * @psoc - the physical device object
  133. * @legacy_cbacks - Reference to struct spectral_legacy_cbacks from which
  134. * function pointers need to be copied
  135. *
  136. * API to register spectral related legacy callbacks
  137. *
  138. * Return: QDF_STATUS_SUCCESS upon successful registration,
  139. * QDF_STATUS_E_FAILURE upon failure
  140. */
  141. QDF_STATUS spectral_register_legacy_cb(
  142. struct wlan_objmgr_psoc *psoc,
  143. struct spectral_legacy_cbacks *legacy_cbacks);
  144. /**
  145. * spectral_vdev_get_ch_width() - Get the channel bandwidth
  146. * @vdev - Pointer to vdev
  147. *
  148. * API to get the channel bandwidth of a given vdev
  149. *
  150. * Return: Enumeration corresponding to the channel bandwidth
  151. */
  152. enum phy_ch_width
  153. spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev);
  154. /**
  155. * spectral_pdev_open() - Spectral pdev open handler
  156. * @pdev: pointer to pdev object
  157. *
  158. * API to execute operations on pdev open
  159. *
  160. * Return: QDF_STATUS_SUCCESS upon successful registration,
  161. * QDF_STATUS_E_FAILURE upon failure
  162. */
  163. QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev);
  164. /**
  165. * wlan_spectral_psoc_open() - Spectral psoc open handler
  166. * @psoc: pointer to psoc object
  167. *
  168. * API to execute operations on psoc open
  169. *
  170. * Return: QDF_STATUS_SUCCESS upon successful registration,
  171. * QDF_STATUS_E_FAILURE upon failure
  172. */
  173. QDF_STATUS wlan_spectral_psoc_open(struct wlan_objmgr_psoc *psoc);
  174. /**
  175. * wlan_spectral_psoc_close() - Spectral psoc close handler
  176. * @psoc: pointer to psoc object
  177. *
  178. * API to execute operations on psoc close
  179. *
  180. * Return: QDF_STATUS_SUCCESS upon successful registration,
  181. * QDF_STATUS_E_FAILURE upon failure
  182. */
  183. QDF_STATUS wlan_spectral_psoc_close(struct wlan_objmgr_psoc *psoc);
  184. /**
  185. * wlan_spectral_psoc_enable() - Spectral psoc enable handler
  186. * @psoc: pointer to psoc object
  187. *
  188. * API to execute operations on psoc enable
  189. *
  190. * Return: QDF_STATUS_SUCCESS upon successful registration,
  191. * QDF_STATUS_E_FAILURE upon failure
  192. */
  193. QDF_STATUS wlan_spectral_psoc_enable(struct wlan_objmgr_psoc *psoc);
  194. /**
  195. * wlan_spectral_psoc_disable() - Spectral psoc disable handler
  196. * @psoc: pointer to psoc object
  197. *
  198. * API to execute operations on psoc disable
  199. *
  200. * Return: QDF_STATUS_SUCCESS upon successful registration,
  201. * QDF_STATUS_E_FAILURE upon failure
  202. */
  203. QDF_STATUS wlan_spectral_psoc_disable(struct wlan_objmgr_psoc *psoc);
  204. /**
  205. * spectral_register_dbr() - register Spectral event handler with DDMA
  206. * @pdev: pointer to pdev object
  207. *
  208. * API to register event handler with Direct DMA
  209. *
  210. * Return: QDF_STATUS_SUCCESS upon successful registration,
  211. * QDF_STATUS_E_FAILURE upon failure
  212. */
  213. QDF_STATUS spectral_register_dbr(struct wlan_objmgr_pdev *pdev);
  214. /**
  215. * spectral_unregister_dbr() - unregister Spectral event handler with DDMA
  216. * @pdev: pointer to pdev object
  217. *
  218. * API to unregister event handler with Direct DMA
  219. *
  220. * Return: QDF_STATUS_SUCCESS upon successful unregistration,
  221. * QDF_STATUS_E_FAILURE upon failure
  222. */
  223. QDF_STATUS spectral_unregister_dbr(struct wlan_objmgr_pdev *pdev);
  224. #ifdef DIRECT_BUF_RX_ENABLE
  225. /**
  226. * spectral_dbr_event_handler() - Spectral dbr event handler
  227. * @pdev: pointer to pdev object
  228. * @payload: dbr event buffer
  229. *
  230. * API to handle spectral dbr event
  231. *
  232. * Return: true to release buf
  233. */
  234. bool spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev,
  235. struct direct_buf_rx_data *payload);
  236. #endif
  237. #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/