Sandeep Puligilla | 00d2a1f | 2017-12-21 00:21:44 -0800 | [diff] [blame] | 1 | /* |
Sandeep Puligilla | 019a1bd | 2018-02-04 22:57:44 -0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. |
Sandeep Puligilla | 00d2a1f | 2017-12-21 00:21:44 -0800 | [diff] [blame] | 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 : wlan_hdd_spectralscan.h |
| 21 | * |
| 22 | * WLAN Host Device Driver spectral scan implementation |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #if !defined(WLAN_HDD_SPECTRALSCAN_H) |
| 27 | #define WLAN_HDD_SPECTRALSCAN_H |
| 28 | |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 29 | #ifdef WLAN_CONV_SPECTRAL_ENABLE |
Sandeep Puligilla | 019a1bd | 2018-02-04 22:57:44 -0800 | [diff] [blame] | 30 | /* |
| 31 | * enum spectral_scan_msg_type - spectral scan registration |
| 32 | * @SPECTRAL_SCAN_REGISTER_REQ: spectral scan app register request |
| 33 | * @SPECTRAL_SCAN_REGISTER_RSP: spectral scan app register response |
| 34 | */ |
| 35 | enum spectral_scan_msg_type { |
| 36 | SPECTRAL_SCAN_REGISTER_REQ, |
| 37 | SPECTRAL_SCAN_REGISTER_RSP, |
| 38 | }; |
| 39 | |
| 40 | /* |
| 41 | * struct spectral_scan_msg - spectral scan request message |
| 42 | * @msg_type: message type |
| 43 | * @pid: process id |
| 44 | */ |
| 45 | struct spectral_scan_msg { |
| 46 | uint32_t msg_type; |
| 47 | uint32_t pid; |
| 48 | }; |
| 49 | |
Sandeep Puligilla | 00d2a1f | 2017-12-21 00:21:44 -0800 | [diff] [blame] | 50 | #define FEATURE_SPECTRAL_SCAN_VENDOR_COMMANDS \ |
| 51 | { \ |
| 52 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 53 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_START, \ |
| 54 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 55 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 56 | .doit = wlan_hdd_cfg80211_spectral_scan_start \ |
| 57 | }, \ |
| 58 | { \ |
| 59 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 60 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_STOP, \ |
| 61 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 62 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 63 | .doit = wlan_hdd_cfg80211_spectral_scan_stop \ |
| 64 | }, \ |
| 65 | { \ |
| 66 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 67 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_CONFIG, \ |
| 68 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 69 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 70 | .doit = wlan_hdd_cfg80211_spectral_scam_get_config \ |
| 71 | }, \ |
| 72 | { \ |
| 73 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 74 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_DIAG_STATS, \ |
| 75 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 76 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 77 | .doit = wlan_hdd_cfg80211_spectral_scan_get_diag_stats \ |
| 78 | }, \ |
| 79 | { \ |
| 80 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 81 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_CAP_INFO, \ |
| 82 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 83 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 84 | .doit = wlan_hdd_cfg80211_spectral_scan_get_cap_info \ |
| 85 | }, \ |
| 86 | { \ |
| 87 | .info.vendor_id = QCA_NL80211_VENDOR_ID, \ |
| 88 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_STATUS, \ |
| 89 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ |
| 90 | WIPHY_VENDOR_CMD_NEED_NETDEV, \ |
| 91 | .doit = wlan_hdd_cfg80211_spectral_scan_get_status \ |
| 92 | }, |
| 93 | |
| 94 | /** |
| 95 | * wlan_hdd_cfg80211_spectral_scan_start() - start spectral scan |
| 96 | * @wiphy: WIPHY structure pointer |
| 97 | * @wdev: Wireless device structure pointer |
| 98 | * @data: Pointer to the data received |
| 99 | * @data_len: Length of the data received |
| 100 | * |
| 101 | * This function starts spectral scan |
| 102 | * |
| 103 | * Return: 0 on success and errno on failure |
| 104 | */ |
| 105 | int wlan_hdd_cfg80211_spectral_scan_start(struct wiphy *wiphy, |
| 106 | struct wireless_dev *wdev, |
| 107 | const void *data, |
| 108 | int data_len); |
| 109 | |
| 110 | /** |
| 111 | * wlan_hdd_cfg80211_spectral_scan_stop() - stop spectral scan |
| 112 | * @wiphy: WIPHY structure pointer |
| 113 | * @wdev: Wireless device structure pointer |
| 114 | * @data: Pointer to the data received |
| 115 | * @data_len: Length of the data received |
| 116 | * |
| 117 | * This function stops spectral scan |
| 118 | * |
| 119 | * Return: 0 on success and errno on failure |
| 120 | */ |
| 121 | int wlan_hdd_cfg80211_spectral_scan_stop(struct wiphy *wiphy, |
| 122 | struct wireless_dev *wdev, |
| 123 | const void *data, |
| 124 | int data_len); |
| 125 | |
| 126 | /** |
| 127 | * wlan_hdd_cfg80211_spectral_scan_start() - start spectral scan |
| 128 | * @wiphy: WIPHY structure pointer |
| 129 | * @wdev: Wireless device structure pointer |
| 130 | * @data: Pointer to the data received |
| 131 | * @data_len: Length of the data received |
| 132 | * |
| 133 | * This function starts spectral scan |
| 134 | * |
| 135 | * Return: 0 on success and errno on failure |
| 136 | */ |
| 137 | int wlan_hdd_cfg80211_spectral_scam_get_config(struct wiphy *wiphy, |
| 138 | struct wireless_dev *wdev, |
| 139 | const void *data, |
| 140 | int data_len); |
| 141 | |
| 142 | /** |
| 143 | * wlan_hdd_cfg80211_spectral_scan_start() - start spectral scan |
| 144 | * @wiphy: WIPHY structure pointer |
| 145 | * @wdev: Wireless device structure pointer |
| 146 | * @data: Pointer to the data received |
| 147 | * @data_len: Length of the data received |
| 148 | * |
| 149 | * This function starts spectral scan |
| 150 | * |
| 151 | * Return: 0 on success and errno on failure |
| 152 | */ |
| 153 | int wlan_hdd_cfg80211_spectral_scan_get_diag_stats(struct wiphy *wiphy, |
| 154 | struct wireless_dev *wdev, |
| 155 | const void *data, |
| 156 | int data_len); |
| 157 | |
| 158 | /** |
| 159 | * wlan_hdd_cfg80211_spectral_scan_start() - start spectral scan |
| 160 | * @wiphy: WIPHY structure pointer |
| 161 | * @wdev: Wireless device structure pointer |
| 162 | * @data: Pointer to the data received |
| 163 | * @data_len: Length of the data received |
| 164 | * |
| 165 | * This function starts spectral scan |
| 166 | * |
| 167 | * Return: 0 on success and errno on failure |
| 168 | */ |
| 169 | int wlan_hdd_cfg80211_spectral_scan_get_cap_info(struct wiphy *wiphy, |
| 170 | struct wireless_dev *wdev, |
| 171 | const void *data, |
| 172 | int data_len); |
| 173 | |
| 174 | /** |
| 175 | * wlan_hdd_cfg80211_spectral_scan_start() - start spectral scan |
| 176 | * @wiphy: WIPHY structure pointer |
| 177 | * @wdev: Wireless device structure pointer |
| 178 | * @data: Pointer to the data received |
| 179 | * @data_len: Length of the data received |
| 180 | * |
| 181 | * This function starts spectral scan |
| 182 | * |
| 183 | * Return: 0 on success and errno on failure |
| 184 | */ |
| 185 | int wlan_hdd_cfg80211_spectral_scan_get_status(struct wiphy *wiphy, |
| 186 | struct wireless_dev *wdev, |
| 187 | const void *data, |
| 188 | int data_len); |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 189 | #else |
| 190 | #define FEATURE_SPECTRAL_SCAN_VENDOR_COMMANDS |
| 191 | #endif |
Sandeep Puligilla | 00d2a1f | 2017-12-21 00:21:44 -0800 | [diff] [blame] | 192 | |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 193 | #if defined(CNSS_GENL) && defined(WLAN_CONV_SPECTRAL_ENABLE) |
Sandeep Puligilla | 019a1bd | 2018-02-04 22:57:44 -0800 | [diff] [blame] | 194 | /** |
| 195 | * spectral_scan_activate_service() - Activate spectral scan message handler |
| 196 | * |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 197 | * This function registers a handler to receive netlink message from |
| 198 | * the spectral scan application process. |
Sandeep Puligilla | 019a1bd | 2018-02-04 22:57:44 -0800 | [diff] [blame] | 199 | * |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 200 | * Return: None |
Sandeep Puligilla | 019a1bd | 2018-02-04 22:57:44 -0800 | [diff] [blame] | 201 | */ |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 202 | void spectral_scan_activate_service(void); |
| 203 | |
| 204 | /** |
| 205 | * spectral_scan_deactivate_service() - Deactivate spectral scan message handler |
| 206 | * |
| 207 | * This function deregisters a handler to receive netlink message from |
| 208 | * the spectral scan application process. |
| 209 | * |
| 210 | * Return: None |
| 211 | */ |
| 212 | void spectral_scan_deactivate_service(void); |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 213 | #else |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 214 | static inline void spectral_scan_activate_service(void) |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 215 | { |
Vignesh Viswanathan | a1cb4b4 | 2018-05-17 21:19:27 +0530 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | static inline void spectral_scan_deactivate_service(void) |
| 219 | { |
Sandeep Puligilla | 8e89d57 | 2018-04-02 18:07:45 -0700 | [diff] [blame] | 220 | } |
| 221 | #endif |
Sandeep Puligilla | 00d2a1f | 2017-12-21 00:21:44 -0800 | [diff] [blame] | 222 | #endif |