xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: declares driver functions interfacing with linux kernel
21  */
22 
23 #ifndef _WLAN_CFG80211_SPECTRAL_H_
24 #define _WLAN_CFG80211_SPECTRAL_H_
25 
26 #include <linux/version.h>
27 #include <linux/netdevice.h>
28 #include <net/cfg80211.h>
29 #include <qca_vendor.h>
30 #include <qdf_list.h>
31 #include <qdf_types.h>
32 #include <spectral_ioctl.h>
33 #include <wlan_spectral_public_structs.h>
34 
35 #define CONFIG_REQUESTED(type)    ((type == \
36 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
37 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_CONFIG))
38 
39 #define SCAN_REQUESTED(type)    ((type == \
40 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
41 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN))
42 
43 /**
44  * wlan_cfg80211_register_spectral_cmd_handler() - Registration api for spectral
45  * @pdev:    Pointer to pdev
46  * @idx:     Index in function table
47  * @handler: Pointer to handler
48  *
49  * Return: 0 on success, negative value on failure
50  */
51 void wlan_cfg80211_register_spectral_cmd_handler(struct wlan_objmgr_pdev *pdev,
52 						 int idx,
53 						 void *handler);
54 
55 /**
56  * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan
57  * @wiphy:    Pointer to wiphy
58  * @pdev:     Pointer to pdev
59  * @data:     Reference to data
60  * @data_len: Length of @data
61  *
62  * Return: 0 on success, negative value on failure
63  */
64 int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
65 						 struct wlan_objmgr_pdev *pdev,
66 						 const void *data,
67 						 int data_len);
68 
69 /**
70  * wlan_cfg80211_spectral_scan_stop() - Stop spectral scan
71  * @wiphy:    Pointer to wiphy
72  * @pdev:     Pointer to pdev
73  * @data:     Reference to data
74  * @data_len: Length of @data
75  *
76  * Return: 0 on success, negative value on failure
77  */
78 int wlan_cfg80211_spectral_scan_stop(struct wiphy *wiphy,
79 				     struct wlan_objmgr_pdev *pdev,
80 				     const void *data,
81 				     int data_len);
82 
83 /**
84  * wlan_cfg80211_spectral_scan_get_config() - Get spectral scan config
85  * @wiphy:    Pointer to wiphy
86  * @pdev:     Pointer to pdev
87  * @data:     Reference to data
88  * @data_len: Length of @data
89  *
90  * Return: 0 on success, negative value on failure
91  */
92 int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
93 					   struct wlan_objmgr_pdev *pdev,
94 					   const void *data,
95 					   int data_len);
96 
97 /**
98  * wlan_cfg80211_spectral_scan_get_cap() - Get spectral system capabilities
99  * @wiphy:    Pointer to wiphy
100  * @pdev:     Pointer to pdev
101  * @data:     Reference to data
102  * @data_len: Length of @data
103  *
104  * Return: 0 on success, negative value on failure
105  */
106 int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
107 					struct wlan_objmgr_pdev *pdev,
108 					const void *data,
109 					int data_len);
110 
111 /**
112  * wlan_cfg80211_spectral_scan_get_diag_stats() - Get spectral diag stats
113  * @wiphy:    Pointer to wiphy
114  * @pdev:     Pointer to pdev
115  * @data:     Reference to data
116  * @data_len: Length of @data
117  *
118  * Return: 0 on success, negative value on failure
119  */
120 int wlan_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy,
121 					       struct wlan_objmgr_pdev *pdev,
122 					       const void *data,
123 					       int data_len);
124 
125 /**
126  * wlan_cfg80211_spectral_scan_get_status() - Get spectral scan status
127  * @wiphy:    Pointer to wiphy
128  * @pdev:     Pointer to pdev
129  * @data:     Reference to data
130  * @data_len: Length of @data
131  *
132  * Return: 0 on success, negative value on failure
133  */
134 int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
135 					   struct wlan_objmgr_pdev *pdev,
136 					   const void *data,
137 					   int data_len);
138 
139 /**
140  * wlan_cfg80211_spectral_scan_dma_debug_config() - configure DMA debug
141  * @pdev:       Pointer to pdev
142  * @tb:         Pointer to Spectral Scan config attribute
143  * @sscan_mode: Spectral scan mode
144  *
145  * Return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
146  */
147 QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
148 		struct wlan_objmgr_pdev *pdev,
149 		struct nlattr **tb,
150 		enum spectral_scan_mode sscan_mode);
151 #endif
152