wlan_spectral_tgt_api.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /*
  2. * Copyright (c) 2017-2019 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_TGT_API_H_
  20. #define _WLAN_SPECTRAL_TGT_API_H_
  21. #include <wlan_objmgr_cmn.h>
  22. #include <qdf_types.h>
  23. #include "../../core/spectral_cmn_api_i.h"
  24. /**
  25. * tgt_get_target_handle() - Get target_if handle
  26. * @pdev: Pointer to pdev
  27. *
  28. * Get handle to target_if internal Spectral data
  29. *
  30. * Return: Handle to target_if internal Spectral data on success, NULL on
  31. * failure
  32. */
  33. void *tgt_get_target_handle(struct wlan_objmgr_pdev *pdev);
  34. /**
  35. * tgt_spectral_control()- handler for demultiplexing requests from higher layer
  36. * @pdev: Reference to global pdev object
  37. * @sscan_req: pointer to Spectral scan request
  38. *
  39. * This function processes the spectral config command
  40. * and appropriate handlers are invoked.
  41. *
  42. * Return: QDF_STATUS_SUCCESS/QDF_STATUS_E_FAILURE
  43. */
  44. QDF_STATUS tgt_spectral_control(struct wlan_objmgr_pdev *pdev,
  45. struct spectral_cp_request *sscan_req);
  46. /**
  47. * tgt_pdev_spectral_init() - implementation for spectral init
  48. * @pdev: Pointer to pdev
  49. *
  50. * Return: On success, pointer to Spectral target_if internal private data, on
  51. * failure, NULL
  52. */
  53. void *tgt_pdev_spectral_init(struct wlan_objmgr_pdev *pdev);
  54. /**
  55. * tgt_pdev_spectral_deinit() - implementation for spectral de-init
  56. * @pdev: Pointer to pdev
  57. *
  58. * Return: None
  59. */
  60. void tgt_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev);
  61. /**
  62. * tgt_set_spectral_config() - Set spectral config
  63. * @pdev: Pointer to pdev object
  64. * @threshtype: spectral parameter type
  65. * @value: Value to be configured for the given spectral parameter
  66. * @smode: Spectral scan mode
  67. * @err: Spectral control path error code
  68. *
  69. * Implementation for setting spectral config
  70. *
  71. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  72. */
  73. QDF_STATUS tgt_set_spectral_config(struct wlan_objmgr_pdev *pdev,
  74. const u_int32_t threshtype,
  75. const u_int32_t value,
  76. const enum spectral_scan_mode smode,
  77. enum spectral_cp_error_code *err);
  78. /**
  79. * tgt_get_spectral_config() - Get spectral configuration
  80. * @pdev: Pointer to pdev object
  81. * @param: Pointer to spectral_config structure in which the configuration
  82. * should be returned
  83. * @smode: Spectral scan mode
  84. *
  85. * Implementation for getting the current spectral configuration
  86. *
  87. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  88. */
  89. QDF_STATUS tgt_get_spectral_config(struct wlan_objmgr_pdev *pdev,
  90. struct spectral_config *sptrl_config,
  91. const enum spectral_scan_mode smode);
  92. /**
  93. * tgt_start_spectral_scan() - Start spectral scan
  94. * @pdev: Pointer to pdev object
  95. * @smode: Spectral scan mode
  96. * @err: Spectral control path error code
  97. *
  98. * Implementation for starting spectral scan
  99. *
  100. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  101. */
  102. QDF_STATUS tgt_start_spectral_scan(struct wlan_objmgr_pdev *pdev,
  103. enum spectral_scan_mode smode,
  104. enum spectral_cp_error_code *err);
  105. /**
  106. * tgt_stop_spectral_scan() - Stop spectral scan
  107. * @pdev: Pointer to pdev object
  108. * @smode: Spectral scan mode
  109. * @err: Spectral control path error code
  110. *
  111. * Implementation for stop spectral scan
  112. *
  113. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  114. */
  115. QDF_STATUS tgt_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
  116. enum spectral_scan_mode smode,
  117. enum spectral_cp_error_code *err);
  118. /**
  119. * tgt_is_spectral_active() - Get whether Spectral is active
  120. * @pdev: Pointer to pdev object
  121. * @smode: Spectral scan mode
  122. *
  123. * Implementation to get whether Spectral is active
  124. *
  125. * Return: True if Spectral is active, false if Spectral is not active
  126. */
  127. bool tgt_is_spectral_active(struct wlan_objmgr_pdev *pdev,
  128. enum spectral_scan_mode smode);
  129. /**
  130. * tgt_is_spectral_enabled() - Get whether Spectral is active
  131. * @pdev: Pointer to pdev object
  132. * @smode: Spectral scan mode
  133. *
  134. * Implementation to get whether Spectral is active
  135. *
  136. * Return: True if Spectral is active, false if Spectral is not active
  137. */
  138. bool tgt_is_spectral_enabled(struct wlan_objmgr_pdev *pdev,
  139. enum spectral_scan_mode smode);
  140. /**
  141. * tgt_set_debug_level() - Set debug level for Spectral
  142. * @pdev: Pointer to pdev object
  143. * @debug_level: Debug level
  144. *
  145. * Implementation to set the debug level for Spectral
  146. *
  147. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  148. */
  149. QDF_STATUS tgt_set_debug_level(struct wlan_objmgr_pdev *pdev,
  150. u_int32_t debug_level);
  151. /**
  152. * tgt_get_debug_level() - Get debug level for Spectral
  153. * @pdev: Pointer to pdev object
  154. *
  155. * Implementation to get the debug level for Spectral
  156. *
  157. * Return: Current debug level
  158. */
  159. uint32_t tgt_get_debug_level(struct wlan_objmgr_pdev *pdev);
  160. /**
  161. * tgt_get_spectral_capinfo() - Get Spectral capability information
  162. * @pdev: Pointer to pdev object
  163. * @scaps: Buffer into which data should be copied
  164. *
  165. * Implementation to get the spectral capability information
  166. *
  167. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  168. */
  169. QDF_STATUS tgt_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev,
  170. struct spectral_caps *scaps);
  171. /**
  172. * tgt_get_spectral_diagstats() - Get Spectral diagnostic statistics
  173. * @pdev: Pointer to pdev object
  174. * @stats: Buffer into which data should be copied
  175. *
  176. * Implementation to get the spectral diagnostic statistics
  177. *
  178. * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
  179. */
  180. QDF_STATUS tgt_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev,
  181. struct spectral_diag_stats *stats);
  182. /**
  183. * tgt_register_wmi_spectral_cmd_ops() - Register wmi_spectral_cmd_ops
  184. * @cmd_ops: Pointer to the structure having wmi_spectral_cmd function pointers
  185. * @pdev: Pointer to pdev object
  186. *
  187. * Implementation to register wmi_spectral_cmd_ops in spectral
  188. * internal data structure
  189. *
  190. * Return: void
  191. */
  192. void tgt_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev,
  193. struct wmi_spectral_cmd_ops *cmd_ops);
  194. /**
  195. * tgt_spectral_register_nl_cb() - Register Netlink callbacks
  196. * @pdev: Pointer to pdev object
  197. * @nl_cb: Netlink callbacks to register
  198. *
  199. * Return: void
  200. */
  201. void tgt_spectral_register_nl_cb(struct wlan_objmgr_pdev *pdev,
  202. struct spectral_nl_cb *nl_cb);
  203. /**
  204. * tgt_spectral_use_nl_bcast() - Get whether to use broadcast/unicast while
  205. * sending Netlink messages to the application layer
  206. * @pdev: Pointer to pdev object
  207. *
  208. * Return: true for broadcast, false for unicast
  209. */
  210. bool tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev);
  211. /**
  212. * tgt_spectral_deregister_nl_cb() - De-register Netlink callbacks
  213. * @pdev: Pointer to pdev object
  214. *
  215. * Return: void
  216. */
  217. void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev);
  218. /**
  219. * tgt_spectral_process_report() - Process spectral report
  220. * @pdev: Pointer to pdev object
  221. * @payload: Pointer to spectral report buffer
  222. *
  223. * Return: status
  224. */
  225. int
  226. tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev,
  227. void *payload);
  228. /**
  229. * tgt_spectral_register_to_dbr() - Register to direct DMA
  230. * @pdev: Pointer to pdev object
  231. *
  232. * Return: QDF_STATUS
  233. */
  234. QDF_STATUS
  235. tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev);
  236. /**
  237. * tgt_spectral_unregister_to_dbr() - Register to direct DMA
  238. * @pdev: Pointer to pdev object
  239. *
  240. * Return: QDF_STATUS
  241. */
  242. QDF_STATUS
  243. tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev);
  244. /**
  245. * tgt_spectral_get_target_type() - Get target type
  246. * @psoc: Pointer to psoc object
  247. *
  248. * Return: target type
  249. */
  250. uint32_t
  251. tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc);
  252. /**
  253. * tgt_set_spectral_dma_debug() - Set DMA debug for Spectral
  254. * @pdev: Pointer to pdev object
  255. * @dma_debug_type: Type of Spectral DMA debug i.e., ring or buffer debug
  256. * @dma_debug_enable: Value to be set for @dma_debug_type
  257. *
  258. * Return: QDF_STATUS of operation
  259. */
  260. QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev,
  261. enum spectral_dma_debug dma_debug_type,
  262. bool dma_debug_enable);
  263. #endif /* _WLAN_SPECTRAL_TGT_API_H_ */