xref: /wlan-driver/qca-wifi-host-cmn/spectral/dispatcher/inc/wlan_spectral_tgt_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2020 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 
20 #ifndef _WLAN_SPECTRAL_TGT_API_H_
21 #define _WLAN_SPECTRAL_TGT_API_H_
22 
23 #include <wlan_objmgr_cmn.h>
24 #include <qdf_types.h>
25 #include "../../core/spectral_cmn_api_i.h"
26 
27 /**
28  * tgt_get_pdev_target_handle() - Get pdev target_if handle
29  * @pdev: Pointer to pdev
30  *
31  * Get handle to pdev target_if internal Spectral data
32  *
33  * Return: Handle to pdev target_if internal Spectral data on success, NULL on
34  * failure
35  */
36 void *tgt_get_pdev_target_handle(struct wlan_objmgr_pdev *pdev);
37 
38 /**
39  * tgt_get_psoc_target_handle() - Get psoc target_if handle
40  * @psoc: Pointer to psoc
41  *
42  * Get handle to psoc target_if internal Spectral data
43  *
44  * Return: Handle to psoc target_if internal Spectral data on success, NULL on
45  * failure
46  */
47 void *tgt_get_psoc_target_handle(struct wlan_objmgr_psoc *psoc);
48 
49 /**
50  * tgt_spectral_control()- handler for demultiplexing requests from higher layer
51  * @pdev: Reference to global pdev object
52  * @sscan_req: pointer to Spectral scan request
53  *
54  * This function processes the spectral config command
55  * and appropriate handlers are invoked.
56  *
57  * Return: QDF_STATUS_SUCCESS/QDF_STATUS_E_FAILURE
58  */
59 QDF_STATUS tgt_spectral_control(struct wlan_objmgr_pdev *pdev,
60 				struct spectral_cp_request *sscan_req);
61 
62 /**
63  * tgt_pdev_spectral_init() - implementation for spectral init
64  * @pdev: Pointer to pdev
65  *
66  * Return: On success, pointer to Spectral target_if internal private data, on
67  * failure, NULL
68  */
69 void *tgt_pdev_spectral_init(struct wlan_objmgr_pdev *pdev);
70 
71 /**
72  * tgt_pdev_spectral_deinit() - implementation for spectral de-init
73  * @pdev: Pointer to pdev
74  *
75  * Return: None
76  */
77 void tgt_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev);
78 
79 /**
80  * tgt_psoc_spectral_init() - implementation for spectral init
81  * @psoc: Pointer to psoc
82  *
83  * Return: On success, pointer to Spectral psoc target_if internal private data,
84  * on failure, NULL
85  */
86 void *tgt_psoc_spectral_init(struct wlan_objmgr_psoc *psoc);
87 
88 /**
89  * tgt_psoc_spectral_deinit() - implementation for spectral de-init
90  * @psoc: Pointer to psoc
91  *
92  * Return: None
93  */
94 void tgt_psoc_spectral_deinit(struct wlan_objmgr_psoc *psoc);
95 
96 /**
97  * tgt_set_spectral_config() - Set spectral config
98  * @pdev: Pointer to pdev object
99  * @param: Pointer object describing Spectral parameter
100  * @smode: Spectral scan mode
101  * @err: Spectral control path error code
102  *
103  * Implementation for setting spectral config
104  *
105  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
106  */
107 QDF_STATUS tgt_set_spectral_config(struct wlan_objmgr_pdev *pdev,
108 				   const struct spectral_cp_param *param,
109 				   const enum spectral_scan_mode smode,
110 				   enum spectral_cp_error_code *err);
111 
112 /**
113  * tgt_get_spectral_config() - Get spectral configuration
114  * @pdev: Pointer to pdev object
115  * @sptrl_config: Pointer to spectral_config structure in which the
116  *                configuration should be returned
117  * @smode: Spectral scan mode
118  *
119  * Implementation for getting the current spectral configuration
120  *
121  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
122  */
123 QDF_STATUS tgt_get_spectral_config(struct wlan_objmgr_pdev *pdev,
124 				   struct spectral_config *sptrl_config,
125 				   const enum spectral_scan_mode smode);
126 
127 /**
128  * tgt_start_spectral_scan() - Start spectral scan
129  * @pdev: Pointer to pdev object
130  * @vdev_id: VDEV id
131  * @smode: Spectral scan mode
132  * @err: Spectral control path error code
133  *
134  * Implementation for starting spectral scan
135  *
136  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
137  */
138 QDF_STATUS tgt_start_spectral_scan(struct wlan_objmgr_pdev *pdev,
139 				   uint8_t vdev_id,
140 				   enum spectral_scan_mode smode,
141 				   enum spectral_cp_error_code *err);
142 
143 /**
144  * tgt_stop_spectral_scan() - Stop spectral scan
145  * @pdev: Pointer to pdev object
146  * @smode: Spectral scan mode
147  * @err: Spectral control path error code
148  *
149  * Implementation for stop spectral scan
150  *
151  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
152  */
153 QDF_STATUS tgt_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
154 				  enum spectral_scan_mode smode,
155 				  enum spectral_cp_error_code *err);
156 
157 /**
158  * tgt_is_spectral_active() - Get whether Spectral is active
159  * @pdev: Pointer to pdev object
160  * @smode: Spectral scan mode
161  *
162  * Implementation to get whether Spectral is active
163  *
164  * Return: True if Spectral is active, false if Spectral is not active
165  */
166 bool tgt_is_spectral_active(struct wlan_objmgr_pdev *pdev,
167 			    enum spectral_scan_mode smode);
168 
169 /**
170  * tgt_is_spectral_enabled() - Get whether Spectral is active
171  * @pdev: Pointer to pdev object
172  * @smode: Spectral scan mode
173  *
174  * Implementation to get whether Spectral is active
175  *
176  * Return: True if Spectral is active, false if Spectral is not active
177  */
178 bool tgt_is_spectral_enabled(struct wlan_objmgr_pdev *pdev,
179 			     enum spectral_scan_mode smode);
180 
181 /**
182  * tgt_set_debug_level() - Set debug level for Spectral
183  * @pdev: Pointer to pdev object
184  * @debug_level: Debug level
185  *
186  * Implementation to set the debug level for Spectral
187  *
188  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
189  */
190 QDF_STATUS tgt_set_debug_level(struct wlan_objmgr_pdev *pdev,
191 			       u_int32_t debug_level);
192 
193 /**
194  * tgt_get_debug_level() - Get debug level for Spectral
195  * @pdev: Pointer to pdev object
196  *
197  * Implementation to get the debug level for Spectral
198  *
199  * Return: Current debug level
200  */
201 uint32_t tgt_get_debug_level(struct wlan_objmgr_pdev *pdev);
202 
203 /**
204  * tgt_get_spectral_capinfo() - Get Spectral capability information
205  * @pdev: Pointer to pdev object
206  * @scaps: Buffer into which data should be copied
207  *
208  * Implementation to get the spectral capability information
209  *
210  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
211  */
212 QDF_STATUS tgt_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev,
213 				    struct spectral_caps *scaps);
214 
215 /**
216  * tgt_get_spectral_diagstats() - Get Spectral diagnostic statistics
217  * @pdev:  Pointer to pdev object
218  * @stats: Buffer into which data should be copied
219  *
220  * Implementation to get the spectral diagnostic statistics
221  *
222  * Return: QDF_STATUS_SUCCESS on success, else QDF_STATUS_E_FAILURE
223  */
224 QDF_STATUS tgt_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev,
225 				      struct spectral_diag_stats *stats);
226 
227 /**
228  * tgt_register_spectral_wmi_ops() - Register Spectral WMI operations
229  * @psoc: Pointer to psoc object
230  * @wmi_ops: Pointer to the structure having Spectral WMI operations
231  *
232  * Implementation to register Spectral WMI operations in spectral
233  * internal data structure
234  *
235  * Return: QDF_STATUS
236  */
237 QDF_STATUS tgt_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc,
238 					 struct spectral_wmi_ops *wmi_ops);
239 
240 /**
241  * tgt_register_spectral_tgt_ops() - Register Spectral target operations
242  * @psoc: Pointer to psoc object
243  * @tgt_ops: Pointer to the structure having Spectral target operations
244  *
245  * Implementation to register Spectral target operations in spectral
246  * internal data structure
247  *
248  * Return: QDF_STATUS
249  */
250 QDF_STATUS tgt_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc,
251 					 struct spectral_tgt_ops *tgt_ops);
252 
253 /**
254  * tgt_spectral_register_nl_cb() - Register Netlink callbacks
255  * @pdev: Pointer to pdev object
256  * @nl_cb: Netlink callbacks to register
257  *
258  * Return: void
259  */
260 void tgt_spectral_register_nl_cb(struct wlan_objmgr_pdev *pdev,
261 				 struct spectral_nl_cb *nl_cb);
262 
263 /**
264  * tgt_spectral_use_nl_bcast() - Get whether to use broadcast/unicast while
265  * sending Netlink messages to the application layer
266  * @pdev: Pointer to pdev object
267  *
268  * Return: true for broadcast, false for unicast
269  */
270 bool tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev);
271 
272 /**
273  * tgt_spectral_deregister_nl_cb() - De-register Netlink callbacks
274  * @pdev: Pointer to pdev object
275  *
276  * Return: void
277  */
278 void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev);
279 
280 /**
281  * tgt_spectral_process_report() - Process spectral report
282  * @pdev: Pointer to pdev object
283  * @payload: Pointer to spectral report buffer
284  *
285  * Return: status
286  */
287 int
288 tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev,
289 			    void *payload);
290 
291 /**
292  * tgt_spectral_register_to_dbr() - Register to direct DMA
293  * @pdev: Pointer to pdev object
294  *
295  * Return: QDF_STATUS
296  */
297 QDF_STATUS
298 tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev);
299 
300 /**
301  * tgt_spectral_unregister_to_dbr() - Register to direct DMA
302  * @pdev: Pointer to pdev object
303  *
304  * Return: QDF_STATUS
305  */
306 QDF_STATUS
307 tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev);
308 
309 /**
310  * tgt_spectral_get_target_type() - Get target type
311  * @psoc: Pointer to psoc object
312  *
313  * Return: target type
314  */
315 uint32_t
316 tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc);
317 
318 /**
319  * tgt_set_spectral_dma_debug() - Set DMA debug for Spectral
320  * @pdev: Pointer to pdev object
321  * @dma_debug_type: Type of Spectral DMA debug i.e., ring or buffer debug
322  * @dma_debug_enable: Value to be set for @dma_debug_type
323  *
324  * Return: QDF_STATUS of operation
325  */
326 QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev,
327 				      enum spectral_dma_debug dma_debug_type,
328 				      bool dma_debug_enable);
329 
330 /**
331  * tgt_spectral_register_events() - Register Spectral WMI event handlers
332  * @psoc: Pointer to psoc object
333  *
334  * Return: QDF_STATUS of operation
335  */
336 QDF_STATUS
337 tgt_spectral_register_events(struct wlan_objmgr_psoc *psoc);
338 
339 /**
340  * tgt_spectral_unregister_events() - Unregister Spectral WMI event handlers
341  * @psoc: Pointer to psoc object
342  *
343  * Return: QDF_STATUS of operation
344  */
345 QDF_STATUS
346 tgt_spectral_unregister_events(struct wlan_objmgr_psoc *psoc);
347 
348 /**
349  * tgt_spectral_init_pdev_feature_caps() - Init pdev spectral feature caps
350  * @pdev: pdev handle
351  *
352  * Return: QDF_STATUS
353  */
354 QDF_STATUS
355 tgt_spectral_init_pdev_feature_caps(struct wlan_objmgr_pdev *pdev);
356 #endif /* _WLAN_SPECTRAL_TGT_API_H_ */
357