xref: /wlan-dirver/qca-wifi-host-cmn/os_if/linux/spectral/inc/wlan_cfg80211_spectral.h (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
1 /*
2  * Copyright (c) 2017, 2019-2020 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 extern const struct nla_policy
36 	spectral_scan_policy
37 	[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_MAX + 1];
38 
39 #define CONFIG_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_CONFIG))
42 
43 #define SCAN_REQUESTED(type)    ((type == \
44 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN_AND_CONFIG) || \
45 	(type == QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_SCAN))
46 
47 /**
48  * wlan_cfg80211_register_spectral_cmd_handler() - Registration api for spectral
49  * @pdev:    Pointer to pdev
50  * @idx:     Index in function table
51  * @handler: Pointer to handler
52  *
53  * Return: 0 on success, negative value on failure
54  */
55 void wlan_cfg80211_register_spectral_cmd_handler(struct wlan_objmgr_pdev *pdev,
56 						 int idx,
57 						 void *handler);
58 
59 /**
60  * wlan_cfg80211_spectral_scan_config_and_start() - Start spectral scan
61  * @wiphy:    Pointer to wiphy
62  * @pdev:     Pointer to pdev
63  * @data:     Reference to data
64  * @data_len: Length of @data
65  *
66  * Return: 0 on success, negative value on failure
67  */
68 int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
69 						 struct wlan_objmgr_pdev *pdev,
70 						 const void *data,
71 						 int data_len);
72 
73 /**
74  * wlan_cfg80211_spectral_scan_stop() - Stop spectral scan
75  * @wiphy:    Pointer to wiphy
76  * @pdev:     Pointer to pdev
77  * @data:     Reference to data
78  * @data_len: Length of @data
79  *
80  * Return: 0 on success, negative value on failure
81  */
82 int wlan_cfg80211_spectral_scan_stop(struct wiphy *wiphy,
83 				     struct wlan_objmgr_pdev *pdev,
84 				     const void *data,
85 				     int data_len);
86 
87 /**
88  * wlan_cfg80211_spectral_scan_get_config() - Get spectral scan config
89  * @wiphy:    Pointer to wiphy
90  * @pdev:     Pointer to pdev
91  * @data:     Reference to data
92  * @data_len: Length of @data
93  *
94  * Return: 0 on success, negative value on failure
95  */
96 int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
97 					   struct wlan_objmgr_pdev *pdev,
98 					   const void *data,
99 					   int data_len);
100 
101 /**
102  * wlan_cfg80211_spectral_scan_get_cap() - Get spectral system capabilities
103  * @wiphy:    Pointer to wiphy
104  * @pdev:     Pointer to pdev
105  * @data:     Reference to data
106  * @data_len: Length of @data
107  *
108  * Return: 0 on success, negative value on failure
109  */
110 int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
111 					struct wlan_objmgr_pdev *pdev,
112 					const void *data,
113 					int data_len);
114 
115 /**
116  * wlan_cfg80211_spectral_scan_get_diag_stats() - Get spectral diag stats
117  * @wiphy:    Pointer to wiphy
118  * @pdev:     Pointer to pdev
119  * @data:     Reference to data
120  * @data_len: Length of @data
121  *
122  * Return: 0 on success, negative value on failure
123  */
124 int wlan_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy,
125 					       struct wlan_objmgr_pdev *pdev,
126 					       const void *data,
127 					       int data_len);
128 
129 /**
130  * wlan_cfg80211_spectral_scan_get_status() - Get spectral scan status
131  * @wiphy:    Pointer to wiphy
132  * @pdev:     Pointer to pdev
133  * @data:     Reference to data
134  * @data_len: Length of @data
135  *
136  * Return: 0 on success, negative value on failure
137  */
138 int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
139 					   struct wlan_objmgr_pdev *pdev,
140 					   const void *data,
141 					   int data_len);
142 
143 /**
144  * wlan_cfg80211_spectral_scan_dma_debug_config() - configure DMA debug
145  * @pdev:       Pointer to pdev
146  * @tb:         Pointer to Spectral Scan config attribute
147  * @sscan_mode: Spectral scan mode
148  *
149  * Return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
150  */
151 QDF_STATUS wlan_cfg80211_spectral_scan_dma_debug_config(
152 		struct wlan_objmgr_pdev *pdev,
153 		struct nlattr **tb,
154 		enum spectral_scan_mode sscan_mode);
155 #endif
156