wlan_spectral_utils_api.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. /*
  2. * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  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. #ifdef WLAN_CONV_SPECTRAL_ENABLE
  22. #include <wlan_objmgr_cmn.h>
  23. #include <wlan_lmac_if_def.h>
  24. /* Forward declaration */
  25. struct direct_buf_rx_data;
  26. struct spectral_wmi_ops;
  27. struct spectral_tgt_ops;
  28. /**
  29. * wlan_spectral_is_feature_disabled_pdev() - Check if spectral feature
  30. * is disabled for a given pdev
  31. * @pdev: pointer to pdev
  32. *
  33. * Return : true if spectral is disabled, else false.
  34. */
  35. bool wlan_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev);
  36. /**
  37. * wlan_spectral_is_feature_disabled_ini() - Check if spectral feature
  38. * is disabled in INI
  39. * @psoc: pointer to psoc
  40. *
  41. * Return : true if spectral is disabled, else false.
  42. */
  43. bool wlan_spectral_is_feature_disabled_ini(struct wlan_objmgr_psoc *psoc);
  44. /**
  45. * wlan_spectral_is_feature_disabled_psoc() - Check if spectral feature
  46. * is disabled for a given psoc
  47. * @psoc: pointer to psoc
  48. *
  49. * Return : true if spectral is disabled, else false.
  50. */
  51. bool wlan_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc);
  52. /**
  53. * wlan_spectral_is_mode_disabled_pdev() - Check if a given spectral mode
  54. * is disabled for a given pdev
  55. * @pdev: pointer to pdev
  56. * @smode: spectral scan mode
  57. *
  58. * Return : true if spectral mode is disabled, else false.
  59. */
  60. bool wlan_spectral_is_mode_disabled_pdev(struct wlan_objmgr_pdev *pdev,
  61. enum spectral_scan_mode smode);
  62. /**
  63. * wlan_spectral_init() - API to init spectral component
  64. *
  65. * This API is invoked from dispatcher init during all component init.
  66. * This API will register all required handlers for pdev and peer object
  67. * create/delete notification.
  68. *
  69. * Return: SUCCESS,
  70. * Failure
  71. */
  72. QDF_STATUS wlan_spectral_init(void);
  73. /**
  74. * wlan_spectral_deinit() - API to deinit spectral component
  75. *
  76. * This API is invoked from dispatcher deinit during all component deinit.
  77. * This API will unregister all registered handlers for pdev and peer object
  78. * create/delete notification.
  79. *
  80. * Return: SUCCESS,
  81. * Failure
  82. */
  83. QDF_STATUS wlan_spectral_deinit(void);
  84. /**
  85. * wlan_lmac_if_sptrl_register_rx_ops() - Register lmac interface Rx operations
  86. * @rx_ops: Pointer to lmac interface Rx operations structure
  87. *
  88. * API to register spectral related lmac interface Rx operations
  89. *
  90. * Return: None
  91. */
  92. void
  93. wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops);
  94. /**
  95. * wlan_register_spectral_wmi_ops() - Register Spectral WMI operations
  96. * @psoc: Pointer to psoc object
  97. * @wmi_ops: pointer to the structure holding the Spectral WMI
  98. * operations
  99. *
  100. * API to register Spectral WMI operations
  101. *
  102. * Return: QDF_STATUS
  103. */
  104. QDF_STATUS
  105. wlan_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc,
  106. struct spectral_wmi_ops *wmi_ops);
  107. /**
  108. * wlan_register_spectral_tgt_ops() - Register Spectral target operations
  109. * @psoc: Pointer to psoc object
  110. * @tgt_ops: pointer to the structure holding the Spectral target
  111. * operations
  112. *
  113. * API to register Spectral target operations
  114. *
  115. * Return: QDF_STATUS
  116. */
  117. QDF_STATUS
  118. wlan_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc,
  119. struct spectral_tgt_ops *tgt_ops);
  120. /**
  121. * struct spectral_legacy_cbacks - Spectral legacy callbacks
  122. * @vdev_get_chan_freq: Get channel frequency
  123. * @vdev_get_chan_freq_seg2: Get secondary 80 center frequency
  124. * @vdev_get_ch_width: Get channel width
  125. * @vdev_get_sec20chan_freq_mhz: Get secondary 20 frequency
  126. */
  127. struct spectral_legacy_cbacks {
  128. int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
  129. int16_t (*vdev_get_chan_freq_seg2)(struct wlan_objmgr_vdev *vdev);
  130. enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev);
  131. int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev,
  132. uint16_t *sec20chan_freq);
  133. };
  134. /**
  135. * spectral_vdev_get_chan_freq() - Get vdev channel frequency
  136. * @vdev: vdev object
  137. *
  138. * Return: vdev operating frequency
  139. */
  140. int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev);
  141. /**
  142. * spectral_vdev_get_chan_freq_seg2() - Get vdev's secondary 80 center frequency
  143. * @vdev: vdev object
  144. *
  145. * Return: vdev secondary 80 center frequency
  146. */
  147. int16_t spectral_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev);
  148. /**
  149. * spectral_vdev_get_sec20chan_freq_mhz() - Get vdev secondary channel frequency
  150. * @vdev: vdev object
  151. * @sec20chan_freq: secondary channel frequency
  152. *
  153. * Return: secondary channel freq
  154. */
  155. int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
  156. uint16_t *sec20chan_freq);
  157. /**
  158. * spectral_register_legacy_cb() - Register spectral legacy callbacks
  159. * commands on spectral parameters
  160. * @psoc: the physical device object
  161. * @legacy_cbacks: Reference to struct spectral_legacy_cbacks from which
  162. * function pointers need to be copied
  163. *
  164. * API to register spectral related legacy callbacks
  165. *
  166. * Return: QDF_STATUS_SUCCESS upon successful registration,
  167. * QDF_STATUS_E_FAILURE upon failure
  168. */
  169. QDF_STATUS spectral_register_legacy_cb(
  170. struct wlan_objmgr_psoc *psoc,
  171. struct spectral_legacy_cbacks *legacy_cbacks);
  172. /**
  173. * spectral_vdev_get_ch_width() - Get the channel bandwidth
  174. * @vdev: Pointer to vdev
  175. *
  176. * API to get the channel bandwidth of a given vdev
  177. *
  178. * Return: Enumeration corresponding to the channel bandwidth
  179. */
  180. enum phy_ch_width
  181. spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev);
  182. /**
  183. * spectral_pdev_open() - Spectral pdev open handler
  184. * @pdev: pointer to pdev object
  185. *
  186. * API to execute operations on pdev open
  187. *
  188. * Return: QDF_STATUS_SUCCESS upon successful registration,
  189. * QDF_STATUS_E_FAILURE upon failure
  190. */
  191. QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev);
  192. /**
  193. * wlan_spectral_psoc_open() - Spectral psoc open handler
  194. * @psoc: pointer to psoc object
  195. *
  196. * API to execute operations on psoc open
  197. *
  198. * Return: QDF_STATUS_SUCCESS upon successful registration,
  199. * QDF_STATUS_E_FAILURE upon failure
  200. */
  201. QDF_STATUS wlan_spectral_psoc_open(struct wlan_objmgr_psoc *psoc);
  202. /**
  203. * wlan_spectral_psoc_close() - Spectral psoc close handler
  204. * @psoc: pointer to psoc object
  205. *
  206. * API to execute operations on psoc close
  207. *
  208. * Return: QDF_STATUS_SUCCESS upon successful registration,
  209. * QDF_STATUS_E_FAILURE upon failure
  210. */
  211. QDF_STATUS wlan_spectral_psoc_close(struct wlan_objmgr_psoc *psoc);
  212. /**
  213. * wlan_spectral_psoc_enable() - Spectral psoc enable handler
  214. * @psoc: pointer to psoc object
  215. *
  216. * API to execute operations on psoc enable
  217. *
  218. * Return: QDF_STATUS_SUCCESS upon successful registration,
  219. * QDF_STATUS_E_FAILURE upon failure
  220. */
  221. QDF_STATUS wlan_spectral_psoc_enable(struct wlan_objmgr_psoc *psoc);
  222. /**
  223. * wlan_spectral_psoc_disable() - Spectral psoc disable handler
  224. * @psoc: pointer to psoc object
  225. *
  226. * API to execute operations on psoc disable
  227. *
  228. * Return: QDF_STATUS_SUCCESS upon successful registration,
  229. * QDF_STATUS_E_FAILURE upon failure
  230. */
  231. QDF_STATUS wlan_spectral_psoc_disable(struct wlan_objmgr_psoc *psoc);
  232. /**
  233. * spectral_register_dbr() - register Spectral event handler with DDMA
  234. * @pdev: pointer to pdev object
  235. *
  236. * API to register event handler with Direct DMA
  237. *
  238. * Return: QDF_STATUS_SUCCESS upon successful registration,
  239. * QDF_STATUS_E_FAILURE upon failure
  240. */
  241. QDF_STATUS spectral_register_dbr(struct wlan_objmgr_pdev *pdev);
  242. /**
  243. * spectral_unregister_dbr() - unregister Spectral event handler with DDMA
  244. * @pdev: pointer to pdev object
  245. *
  246. * API to unregister event handler with Direct DMA
  247. *
  248. * Return: QDF_STATUS_SUCCESS upon successful unregistration,
  249. * QDF_STATUS_E_FAILURE upon failure
  250. */
  251. QDF_STATUS spectral_unregister_dbr(struct wlan_objmgr_pdev *pdev);
  252. /**
  253. * wlan_spectral_init_pdev_feature_caps() - API to initialize
  254. * spectral pdev feature caps
  255. * @pdev: pointer to pdev object
  256. *
  257. * API to initialize Spectral feature caps for a given pdev.
  258. *
  259. * Return: QDF_STATUS_SUCCESS upon successful initialization,
  260. * QDF_STATUS_E_FAILURE upon failure
  261. */
  262. QDF_STATUS wlan_spectral_init_pdev_feature_caps(struct wlan_objmgr_pdev *pdev);
  263. /**
  264. * wlan_spectral_init_psoc_feature_cap() - API to initialize
  265. * spectral psoc feature caps
  266. * @psoc: pointer to psoc object
  267. *
  268. * API to initialize Spectral feature caps for a given psoc.
  269. *
  270. * Return: QDF_STATUS_SUCCESS upon successful initialization,
  271. * QDF_STATUS_E_FAILURE upon failure
  272. */
  273. QDF_STATUS wlan_spectral_init_psoc_feature_cap(struct wlan_objmgr_psoc *psoc);
  274. /**
  275. * wlan_spectral_pdev_get_lmac_if_txops() - API to get pointer
  276. * to Spectral txops structure
  277. * @pdev: pointer to pdev object
  278. *
  279. * API to get pointer to Spectral txops structure
  280. *
  281. * Return: Pointer to Spectral txops structure, NULL in case of
  282. * error.
  283. */
  284. struct wlan_lmac_if_sptrl_tx_ops *
  285. wlan_spectral_pdev_get_lmac_if_txops(struct wlan_objmgr_pdev *pdev);
  286. #ifdef DIRECT_BUF_RX_ENABLE
  287. /**
  288. * spectral_dbr_event_handler() - Spectral dbr event handler
  289. * @pdev: pointer to pdev object
  290. * @payload: dbr event buffer
  291. *
  292. * API to handle spectral dbr event
  293. *
  294. * Return: true to release buf
  295. */
  296. bool spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev,
  297. struct direct_buf_rx_data *payload);
  298. #endif
  299. #endif /* WLAN_CONV_SPECTRAL_ENABLE */
  300. #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/