Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 1 | /* |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * DOC: wlan_hdd_lpass.c |
| 30 | * |
| 31 | * WLAN Host Device Driver LPASS feature implementation |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | /* Include Files */ |
| 36 | #include "wlan_hdd_main.h" |
| 37 | #include "wlan_hdd_lpass.h" |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 38 | #include "wlan_hdd_oemdata.h" |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 39 | #include <cds_utils.h> |
| 40 | #include "qwlan_version.h" |
| 41 | |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 42 | /** |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 43 | * wlan_hdd_get_channel_info() - Get channel info |
| 44 | * @hdd_ctx: HDD context |
| 45 | * @chan_info: Pointer to the structure that stores channel info |
| 46 | * @chan_id: Channel ID |
| 47 | * |
| 48 | * Fill in the channel info to chan_info structure. |
| 49 | */ |
Jeff Johnson | d85b761 | 2017-08-28 11:57:24 -0700 | [diff] [blame] | 50 | static void wlan_hdd_get_channel_info(struct hdd_context *hdd_ctx, |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 51 | struct svc_channel_info *chan_info, |
| 52 | uint32_t chan_id) |
| 53 | { |
| 54 | uint32_t reg_info_1; |
| 55 | uint32_t reg_info_2; |
| 56 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
| 57 | |
| 58 | status = sme_get_reg_info(hdd_ctx->hHal, chan_id, |
| 59 | ®_info_1, ®_info_2); |
| 60 | if (status != QDF_STATUS_SUCCESS) |
| 61 | return; |
| 62 | |
| 63 | chan_info->mhz = cds_chan_to_freq(chan_id); |
| 64 | chan_info->band_center_freq1 = chan_info->mhz; |
| 65 | chan_info->band_center_freq2 = 0; |
| 66 | chan_info->info = 0; |
| 67 | if (CHANNEL_STATE_DFS == |
| 68 | wlan_reg_get_channel_state(hdd_ctx->hdd_pdev, |
| 69 | chan_id)) |
| 70 | WMI_SET_CHANNEL_FLAG(chan_info, |
| 71 | WMI_CHAN_FLAG_DFS); |
| 72 | hdd_update_channel_bw_info(hdd_ctx, chan_id, |
| 73 | chan_info); |
| 74 | chan_info->reg_info_1 = reg_info_1; |
| 75 | chan_info->reg_info_2 = reg_info_2; |
| 76 | } |
| 77 | |
| 78 | /** |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 79 | * wlan_hdd_gen_wlan_status_pack() - Create lpass adapter status package |
| 80 | * @data: Status data record to be created |
| 81 | * @adapter: Adapter whose status is to being packaged |
| 82 | * @sta_ctx: Station-specific context of @adapter |
| 83 | * @is_on: Is wlan driver loaded? |
| 84 | * @is_connected: Is @adapater connected to an AP? |
| 85 | * |
| 86 | * Generate a wlan vdev status package. The status info includes wlan |
| 87 | * on/off status, vdev ID, vdev mode, supported channels, etc. |
| 88 | * |
| 89 | * Return: 0 if package was created, otherwise a negative errno |
| 90 | */ |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 91 | static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data, |
Jeff Johnson | b763bb9 | 2017-08-29 14:30:06 -0700 | [diff] [blame] | 92 | struct hdd_adapter *adapter, |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 93 | struct hdd_station_ctx *sta_ctx, |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 94 | uint8_t is_on, uint8_t is_connected) |
| 95 | { |
Jeff Johnson | d85b761 | 2017-08-28 11:57:24 -0700 | [diff] [blame] | 96 | struct hdd_context *hdd_ctx = NULL; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 97 | uint8_t buflen = WLAN_SVC_COUNTRY_CODE_LEN; |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 98 | int i; |
| 99 | uint32_t chan_id; |
| 100 | struct svc_channel_info *chan_info; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 101 | |
| 102 | if (!data) { |
Jeff Johnson | 731f3a1 | 2016-05-19 07:05:06 -0700 | [diff] [blame] | 103 | hdd_err("invalid data pointer"); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 104 | return -EINVAL; |
| 105 | } |
| 106 | if (!adapter) { |
| 107 | if (is_on) { |
| 108 | /* no active interface */ |
| 109 | data->lpss_support = 0; |
| 110 | data->is_on = is_on; |
| 111 | return 0; |
| 112 | } |
Jeff Johnson | 731f3a1 | 2016-05-19 07:05:06 -0700 | [diff] [blame] | 113 | hdd_err("invalid adapter pointer"); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 114 | return -EINVAL; |
| 115 | } |
| 116 | |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 117 | if (wlan_hdd_validate_session_id(adapter->session_id)) { |
| 118 | hdd_err("invalid session id: %d", adapter->session_id); |
Prashanth Bhatta | f59165a | 2016-08-26 16:40:38 -0700 | [diff] [blame] | 119 | return -EINVAL; |
Hanumanth Reddy Pothula | d9491f4 | 2016-10-24 19:08:38 +0530 | [diff] [blame] | 120 | } |
Prashanth Bhatta | f59165a | 2016-08-26 16:40:38 -0700 | [diff] [blame] | 121 | |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 122 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 123 | if (hdd_ctx->lpss_support && hdd_ctx->config->enable_lpass_support) |
| 124 | data->lpss_support = 1; |
| 125 | else |
| 126 | data->lpss_support = 0; |
| 127 | data->numChannels = WLAN_SVC_MAX_NUM_CHAN; |
Tushnim Bhattacharyya | de1070d | 2017-03-09 13:23:55 -0800 | [diff] [blame] | 128 | sme_get_cfg_valid_channels(data->channel_list, |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 129 | &data->numChannels); |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 130 | |
| 131 | for (i = 0; i < data->numChannels; i++) { |
| 132 | chan_info = &data->channel_info[i]; |
| 133 | chan_id = data->channel_list[i]; |
| 134 | chan_info->chan_id = chan_id; |
| 135 | wlan_hdd_get_channel_info(hdd_ctx, chan_info, chan_id); |
| 136 | } |
| 137 | |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 138 | sme_get_country_code(hdd_ctx->hHal, data->country_code, &buflen); |
| 139 | data->is_on = is_on; |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 140 | data->vdev_id = adapter->session_id; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 141 | data->vdev_mode = adapter->device_mode; |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 142 | if (sta_ctx) { |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 143 | data->is_connected = is_connected; |
| 144 | data->rssi = adapter->rssi; |
| 145 | data->freq = |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 146 | cds_chan_to_freq(sta_ctx->conn_info.operationChannel); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 147 | if (WLAN_SVC_MAX_SSID_LEN >= |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 148 | sta_ctx->conn_info.SSID.SSID.length) { |
| 149 | data->ssid_len = sta_ctx->conn_info.SSID.SSID.length; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 150 | memcpy(data->ssid, |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 151 | sta_ctx->conn_info.SSID.SSID.ssId, |
| 152 | sta_ctx->conn_info.SSID.SSID.length); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 153 | } |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 154 | if (QDF_MAC_ADDR_SIZE >= sizeof(sta_ctx->conn_info.bssId)) |
| 155 | memcpy(data->bssid, sta_ctx->conn_info.bssId.bytes, |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 156 | QDF_MAC_ADDR_SIZE); |
| 157 | } |
| 158 | return 0; |
| 159 | } |
| 160 | |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 161 | /** |
| 162 | * wlan_hdd_gen_wlan_version_pack() - Create lpass version package |
| 163 | * @data: Version data record to be created |
| 164 | * @fw_version: Version code from firmware |
| 165 | * @chip_id: WLAN chip ID |
| 166 | * @chip_name: WLAN chip name |
| 167 | * |
| 168 | * Generate a wlan software/hw version info package. The version info |
| 169 | * includes wlan host driver version, wlan fw driver version, wlan hw |
| 170 | * chip id & wlan hw chip name. |
| 171 | * |
| 172 | * Return: 0 if package was created, otherwise a negative errno |
| 173 | */ |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 174 | static int wlan_hdd_gen_wlan_version_pack(struct wlan_version_data *data, |
| 175 | uint32_t fw_version, |
| 176 | uint32_t chip_id, |
| 177 | const char *chip_name) |
| 178 | { |
| 179 | if (!data) { |
Jeff Johnson | 731f3a1 | 2016-05-19 07:05:06 -0700 | [diff] [blame] | 180 | hdd_err("invalid data pointer"); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 181 | return -EINVAL; |
| 182 | } |
| 183 | |
| 184 | data->chip_id = chip_id; |
| 185 | strlcpy(data->chip_name, chip_name, WLAN_SVC_MAX_STR_LEN); |
| 186 | if (strncmp(chip_name, "Unknown", 7)) |
| 187 | strlcpy(data->chip_from, "Qualcomm", WLAN_SVC_MAX_STR_LEN); |
| 188 | else |
| 189 | strlcpy(data->chip_from, "Unknown", WLAN_SVC_MAX_STR_LEN); |
| 190 | strlcpy(data->host_version, QWLAN_VERSIONSTR, WLAN_SVC_MAX_STR_LEN); |
| 191 | scnprintf(data->fw_version, WLAN_SVC_MAX_STR_LEN, "%d.%d.%d.%d", |
| 192 | (fw_version & 0xf0000000) >> 28, |
| 193 | (fw_version & 0xf000000) >> 24, |
| 194 | (fw_version & 0xf00000) >> 20, (fw_version & 0x7fff)); |
| 195 | return 0; |
| 196 | } |
| 197 | |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 198 | /** |
| 199 | * wlan_hdd_send_status_pkg() - Send adapter status to lpass |
| 200 | * @adapter: Adapter whose status is to be sent to lpass |
| 201 | * @sta_ctx: Station-specific context of @adapter |
| 202 | * @is_on: Is @adapter enabled |
| 203 | * @is_connected: Is @adapater connected |
| 204 | * |
| 205 | * Generate wlan vdev status pacakge and send it to a user space |
| 206 | * daemon through netlink. |
| 207 | * |
| 208 | * Return: none |
| 209 | */ |
Jeff Johnson | 85b5c11 | 2017-08-11 15:15:23 -0700 | [diff] [blame] | 210 | static void wlan_hdd_send_status_pkg(struct hdd_adapter *adapter, |
Jeff Johnson | 7139669 | 2016-09-23 15:41:52 -0700 | [diff] [blame] | 211 | struct hdd_station_ctx *sta_ctx, |
| 212 | uint8_t is_on, uint8_t is_connected) |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 213 | { |
| 214 | int ret = 0; |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 215 | struct wlan_status_data *data = NULL; |
Jeff Johnson | d85b761 | 2017-08-28 11:57:24 -0700 | [diff] [blame] | 216 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Kondabattini, Ganesh | 96ac37b | 2016-09-02 23:12:15 +0530 | [diff] [blame] | 217 | |
| 218 | if (!hdd_ctx) |
| 219 | return; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 220 | |
| 221 | if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) |
| 222 | return; |
| 223 | |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 224 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
| 225 | if (!data) |
| 226 | return; |
| 227 | |
Srinivas Girigowda | 5557a39 | 2017-03-09 14:28:36 -0800 | [diff] [blame] | 228 | if (is_on) |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 229 | ret = wlan_hdd_gen_wlan_status_pack(data, adapter, sta_ctx, |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 230 | is_on, is_connected); |
Prashanth Bhatta | f59165a | 2016-08-26 16:40:38 -0700 | [diff] [blame] | 231 | |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 232 | if (!ret) |
Kondabattini, Ganesh | 96ac37b | 2016-09-02 23:12:15 +0530 | [diff] [blame] | 233 | wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index, |
Yuanyuan Liu | d9db825 | 2017-02-06 14:17:46 -0800 | [diff] [blame] | 234 | WLAN_SVC_WLAN_STATUS_IND, |
| 235 | data, sizeof(*data)); |
| 236 | kfree(data); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 239 | /** |
| 240 | * wlan_hdd_send_version_pkg() - report version information to lpass |
| 241 | * @fw_version: Version code from firmware |
| 242 | * @chip_id: WLAN chip ID |
| 243 | * @chip_name: WLAN chip name |
| 244 | * |
| 245 | * Generate a wlan sw/hw version info package and send it to a user |
| 246 | * space daemon through netlink. |
| 247 | * |
| 248 | * Return: none |
| 249 | */ |
Jeff Johnson | 9afc501 | 2016-09-23 13:56:27 -0700 | [diff] [blame] | 250 | static void wlan_hdd_send_version_pkg(uint32_t fw_version, |
| 251 | uint32_t chip_id, |
| 252 | const char *chip_name) |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 253 | { |
| 254 | int ret = 0; |
| 255 | struct wlan_version_data data; |
Jeff Johnson | d85b761 | 2017-08-28 11:57:24 -0700 | [diff] [blame] | 256 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Kondabattini, Ganesh | 96ac37b | 2016-09-02 23:12:15 +0530 | [diff] [blame] | 257 | |
| 258 | if (!hdd_ctx) |
| 259 | return; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 260 | |
| 261 | if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) |
| 262 | return; |
| 263 | |
| 264 | memset(&data, 0, sizeof(struct wlan_version_data)); |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 265 | ret = wlan_hdd_gen_wlan_version_pack(&data, fw_version, chip_id, |
| 266 | chip_name); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 267 | if (!ret) |
Kondabattini, Ganesh | 96ac37b | 2016-09-02 23:12:15 +0530 | [diff] [blame] | 268 | wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index, |
| 269 | WLAN_SVC_WLAN_VERSION_IND, |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 270 | &data, sizeof(data)); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Jeff Johnson | f96ef73 | 2016-05-18 16:38:06 -0700 | [diff] [blame] | 273 | /** |
| 274 | * wlan_hdd_send_all_scan_intf_info() - report scan interfaces to lpass |
| 275 | * @hdd_ctx: The global HDD context |
| 276 | * |
| 277 | * This function iterates through all of the interfaces registered |
| 278 | * with HDD and indicates to lpass all that support scanning. |
| 279 | * If no interfaces support scanning then that fact is also indicated. |
| 280 | * |
| 281 | * Return: none |
| 282 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 283 | static void wlan_hdd_send_all_scan_intf_info(struct hdd_context *hdd_ctx) |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 284 | { |
Jeff Johnson | b763bb9 | 2017-08-29 14:30:06 -0700 | [diff] [blame] | 285 | struct hdd_adapter *adapter = NULL; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 286 | bool scan_intf_found = false; |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 287 | |
| 288 | if (!hdd_ctx) { |
Jeff Johnson | 731f3a1 | 2016-05-19 07:05:06 -0700 | [diff] [blame] | 289 | hdd_err("NULL pointer for hdd_ctx"); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 290 | return; |
| 291 | } |
| 292 | |
Dustin Brown | 920397d | 2017-12-13 16:27:50 -0800 | [diff] [blame] | 293 | hdd_for_each_adapter(hdd_ctx, adapter) { |
| 294 | if (adapter->device_mode == QDF_STA_MODE || |
| 295 | adapter->device_mode == QDF_P2P_CLIENT_MODE || |
| 296 | adapter->device_mode == QDF_P2P_DEVICE_MODE) { |
| 297 | scan_intf_found = true; |
| 298 | wlan_hdd_send_status_pkg(adapter, NULL, 1, 0); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 299 | } |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | if (!scan_intf_found) |
Jeff Johnson | d9dd484 | 2016-05-18 16:49:29 -0700 | [diff] [blame] | 303 | wlan_hdd_send_status_pkg(adapter, NULL, 1, 0); |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 304 | } |
Jeff Johnson | 9afc501 | 2016-09-23 13:56:27 -0700 | [diff] [blame] | 305 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 306 | /* |
Jeff Johnson | c875e24 | 2016-09-23 18:12:34 -0700 | [diff] [blame] | 307 | * hdd_lpass_target_config() - Handle LPASS target configuration |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 308 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | c875e24 | 2016-09-23 18:12:34 -0700 | [diff] [blame] | 309 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 310 | void hdd_lpass_target_config(struct hdd_context *hdd_ctx, |
Jeff Johnson | c875e24 | 2016-09-23 18:12:34 -0700 | [diff] [blame] | 311 | struct wma_tgt_cfg *target_config) |
| 312 | { |
| 313 | hdd_ctx->lpss_support = target_config->lpss_support; |
| 314 | } |
| 315 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 316 | /* |
Jeff Johnson | 9078bdc | 2016-09-23 17:18:11 -0700 | [diff] [blame] | 317 | * hdd_lpass_populate_cds_config() - Populate LPASS configuration |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 318 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | 9078bdc | 2016-09-23 17:18:11 -0700 | [diff] [blame] | 319 | */ |
| 320 | void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config, |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 321 | struct hdd_context *hdd_ctx) |
Jeff Johnson | 9078bdc | 2016-09-23 17:18:11 -0700 | [diff] [blame] | 322 | { |
| 323 | cds_config->is_lpass_enabled = hdd_ctx->config->enable_lpass_support; |
| 324 | } |
| 325 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 326 | /* |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 327 | * hdd_lpass_populate_pmo_config() - Populate LPASS configuration |
| 328 | * (public function documented in wlan_hdd_lpass.h) |
| 329 | */ |
| 330 | void hdd_lpass_populate_pmo_config(struct pmo_psoc_cfg *pmo_config, |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 331 | struct hdd_context *hdd_ctx) |
Mukul Sharma | 9223f23 | 2017-03-08 18:42:27 +0530 | [diff] [blame] | 332 | { |
| 333 | pmo_config->lpass_enable = hdd_ctx->config->enable_lpass_support; |
| 334 | } |
| 335 | |
| 336 | /* |
Jeff Johnson | 7139669 | 2016-09-23 15:41:52 -0700 | [diff] [blame] | 337 | * hdd_lpass_notify_connect() - Notify LPASS of interface connect |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 338 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | 7139669 | 2016-09-23 15:41:52 -0700 | [diff] [blame] | 339 | */ |
Jeff Johnson | 85b5c11 | 2017-08-11 15:15:23 -0700 | [diff] [blame] | 340 | void hdd_lpass_notify_connect(struct hdd_adapter *adapter) |
Jeff Johnson | 7139669 | 2016-09-23 15:41:52 -0700 | [diff] [blame] | 341 | { |
| 342 | struct hdd_station_ctx *sta_ctx; |
| 343 | |
| 344 | /* only send once per connection */ |
| 345 | if (adapter->rssi_send) |
| 346 | return; |
| 347 | |
| 348 | /* don't send if driver is unloading */ |
| 349 | if (cds_is_driver_unloading()) |
| 350 | return; |
| 351 | |
| 352 | adapter->rssi_send = true; |
| 353 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 354 | wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 1); |
| 355 | } |
| 356 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 357 | /* |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 358 | * hdd_lpass_notify_disconnect() - Notify LPASS of interface disconnect |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 359 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 360 | */ |
Jeff Johnson | 85b5c11 | 2017-08-11 15:15:23 -0700 | [diff] [blame] | 361 | void hdd_lpass_notify_disconnect(struct hdd_adapter *adapter) |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 362 | { |
| 363 | struct hdd_station_ctx *sta_ctx; |
| 364 | |
| 365 | adapter->rssi_send = false; |
| 366 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 367 | wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 0); |
| 368 | } |
| 369 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 370 | /* |
Jeff Johnson | 2ae6f71 | 2016-09-23 15:08:48 -0700 | [diff] [blame] | 371 | * hdd_lpass_notify_mode_change() - Notify LPASS of interface mode change |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 372 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | 2ae6f71 | 2016-09-23 15:08:48 -0700 | [diff] [blame] | 373 | * |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 374 | * implementation note: when one interfaces changes we notify the |
| 375 | * state of all of the interfaces. |
Jeff Johnson | 2ae6f71 | 2016-09-23 15:08:48 -0700 | [diff] [blame] | 376 | */ |
Jeff Johnson | 85b5c11 | 2017-08-11 15:15:23 -0700 | [diff] [blame] | 377 | void hdd_lpass_notify_mode_change(struct hdd_adapter *adapter) |
Jeff Johnson | 2ae6f71 | 2016-09-23 15:08:48 -0700 | [diff] [blame] | 378 | { |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 379 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 2ae6f71 | 2016-09-23 15:08:48 -0700 | [diff] [blame] | 380 | |
| 381 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 382 | wlan_hdd_send_all_scan_intf_info(hdd_ctx); |
| 383 | } |
| 384 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 385 | /* |
Jeff Johnson | 9afc501 | 2016-09-23 13:56:27 -0700 | [diff] [blame] | 386 | * hdd_lpass_notify_start() - Notify LPASS of driver start |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 387 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | 9afc501 | 2016-09-23 13:56:27 -0700 | [diff] [blame] | 388 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 389 | void hdd_lpass_notify_start(struct hdd_context *hdd_ctx) |
Jeff Johnson | 9afc501 | 2016-09-23 13:56:27 -0700 | [diff] [blame] | 390 | { |
| 391 | wlan_hdd_send_all_scan_intf_info(hdd_ctx); |
| 392 | wlan_hdd_send_version_pkg(hdd_ctx->target_fw_version, |
| 393 | hdd_ctx->target_hw_version, |
| 394 | hdd_ctx->target_hw_name); |
| 395 | } |
Jeff Johnson | f7f66f0 | 2016-09-23 14:50:11 -0700 | [diff] [blame] | 396 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 397 | /* |
Jeff Johnson | f7f66f0 | 2016-09-23 14:50:11 -0700 | [diff] [blame] | 398 | * hdd_lpass_notify_stop() - Notify LPASS of driver stop |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 399 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | f7f66f0 | 2016-09-23 14:50:11 -0700 | [diff] [blame] | 400 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 401 | void hdd_lpass_notify_stop(struct hdd_context *hdd_ctx) |
Jeff Johnson | f7f66f0 | 2016-09-23 14:50:11 -0700 | [diff] [blame] | 402 | { |
| 403 | wlan_hdd_send_status_pkg(NULL, NULL, 0, 0); |
| 404 | } |
Jeff Johnson | b8bf907 | 2016-09-23 17:39:27 -0700 | [diff] [blame] | 405 | |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 406 | /* |
Jeff Johnson | b8bf907 | 2016-09-23 17:39:27 -0700 | [diff] [blame] | 407 | * hdd_lpass_is_supported() - Is lpass feature supported? |
Jeff Johnson | 67904df | 2016-09-27 15:15:51 -0700 | [diff] [blame] | 408 | * (public function documented in wlan_hdd_lpass.h) |
Jeff Johnson | b8bf907 | 2016-09-23 17:39:27 -0700 | [diff] [blame] | 409 | */ |
Jeff Johnson | 82797b6 | 2017-08-11 15:31:27 -0700 | [diff] [blame] | 410 | bool hdd_lpass_is_supported(struct hdd_context *hdd_ctx) |
Jeff Johnson | b8bf907 | 2016-09-23 17:39:27 -0700 | [diff] [blame] | 411 | { |
| 412 | return hdd_ctx->config->enable_lpass_support; |
| 413 | } |