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