Merge ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:for-hwe/merge-debian-7858 into ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:ubuntu/master

Proposed by You-Sheng Yang
Status: Merged
Approved by: You-Sheng Yang
Approved revision: 92d6afda0f493ac467b041eeea9afe1a9af45478
Merged at revision: 92d6afda0f493ac467b041eeea9afe1a9af45478
Proposed branch: ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:for-hwe/merge-debian-7858
Merge into: ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:ubuntu/master
Diff against target: 5396 lines (+313/-2227)
44 files modified
debian/changelog (+6/-0)
defconfigs/iwlwifi-galileo (+0/-2)
defconfigs/iwlwifi-public (+0/-2)
defconfigs/iwlwifi-public-android (+0/-3)
defconfigs/prune-public (+0/-2)
defconfigs/soc_ip_hfpga (+0/-2)
dev/null (+0/-796)
drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream (+0/-26)
drivers/net/wireless/intel/iwlwifi/fw/api/coex.h (+2/-122)
drivers/net/wireless/intel/iwlwifi/fw/api/commands.h (+2/-31)
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h (+13/-5)
drivers/net/wireless/intel/iwlwifi/fw/api/scan.h (+47/-8)
drivers/net/wireless/intel/iwlwifi/fw/file.h (+1/-3)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.h (+1/-6)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c (+0/-8)
drivers/net/wireless/intel/iwlwifi/iwl-modparams.h (+2/-7)
drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h (+0/-23)
drivers/net/wireless/intel/iwlwifi/iwl-trans.c (+0/-14)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h (+29/-73)
drivers/net/wireless/intel/iwlwifi/mvm/Makefile (+0/-2)
drivers/net/wireless/intel/iwlwifi/mvm/coex.c (+2/-158)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c (+9/-0)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c (+2/-15)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c (+3/-19)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c (+25/-1)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c (+10/-72)
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h (+7/-69)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c (+0/-19)
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c (+3/-7)
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c (+21/-8)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c (+63/-24)
drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c (+0/-405)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c (+0/-99)
drivers/net/wireless/intel/iwlwifi/pcie/internal.h (+3/-8)
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c (+3/-3)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c (+10/-61)
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c (+2/-40)
drivers/net/wireless/intel/iwlwifi/pcie/tx.c (+25/-65)
drivers/net/wireless/intel/iwlwifi/xvt/fw.c (+3/-6)
drivers/net/wireless/intel/iwlwifi/xvt/user-infc.c (+6/-5)
drivers/net/wireless/intel/iwlwifi/xvt/xvt.h (+3/-3)
local-symbols (+0/-3)
net/mac80211/vht.c (+9/-1)
versions (+1/-1)
Reviewer Review Type Date Requested Status
You-Sheng Yang Approve
Review via email: mp+369139@code.launchpad.net

Commit message

Sync with Debian version 7858.

To post a comment you must log in.
Revision history for this message
You-Sheng Yang (vicamo) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index bfbb1fa..f6dc7d4 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+backport-iwlwifi-dkms (7858-ubuntu1) UNRELEASED; urgency=low
7+
8+ * sync with debian 7858.
9+
10+ -- You-Sheng Yang <vicamo@gmail.com> Fri, 21 Jun 2019 15:27:31 +0800
11+
12 backport-iwlwifi-dkms (7841-ubuntu2) UNRELEASED; urgency=low
13
14 * add modalias support.
15diff --git a/defconfigs/iwlwifi-galileo b/defconfigs/iwlwifi-galileo
16index 812014f..14e0b45 100644
17--- a/defconfigs/iwlwifi-galileo
18+++ b/defconfigs/iwlwifi-galileo
19@@ -21,8 +21,6 @@ CPTCFG_IWLWIFI_DEVICE_TESTMODE=y
20 # CPTCFG_MAC80211_HWSIM is not set
21 CPTCFG_IWLXVT=m
22 CPTCFG_IWLWIFI_SUPPORT_DEBUG_OVERRIDES=y
23-# CPTCFG_IWLWIFI_FRQ_MGR_TEST is not set
24 # CPTCFG_IWLWIFI_FORCE_OFDM_RATE is not set
25-# CPTCFG_IWLWIFI_LTE_COEX is not set
26 # CPTCFG_IWLMVM_P2P_UAPSD_STANDALONE is not set
27 CPTCFG_IWLWIFI_NUM_CHANNELS=1
28diff --git a/defconfigs/iwlwifi-public b/defconfigs/iwlwifi-public
29index ef43e35..c457087 100644
30--- a/defconfigs/iwlwifi-public
31+++ b/defconfigs/iwlwifi-public
32@@ -19,6 +19,4 @@ CPTCFG_IWLWIFI_DEVICE_TRACING=y
33 CPTCFG_IWLWIFI_DEVICE_TESTMODE=y
34 # CPTCFG_MAC80211_HWSIM is not set
35 CPTCFG_IWLXVT=m
36-CPTCFG_IWLWIFI_FRQ_MGR_TEST=y
37 CPTCFG_IWLWIFI_OPMODE_MODULAR=y
38-CPTCFG_IWLWIFI_LTE_COEX=y
39diff --git a/defconfigs/iwlwifi-public-android b/defconfigs/iwlwifi-public-android
40index f430328..16114af 100644
41--- a/defconfigs/iwlwifi-public-android
42+++ b/defconfigs/iwlwifi-public-android
43@@ -19,9 +19,6 @@ CPTCFG_IWLWIFI_DEVICE_TRACING=y
44 CPTCFG_IWLWIFI_DEVICE_TESTMODE=y
45 # CPTCFG_MAC80211_HWSIM is not set
46 # CPTCFG_IWLXVT is not set
47-# CPTCFG_IWLWIFI_FRQ_MGR_TEST is not set
48-# CPTCFG_IWLWIFI_FRQ_MGR is not set
49 CPTCFG_IWLWIFI_OPMODE_MODULAR=y
50-CPTCFG_IWLWIFI_LTE_COEX=y
51 CPTCFG_IWLWIFI_BCAST_FILTERING=y
52 # CPTCFG_IWLMVM_AX_SUPPORT is not set
53diff --git a/defconfigs/prune-public b/defconfigs/prune-public
54index 4076f6d..52e509d 100644
55--- a/defconfigs/prune-public
56+++ b/defconfigs/prune-public
57@@ -17,6 +17,4 @@ CPTCFG_IWLWIFI_DEBUGFS=y
58 CPTCFG_IWLWIFI_DEVICE_TRACING=y
59 CPTCFG_IWLWIFI_DEVICE_TESTMODE=y
60 CPTCFG_IWLXVT=m
61-CPTCFG_IWLWIFI_FRQ_MGR_TEST=y
62 CPTCFG_IWLWIFI_OPMODE_MODULAR=y
63-CPTCFG_IWLWIFI_LTE_COEX=y
64diff --git a/defconfigs/soc_ip_hfpga b/defconfigs/soc_ip_hfpga
65index 57aba4d..4485fbf 100644
66--- a/defconfigs/soc_ip_hfpga
67+++ b/defconfigs/soc_ip_hfpga
68@@ -19,6 +19,4 @@ CPTCFG_IWLWIFI_DEVICE_TRACING=y
69 CPTCFG_IWLWIFI_DEVICE_TESTMODE=y
70 CPTCFG_IWLXVT=m
71 CPTCFG_IWLWIFI_SUPPORT_DEBUG_OVERRIDES=y
72-# CPTCFG_IWLWIFI_FRQ_MGR_TEST is not set
73 # CPTCFG_IWLWIFI_FORCE_OFDM_RATE is not set
74-# CPTCFG_IWLWIFI_LTE_COEX is not set
75diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream b/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
76index fb00937..434c115 100644
77--- a/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
78+++ b/drivers/net/wireless/intel/iwlwifi/Kconfig.noupstream
79@@ -38,26 +38,6 @@ config IWLWIFI_DEVICE_TESTMODE
80 default y if IWLMVM
81 select IWLWIFI_SUPPORT_DEBUG_OVERRIDES
82
83-config IWLWIFI_FRQ_MGR_TEST
84- bool "Enable Frequency Manager API - Test Mode"
85- depends on IWLMVM && IWLWIFI_SUPPORT_DEBUG_OVERRIDES
86- help
87- This option enables running The Frequency Manager API
88- in Debug Mode without having A Frequency Manager.
89- In this mode you can run the Frequency Manager on any Platform,
90- monitor the notifications that the driver send the Frequency Manager,
91- and initiate notifications from the Frequency Manager.
92-
93-config IWLWIFI_FRQ_MGR
94- bool "enable Frequency Manager API" if !IWLWIFI_FRQ_MGR_TEST
95- default y if IWLWIFI_FRQ_MGR_TEST
96- depends on IWLMVM && (IUI_FM || IWLWIFI_FRQ_MGR_TEST)
97- help
98- This option enables The Frequency Manager API.
99- Enabling this option allows the driver to receive and send
100- Frequency notification from and to the Frequency Manager.
101- The notification can involve Tx power, Rx gain, and ADC/DAC
102-
103 config IWLWIFI_SUPPORT_DEBUG_OVERRIDES
104 depends on IWLWIFI
105 bool "enable default value override (for debugging)"
106@@ -94,12 +74,6 @@ config IWLMVM_VENDOR_CMDS
107 This option mostly exists for non-upstream tagging, so best
108 leave it set to Y.
109
110-config IWLWIFI_LTE_COEX
111- bool "enable lte coexistence support"
112- depends on IWLMVM_VENDOR_CMDS
113- help
114- This option enables LTE-Coexistence (vendor) commands
115-
116 config IWLMVM_TDLS_PEER_CACHE
117 bool "enable TDLS peer caching and traffic monitoring"
118 depends on IWLMVM_VENDOR_CMDS
119diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/coex.h b/drivers/net/wireless/intel/iwlwifi/fw/api/coex.h
120index 33abd47..faf38ee 100644
121--- a/drivers/net/wireless/intel/iwlwifi/fw/api/coex.h
122+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/coex.h
123@@ -8,7 +8,7 @@
124 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
125 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
126 * Copyright(c) 2017 Intel Deutschland GmbH
127- * Copyright(c) 2018 Intel Corporation
128+ * Copyright(c) 2018 - 2019 Intel Corporation
129 *
130 * This program is free software; you can redistribute it and/or modify
131 * it under the terms of version 2 of the GNU General Public License as
132@@ -31,7 +31,7 @@
133 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
134 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
135 * Copyright(c) 2017 Intel Deutschland GmbH
136- * Copyright(c) 2018 Intel Corporation
137+ * Copyright(c) 2018 - 2019 Intel Corporation
138 * All rights reserved.
139 *
140 * Redistribution and use in source and binary forms, with or without
141@@ -242,124 +242,4 @@ struct iwl_bt_coex_profile_notif {
142 __le16 reserved;
143 } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
144
145-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
146-/*
147- * struct iwl_config_2g_coex_cmd - 2G Coex configuration command
148- * (CONFIG_2G_COEX_CMD = 0x71)
149- * @enabled: 2g coex is enabled/disabled
150- */
151-struct iwl_config_2g_coex_cmd {
152- __le32 enabled;
153-} __packed; /* CONFIG_2G_COEX_CMD_API_S_VER_1 */
154-#endif
155-
156-#ifdef CPTCFG_IWLWIFI_LTE_COEX
157-
158-#define WIFI_BAND_24_NUM_CHANNELS 14
159-#define LTE_COEX_MFUART_CONFIG_LENGTH 12
160-#define LTE_COEX_FRAME_STRUCTURE_LENGTH 2
161-
162-/**
163- * struct iwl_lte_coex_config_cmd - LTE Coex configuration command
164- * @lte_state: lte modem state
165- * @lte_band: lte operating band
166- * @lte_chan: lte operating channel
167- * @lte_frame_structure: ?
168- * @tx_safe_freq_min: ?
169- * @tx_safe_freq_max: ?
170- * @rx_safe_freq_min: ?
171- * @rx_safe_freq_max: ?
172- * @max_tx_power: wifi static max tx output power per channel
173- *
174- * Used for LTE_COEX_CONFIG_CMD command
175- */
176-struct iwl_lte_coex_config_cmd {
177- __le32 lte_state;
178- __le32 lte_band;
179- __le32 lte_chan;
180- __le32 lte_frame_structure[LTE_COEX_FRAME_STRUCTURE_LENGTH];
181- __le32 tx_safe_freq_min;
182- __le32 tx_safe_freq_max;
183- __le32 rx_safe_freq_min;
184- __le32 rx_safe_freq_max;
185- u8 max_tx_power[WIFI_BAND_24_NUM_CHANNELS];
186-} __packed; /* LTE_COEX_CONFIG_CMD_API_S_VER_1 */
187-
188-/**
189- * struct iwl_lte_coex_static_params_cmd - LTE Coex static params configuration
190- * command
191- * @mfu_config: MFUART config and RT signals assert/de-assert timing
192- * @tx_power_in_dbm: Wifi safe power table
193- *
194- * Used for LTE_COEX_STATIC_PARAMS_CMD command
195- */
196-struct iwl_lte_coex_static_params_cmd {
197- __le32 mfu_config[LTE_COEX_MFUART_CONFIG_LENGTH];
198- s8 tx_power_in_dbm[32];
199-} __packed; /* LTE_COEX_STATIC_PARAMS_CMD_API_S_VER_1 */
200-
201-/**
202- * struct iwl_lte_coex_wifi_reported_channel_cmd - LTE Coex reported channels
203- * configuration command
204- * @channel: channel number (1-14)
205- * @bandwidth: bandwidth (0-3)
206- *
207- * Used for LTE_COEX_WIFI_REPORTED_CHANNEL_CMD command
208- */
209-struct iwl_lte_coex_wifi_reported_channel_cmd {
210- __le32 channel;
211- __le32 bandwidth;
212-} __packed; /* LTE_COEX_WIFI_REPORTED_CHANNEL_CMD_API_S_VER_1 */
213-
214-/**
215- * struct iwl_lte_coex_sps_cmd - LTE Coex semi persistent info command
216- *
217- * @lte_semi_persistent_info:
218- *
219- * Used for LTE_COEX_SPS_CMD command
220- */
221-struct iwl_lte_coex_sps_cmd {
222- __le32 lte_semi_persistent_info;
223-} __packed; /* LTE_COEX_WIFI_SPS_CMD_API_S_VER_1 */
224-
225-/**
226- * struct iwl_lte_coex_fine_tuning_params_cmd - LTE Coex fine tuning parameters
227- * @rx_protection_assert_timing: 802_RX_PRI request advance time
228- * @tx_protection_assert_timing: 802_TX_ON request advance time
229- * @rx_protection_timeout: Cancel Rx Protection request due to no Rx threshold
230- * @min_tx_power: Min-Tx-Power threshold for Data/Management frames
231- * @lte_ul_load_uapsd_threshold: 'LTE UL Load' counter thresholds
232- * for recommending Power-Manager to enter to UAPSD
233- * @rx_failure_during_ul_uapsd_threshold: 'Rx Failure due to UL' counter
234- * thresholds for recommending Power-Manager to enter to UAPSD
235- * @rx_failure_during_ul_sc_threshold: 'Rx Failure due to UL'
236- * counter threshold for recommending Scan-Manager to apply compensation
237- * @rx_duration_for_ack_protection_us: Tx Ack size for Tx Protection
238- * @beacon_failure_during_ul_counter: Failed Rx Beacon threshold
239- * @dtim_failure_during_ul_counter: Failed Rx DTIM threshold
240- *
241- * Used for LTE_COEX_FINE_TUNING_PARAMS_CMD command
242- */
243-struct iwl_lte_coex_fine_tuning_params_cmd {
244- __le32 rx_protection_assert_timing;
245- __le32 tx_protection_assert_timing;
246- __le32 rx_protection_timeout;
247- __le32 min_tx_power;
248- __le32 lte_ul_load_uapsd_threshold;
249- __le32 rx_failure_during_ul_uapsd_threshold;
250- __le32 rx_failure_during_ul_sc_threshold;
251- __le32 rx_duration_for_ack_protection_us;
252- __le32 beacon_failure_during_ul_counter;
253- __le32 dtim_failure_during_ul_counter;
254-} __packed; /* LTE_COEX_FINE_TUNING_PARAMS_CMD_API_S_VER_1 */
255-
256-/**
257- * struct iwl_lte_coex_statistic_ntfy - LTE Coex statistics notification
258- * @statistic_placeholder: placeholder
259- */
260-struct iwl_lte_coex_statistic_ntfy {
261- __le32 statistic_placeholder;
262-} __packed; /* LTE_COEX_STATISTIC_NTFY_API_S_VER_1 */
263-#endif /* CPTCFG_IWLWIFI_LTE_COEX */
264-
265 #endif /* __iwl_fw_api_coex_h__ */
266diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
267index e7eecb1..d665938 100644
268--- a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
269+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h
270@@ -8,7 +8,7 @@
271 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
272 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
273 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
274- * Copyright(c) 2018 Intel Corporation
275+ * Copyright(c) 2018 - 2019 Intel Corporation
276 *
277 * This program is free software; you can redistribute it and/or modify
278 * it under the terms of version 2 of the GNU General Public License as
279@@ -31,7 +31,7 @@
280 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
281 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
282 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
283- * Copyright(c) 2018 Intel Corporation
284+ * Copyright(c) 2018 - 2019 Intel Corporation
285 * All rights reserved.
286 *
287 * Redistribution and use in source and binary forms, with or without
288@@ -540,35 +540,6 @@ enum iwl_legacy_cmds {
289 */
290 BT_COEX_CI = 0x5d,
291
292-#ifdef CPTCFG_IWLWIFI_LTE_COEX
293- /**
294- * @LTE_COEX_CONFIG_CMD: &struct iwl_lte_coex_config_cmd
295- */
296- LTE_COEX_CONFIG_CMD = 0x4a,
297-
298- /**
299- * @LTE_COEX_WIFI_REPORTED_CHANNEL_CMD:
300- * &struct iwl_lte_coex_wifi_reported_channel_cmd
301- */
302- LTE_COEX_WIFI_REPORTED_CHANNEL_CMD = 0X4b,
303-
304- /**
305- * @LTE_COEX_STATIC_PARAMS_CMD: &struct iwl_lte_coex_static_params_cmd
306- */
307- LTE_COEX_STATIC_PARAMS_CMD = 0x4c,
308-
309- /**
310- * @LTE_COEX_SPS_CMD: struct iwl_lte_coex_sps_cmd
311- */
312- LTE_COEX_SPS_CMD = 0x4d,
313-
314- /**
315- * @LTE_COEX_FINE_TUNING_PARAMS_CMD:
316- * &struct iwl_lte_coex_fine_tuning_params_cmd
317- */
318- LTE_COEX_FINE_TUNING_PARAMS_CMD = 0x57,
319-#endif
320-
321 /**
322 * @REPLY_SF_CFG_CMD: &struct iwl_sf_cfg_cmd
323 */
324diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
325index 9eddc4d..4347be6 100644
326--- a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
327+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
328@@ -7,7 +7,7 @@
329 *
330 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
331 * Copyright(c) 2017 Intel Deutschland GmbH
332- * Copyright(c) 2018 Intel Corporation
333+ * Copyright(c) 2018 - 2019 Intel Corporation
334 *
335 * This program is free software; you can redistribute it and/or modify
336 * it under the terms of version 2 of the GNU General Public License as
337@@ -29,7 +29,7 @@
338 *
339 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
340 * Copyright(c) 2017 Intel Deutschland GmbH
341- * Copyright(c) 2018 Intel Corporation
342+ * Copyright(c) 2018 - 2019 Intel Corporation
343 * All rights reserved.
344 *
345 * Redistribution and use in source and binary forms, with or without
346@@ -166,8 +166,16 @@ enum iwl_tlc_mng_ht_rates {
347 IWL_TLC_MNG_HT_RATE_MAX = IWL_TLC_MNG_HT_RATE_MCS11,
348 };
349
350-/* Maximum supported tx antennas number */
351-#define MAX_NSS 2
352+enum IWL_TLC_MNG_NSS {
353+ IWL_TLC_NSS_1,
354+ IWL_TLC_NSS_2,
355+ IWL_TLC_NSS_MAX
356+};
357+
358+enum IWL_TLC_HT_BW_RATES {
359+ IWL_TLC_HT_BW_NONE_160,
360+ IWL_TLC_HT_BW_160,
361+};
362
363 /**
364 * struct tlc_config_cmd - TLC configuration
365@@ -195,7 +203,7 @@ struct iwl_tlc_config_cmd {
366 u8 amsdu;
367 __le16 flags;
368 __le16 non_ht_rates;
369- __le16 ht_rates[MAX_NSS][2];
370+ __le16 ht_rates[IWL_TLC_NSS_MAX][2];
371 __le16 max_mpdu_len;
372 u8 sgi_ch_width_supp;
373 u8 reserved2[1];
374diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
375index 1940a8c..8678b78 100644
376--- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
377+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
378@@ -93,6 +93,8 @@ struct iwl_ssid_ie {
379 #define IWL_SCAN_SHORT_BLACKLIST_LEN 16
380 #define IWL_SCAN_MAX_PROFILES 11
381 #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
382+#define SCAN_NUM_BAND_PROBE_DATA_V_1 2
383+#define SCAN_NUM_BAND_PROBE_DATA_V_2 3
384
385 /* Default watchdog (in MS) for scheduled scan iteration */
386 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
387@@ -252,9 +254,22 @@ struct iwl_scan_probe_segment {
388 * @common_data: last (and common) part of the probe
389 * @buf: raw data block
390 */
391+struct iwl_scan_probe_req_v1 {
392+ struct iwl_scan_probe_segment mac_header;
393+ struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_1];
394+ struct iwl_scan_probe_segment common_data;
395+ u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
396+} __packed;
397+
398+/* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_v2
399+ * @mac_header: first (and common) part of the probe
400+ * @band_data: band specific data
401+ * @common_data: last (and common) part of the probe
402+ * @buf: raw data block
403+ */
404 struct iwl_scan_probe_req {
405 struct iwl_scan_probe_segment mac_header;
406- struct iwl_scan_probe_segment band_data[2];
407+ struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_2];
408 struct iwl_scan_probe_segment common_data;
409 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
410 } __packed;
411@@ -627,15 +642,29 @@ enum iwl_umac_scan_general_flags2 {
412 * struct iwl_scan_channel_cfg_umac
413 * @flags: bitmap - 0-19: directed scan to i'th ssid.
414 * @channel_num: channel number 1-13 etc.
415+ * @band: band of channel: 0 for 2GHz, 1 for 5GHz
416 * @iter_count: repetition count for the channel.
417 * @iter_interval: interval between two scan iterations on one channel.
418 */
419-struct iwl_scan_channel_cfg_umac {
420+struct iwl_scan_channel_cfg_umac {
421 __le32 flags;
422- u8 channel_num;
423- u8 iter_count;
424- __le16 iter_interval;
425-} __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
426+ /* Both versions are of the same size, so use a union without adjusting
427+ * the command size later
428+ */
429+ union {
430+ struct {
431+ u8 channel_num;
432+ u8 iter_count;
433+ __le16 iter_interval;
434+ } v1; /* SCAN_CHANNEL_CFG_S_VER1 */
435+ struct {
436+ u8 channel_num;
437+ u8 band;
438+ u8 iter_count;
439+ u8 iter_interval;
440+ } v2; /* SCAN_CHANNEL_CFG_S_VER2 */
441+ };
442+} __packed;
443
444 /**
445 * struct iwl_scan_umac_schedule
446@@ -649,6 +678,16 @@ struct iwl_scan_umac_schedule {
447 u8 reserved;
448 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
449
450+struct iwl_scan_req_umac_tail_v1 {
451+ /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
452+ struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
453+ __le16 delay;
454+ __le16 reserved;
455+ /* SCAN_PROBE_PARAMS_API_S_VER_1 */
456+ struct iwl_scan_probe_req_v1 preq;
457+ struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
458+} __packed;
459+
460 /**
461 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
462 * parameters following channels configuration array.
463@@ -658,12 +697,12 @@ struct iwl_scan_umac_schedule {
464 * @preq: probe request with IEs blocks
465 * @direct_scan: list of SSIDs for directed active scan
466 */
467-struct iwl_scan_req_umac_tail {
468+struct iwl_scan_req_umac_tail_v2 {
469 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
470 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
471 __le16 delay;
472 __le16 reserved;
473- /* SCAN_PROBE_PARAMS_API_S_VER_1 */
474+ /* SCAN_PROBE_PARAMS_API_S_VER_2 */
475 struct iwl_scan_probe_req preq;
476 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
477 } __packed;
478diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
479index b3f8e7f..a2b9299 100644
480--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
481+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
482@@ -248,9 +248,6 @@ enum iwl_ucode_tlv_flag {
483 IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25),
484 IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26),
485 IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29),
486-#ifdef CPTCFG_IWLWIFI_LTE_COEX
487- IWL_UCODE_TLV_FLAGS_LTE_COEX = BIT(31),
488-#endif
489 };
490
491 typedef unsigned int __bitwise iwl_ucode_tlv_api_t;
492@@ -335,6 +332,7 @@ enum iwl_ucode_tlv_api {
493 IWL_UCODE_TLV_API_SAR_TABLE_VER = (__force iwl_ucode_tlv_api_t)55,
494 IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG = (__force iwl_ucode_tlv_api_t)56,
495 IWL_UCODE_TLV_API_ADWELL_HB_DEF_N_AP = (__force iwl_ucode_tlv_api_t)57,
496+ IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER = (__force iwl_ucode_tlv_api_t)58,
497
498 NUM_IWL_UCODE_TLV_API
499 #ifdef __CHECKER__
500diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.h b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.h
501index 75ceca4..f470ca4 100644
502--- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.h
503+++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.h
504@@ -204,9 +204,6 @@ struct iwl_dbg_cfg {
505 IWL_MVM_MOD_PARAM(bool, init_dbg)
506 IWL_MVM_MOD_PARAM(bool, tfd_q_hang_detect)
507 #endif /* CPTCFG_IWLMVM */
508-#ifdef CPTCFG_IWLWIFI_FRQ_MGR_TEST
509- IWL_DBG_CFG_NODEF(u8, fm_debug_mode)
510-#endif
511 #ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
512 IWL_DBG_CFG_NODEF(u32, dnt_out_mode)
513 /* XXX: should be dbgm_ or dbg_mon_ for consistency? */
514@@ -262,18 +259,17 @@ struct iwl_dbg_cfg {
515 IWL_DBG_CFG_STR(fw_dbg_conf)
516 IWL_DBG_CFG_STR(nvm_file)
517 IWL_DBG_CFG_STR(fw_file_pre)
518- IWL_DBG_CFG_NODEF(u32, d0i3_debug)
519 IWL_DBG_CFG_NODEF(u32, valid_ants)
520 IWL_DBG_CFG_NODEF(u32, no_ack_en)
521 IWL_DBG_CFG_NODEF(bool, no_ldpc)
522 IWL_DBG_CFG_NODEF(u16, rx_agg_subframes)
523+ IWL_DBG_CFG_NODEF(bool, tx_siso_80bw_like_160bw)
524 IWL_DBG_CFG_NODEF(u16, rx_mcs_80)
525 IWL_DBG_CFG_NODEF(u16, tx_mcs_80)
526 IWL_DBG_CFG_NODEF(u16, rx_mcs_160)
527 IWL_DBG_CFG_NODEF(u16, tx_mcs_160)
528 IWL_DBG_CFG_NODEF(u32, secure_boot_cfg)
529 IWL_MOD_PARAM(u32, uapsd_disable)
530- IWL_MOD_PARAM(bool, d0i3_disable)
531 IWL_MOD_PARAM(bool, lar_disable)
532 IWL_MOD_PARAM(bool, fw_monitor)
533 IWL_MOD_PARAM(bool, fw_restart)
534@@ -285,7 +281,6 @@ struct iwl_dbg_cfg {
535 IWL_MOD_PARAM(int, amsdu_size)
536 IWL_MOD_PARAM(int, swcrypto)
537 IWL_MOD_PARAM(uint, disable_11n)
538- IWL_MOD_PARAM(uint, d0i3_timeout)
539 IWL_DBG_CFG_BIN(he_ppe_thres)
540 IWL_DBG_CFG_NODEF(u8, he_chan_width_dis)
541 IWL_DBG_CFG_NODEF(u32, vht_cap_flip)
542diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
543index 2308b4f..c4bfbb8 100644
544--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
545+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
546@@ -2048,8 +2048,6 @@ struct iwl_mod_params iwlwifi_mod_params = {
547 .fw_restart = true,
548 .bt_coex_active = true,
549 .power_level = IWL_POWER_INDEX_1,
550- .d0i3_disable = true,
551- .d0i3_timeout = 1000,
552 .uapsd_disable = IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT,
553 /* the rest are 0 by default */
554 };
555@@ -2202,9 +2200,6 @@ MODULE_PARM_DESC(antenna_coupling,
556 module_param_named(nvm_file, iwlwifi_mod_params.nvm_file, charp, 0444);
557 MODULE_PARM_DESC(nvm_file, "NVM file name");
558
559-module_param_named(d0i3_disable, iwlwifi_mod_params.d0i3_disable, bool, 0444);
560-MODULE_PARM_DESC(d0i3_disable, "disable d0i3 functionality (default: N)");
561-
562 module_param_named(lar_disable, iwlwifi_mod_params.lar_disable, bool, 0444);
563 MODULE_PARM_DESC(lar_disable, "disable LAR functionality (default: N)");
564
565@@ -2252,9 +2247,6 @@ module_param_named(fw_monitor, iwlwifi_mod_params.fw_monitor, bool, 0444);
566 MODULE_PARM_DESC(fw_monitor,
567 "firmware monitor - to debug FW (default: false - needs lots of memory)");
568
569-module_param_named(d0i3_timeout, iwlwifi_mod_params.d0i3_timeout, uint, 0444);
570-MODULE_PARM_DESC(d0i3_timeout, "Timeout to D0i3 entry when idle (ms)");
571-
572 module_param_named(disable_11ac, iwlwifi_mod_params.disable_11ac, bool, 0444);
573 MODULE_PARM_DESC(disable_11ac, "Disable VHT capabilities (default: false)");
574
575diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
576index d8d1202..27d2cb3 100644
577--- a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
578+++ b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
579@@ -6,7 +6,7 @@
580 * GPL LICENSE SUMMARY
581 *
582 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
583- * Copyright(c) 2018 Intel Corporation
584+ * Copyright(c) 2018 - 2019 Intel Corporation
585 *
586 * This program is free software; you can redistribute it and/or modify
587 * it under the terms of version 2 of the GNU General Public License as
588@@ -27,7 +27,7 @@
589 * BSD LICENSE
590 *
591 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
592- * Copyright(c) 2018 Intel Corporation
593+ * Copyright(c) 2018 - 2019 Intel Corporation
594 * All rights reserved.
595 *
596 * Redistribution and use in source and binary forms, with or without
597@@ -116,9 +116,6 @@ enum iwl_uapsd_disable {
598 * @uapsd_disable: disable U-APSD, see &enum iwl_uapsd_disable, default =
599 * IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT
600 * @xvt_default_mode: xVT is the default operation mode, default = false
601- * @d0i3_disable: disable d0i3, default = 1,
602- * @d0i3_timeout: time to wait after no refs are taken before
603- * entering D0i3 (in msecs)
604 * @lar_disable: disable LAR (regulatory), default = 0
605 * @fw_monitor: allow to use firmware monitor
606 * @disable_11ac: disable VHT capabilities, default = false.
607@@ -144,8 +141,6 @@ struct iwl_mod_params {
608 #endif
609 char *nvm_file;
610 u32 uapsd_disable;
611- bool d0i3_disable;
612- unsigned int d0i3_timeout;
613 bool lar_disable;
614 bool fw_monitor;
615 bool disable_11ac;
616diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h
617index 2f4ecde..fcb0b69 100644
618--- a/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h
619+++ b/drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h
620@@ -166,9 +166,6 @@ struct iwl_test_ops {
621 * @nic_config: configure NIC, called before firmware is started.
622 * May sleep
623 * @wimax_active: invoked when WiMax becomes active. May sleep
624- * @enter_d0i3: configure the fw to enter d0i3. return 1 to indicate d0i3
625- * entrance is aborted (e.g. due to held reference). May sleep.
626- * @exit_d0i3: configure the fw to exit d0i3. May sleep.
627 */
628 struct iwl_op_mode_ops {
629 struct iwl_op_mode *(*start)(struct iwl_trans *trans,
630@@ -193,8 +190,6 @@ struct iwl_op_mode_ops {
631 #ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
632 struct iwl_test_ops test_ops;
633 #endif
634- int (*enter_d0i3)(struct iwl_op_mode *op_mode);
635- int (*exit_d0i3)(struct iwl_op_mode *op_mode);
636 };
637
638 int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops);
639@@ -287,22 +282,4 @@ static inline void iwl_op_mode_wimax_active(struct iwl_op_mode *op_mode)
640 op_mode->ops->wimax_active(op_mode);
641 }
642
643-static inline int iwl_op_mode_enter_d0i3(struct iwl_op_mode *op_mode)
644-{
645- might_sleep();
646-
647- if (!op_mode->ops->enter_d0i3)
648- return 0;
649- return op_mode->ops->enter_d0i3(op_mode);
650-}
651-
652-static inline int iwl_op_mode_exit_d0i3(struct iwl_op_mode *op_mode)
653-{
654- might_sleep();
655-
656- if (!op_mode->ops->exit_d0i3)
657- return 0;
658- return op_mode->ops->exit_d0i3(op_mode);
659-}
660-
661 #endif /* __iwl_op_mode_h__ */
662diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
663index 2c93164..7223469 100644
664--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
665+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
666@@ -205,17 +205,3 @@ int iwl_cmd_groups_verify_sorted(const struct iwl_trans_config *trans)
667 return 0;
668 }
669 IWL_EXPORT_SYMBOL(iwl_cmd_groups_verify_sorted);
670-
671-void iwl_trans_ref(struct iwl_trans *trans)
672-{
673- if (trans->ops->ref)
674- trans->ops->ref(trans);
675-}
676-IWL_EXPORT_SYMBOL(iwl_trans_ref);
677-
678-void iwl_trans_unref(struct iwl_trans *trans)
679-{
680- if (trans->ops->unref)
681- trans->ops->unref(trans);
682-}
683-IWL_EXPORT_SYMBOL(iwl_trans_unref);
684diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
685index 43cfa59..6d156ee 100644
686--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
687+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
688@@ -165,10 +165,6 @@ static inline u32 iwl_rx_packet_payload_len(const struct iwl_rx_packet *pkt)
689 * @CMD_ASYNC: Return right away and don't wait for the response
690 * @CMD_WANT_SKB: Not valid with CMD_ASYNC. The caller needs the buffer of
691 * the response. The caller needs to call iwl_free_resp when done.
692- * @CMD_SEND_IN_IDLE: The command should be sent even when the trans is idle.
693- * @CMD_MAKE_TRANS_IDLE: The command response should mark the trans as idle.
694- * @CMD_WAKE_UP_TRANS: The command response should wake up the trans
695- * (i.e. mark it as non-idle).
696 * @CMD_WANT_ASYNC_CALLBACK: the op_mode's async callback function must be
697 * called after this command completes. Valid only with CMD_ASYNC.
698 */
699@@ -176,10 +172,7 @@ enum CMD_MODE {
700 CMD_ASYNC = BIT(0),
701 CMD_WANT_SKB = BIT(1),
702 CMD_SEND_IN_RFKILL = BIT(2),
703- CMD_SEND_IN_IDLE = BIT(3),
704- CMD_MAKE_TRANS_IDLE = BIT(4),
705- CMD_WAKE_UP_TRANS = BIT(5),
706- CMD_WANT_ASYNC_CALLBACK = BIT(6),
707+ CMD_WANT_ASYNC_CALLBACK = BIT(3),
708 };
709
710 #define DEF_CMD_PAYLOAD_SIZE 320
711@@ -467,9 +460,8 @@ struct iwl_trans_rxq_dma_data {
712 *
713 * All the handlers MUST be implemented
714 *
715- * @start_hw: starts the HW. If low_power is true, the NIC needs to be taken
716- * out of a low power state. From that point on, the HW can send
717- * interrupts. May sleep.
718+ * @start_hw: starts the HW. From that point on, the HW can send interrupts.
719+ * May sleep.
720 * @op_mode_leave: Turn off the HW RF kill indication if on
721 * May sleep
722 * @start_fw: allocates and inits all the resources for the transport
723@@ -479,9 +471,8 @@ struct iwl_trans_rxq_dma_data {
724 * the SCD base address in SRAM, then provide it here, or 0 otherwise.
725 * May sleep
726 * @stop_device: stops the whole device (embedded CPU put to reset) and stops
727- * the HW. If low_power is true, the NIC will be put in low power state.
728- * From that point on, the HW will be stopped but will still issue an
729- * interrupt if the HW RF kill switch is triggered.
730+ * the HW. From that point on, the HW will be stopped but will still issue
731+ * an interrupt if the HW RF kill switch is triggered.
732 * This callback must do the right thing and not crash even if %start_hw()
733 * was called but not &start_fw(). May sleep.
734 * @d3_suspend: put the device into the correct mode for WoWLAN during
735@@ -539,11 +530,6 @@ struct iwl_trans_rxq_dma_data {
736 * @release_nic_access: let the NIC go to sleep. The "flags" parameter
737 * must be the same one that was sent before to the grab_nic_access.
738 * @set_bits_mask - set SRAM register according to value and mask.
739- * @ref: grab a reference to the transport/FW layers, disallowing
740- * certain low power states
741- * @unref: release a reference previously taken with @ref. Note that
742- * initially the reference count is 1, making an initial @unref
743- * necessary to allow low power states.
744 * @dump_data: return a vmalloc'ed buffer with debug data, maybe containing last
745 * TX'ed commands and similar. The buffer will be vfree'd by the caller.
746 * Note that the transport must fill in the proper file headers.
747@@ -552,7 +538,7 @@ struct iwl_trans_rxq_dma_data {
748 */
749 struct iwl_trans_ops {
750
751- int (*start_hw)(struct iwl_trans *iwl_trans, bool low_power);
752+ int (*start_hw)(struct iwl_trans *iwl_trans);
753 void (*op_mode_leave)(struct iwl_trans *iwl_trans);
754 #if IS_ENABLED(CPTCFG_IWLXVT)
755 int (*start_fw_dbg)(struct iwl_trans *trans, const struct fw_img *fw,
756@@ -562,7 +548,7 @@ struct iwl_trans_ops {
757 int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
758 bool run_in_rfkill);
759 void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
760- void (*stop_device)(struct iwl_trans *trans, bool low_power);
761+ void (*stop_device)(struct iwl_trans *trans);
762
763 void (*d3_suspend)(struct iwl_trans *trans, bool test, bool reset);
764 int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
765@@ -575,6 +561,8 @@ struct iwl_trans_ops {
766 void (*reclaim)(struct iwl_trans *trans, int queue, int ssn,
767 struct sk_buff_head *skbs);
768
769+ void (*set_q_ptrs)(struct iwl_trans *trans, int queue, int ptr);
770+
771 bool (*txq_enable)(struct iwl_trans *trans, int queue, u16 ssn,
772 const struct iwl_trans_txq_scd_cfg *cfg,
773 unsigned int queue_wdg_timeout);
774@@ -616,8 +604,6 @@ struct iwl_trans_ops {
775 unsigned long *flags);
776 void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask,
777 u32 value);
778- void (*ref)(struct iwl_trans *trans);
779- void (*unref)(struct iwl_trans *trans);
780 int (*suspend)(struct iwl_trans *trans);
781 void (*resume)(struct iwl_trans *trans);
782
783@@ -641,9 +627,6 @@ enum iwl_trans_state {
784 /**
785 * DOC: Platform power management
786 *
787- * There are two types of platform power management: system-wide
788- * (WoWLAN) and runtime.
789- *
790 * In system-wide power management the entire platform goes into a low
791 * power state (e.g. idle or suspend to RAM) at the same time and the
792 * device is configured as a wakeup source for the entire platform.
793@@ -652,55 +635,34 @@ enum iwl_trans_state {
794 * put the platform in low power mode). The device's behavior in this
795 * mode is dictated by the wake-on-WLAN configuration.
796 *
797- * In runtime power management, only the devices which are themselves
798- * idle enter a low power state. This is done at runtime, which means
799- * that the entire system is still running normally. This mode is
800- * usually triggered automatically by the device driver and requires
801- * the ability to enter and exit the low power modes in a very short
802- * time, so there is not much impact in usability.
803- *
804 * The terms used for the device's behavior are as follows:
805 *
806 * - D0: the device is fully powered and the host is awake;
807 * - D3: the device is in low power mode and only reacts to
808 * specific events (e.g. magic-packet received or scan
809 * results found);
810- * - D0I3: the device is in low power mode and reacts to any
811- * activity (e.g. RX);
812 *
813 * These terms reflect the power modes in the firmware and are not to
814- * be confused with the physical device power state. The NIC can be
815- * in D0I3 mode even if, for instance, the PCI device is in D3 state.
816+ * be confused with the physical device power state.
817 */
818
819 /**
820 * enum iwl_plat_pm_mode - platform power management mode
821 *
822 * This enumeration describes the device's platform power management
823- * behavior when in idle mode (i.e. runtime power management) or when
824- * in system-wide suspend (i.e WoWLAN).
825+ * behavior when in system-wide suspend (i.e WoWLAN).
826 *
827 * @IWL_PLAT_PM_MODE_DISABLED: power management is disabled for this
828- * device. At runtime, this means that nothing happens and the
829- * device always remains in active. In system-wide suspend mode,
830- * it means that the all connections will be closed automatically
831- * by mac80211 before the platform is suspended.
832+ * device. In system-wide suspend mode, it means that the all
833+ * connections will be closed automatically by mac80211 before
834+ * the platform is suspended.
835 * @IWL_PLAT_PM_MODE_D3: the device goes into D3 mode (i.e. WoWLAN).
836- * For runtime power management, this mode is not officially
837- * supported.
838- * @IWL_PLAT_PM_MODE_D0I3: the device goes into D0I3 mode.
839 */
840 enum iwl_plat_pm_mode {
841 IWL_PLAT_PM_MODE_DISABLED,
842 IWL_PLAT_PM_MODE_D3,
843- IWL_PLAT_PM_MODE_D0I3,
844 };
845
846-/* Max time to wait for trans to become idle/non-idle on d0i3
847- * enter/exit (in msecs).
848- */
849-#define IWL_TRANS_IDLE_TIMEOUT (CPTCFG_IWL_TIMEOUT_FACTOR * 2000)
850-
851 /* Max time to wait for nmi interrupt */
852 #define IWL_TRANS_NMI_TIMEOUT (HZ / 4 * CPTCFG_IWL_TIMEOUT_FACTOR)
853
854@@ -806,9 +768,6 @@ struct iwl_trans_debug {
855 * @system_pm_mode: the system-wide power management mode in use.
856 * This mode is set dynamically, depending on the WoWLAN values
857 * configured from the userspace at runtime.
858- * @runtime_pm_mode: the runtime power management mode in use. This
859- * mode is set during the initialization phase and is not
860- * supposed to change during runtime.
861 */
862 struct iwl_trans {
863 const struct iwl_trans_ops *ops;
864@@ -857,7 +816,6 @@ struct iwl_trans {
865 struct iwl_self_init_dram init_dram;
866
867 enum iwl_plat_pm_mode system_pm_mode;
868- enum iwl_plat_pm_mode runtime_pm_mode;
869
870 #ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
871 struct iwl_testmode testmode;
872@@ -880,16 +838,11 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
873 WARN_ON(iwl_cmd_groups_verify_sorted(trans_cfg));
874 }
875
876-static inline int _iwl_trans_start_hw(struct iwl_trans *trans, bool low_power)
877+static inline int iwl_trans_start_hw(struct iwl_trans *trans)
878 {
879 might_sleep();
880
881- return trans->ops->start_hw(trans, low_power);
882-}
883-
884-static inline int iwl_trans_start_hw(struct iwl_trans *trans)
885-{
886- return trans->ops->start_hw(trans, true);
887+ return trans->ops->start_hw(trans);
888 }
889
890 static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans)
891@@ -950,21 +903,15 @@ static inline int iwl_trans_start_fw_dbg(struct iwl_trans *trans,
892 }
893 #endif
894
895-static inline void _iwl_trans_stop_device(struct iwl_trans *trans,
896- bool low_power)
897+static inline void iwl_trans_stop_device(struct iwl_trans *trans)
898 {
899 might_sleep();
900
901- trans->ops->stop_device(trans, low_power);
902+ trans->ops->stop_device(trans);
903
904 trans->state = IWL_TRANS_NO_FW;
905 }
906
907-static inline void iwl_trans_stop_device(struct iwl_trans *trans)
908-{
909- _iwl_trans_stop_device(trans, true);
910-}
911-
912 static inline void iwl_trans_d3_suspend(struct iwl_trans *trans, bool test,
913 bool reset)
914 {
915@@ -1045,6 +992,17 @@ static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
916 trans->ops->reclaim(trans, queue, ssn, skbs);
917 }
918
919+static inline void iwl_trans_set_q_ptrs(struct iwl_trans *trans, int queue,
920+ int ptr)
921+{
922+ if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
923+ IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
924+ return;
925+ }
926+
927+ trans->ops->set_q_ptrs(trans, queue, ptr);
928+}
929+
930 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue,
931 bool configure_scd)
932 {
933@@ -1324,8 +1282,6 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
934 const struct iwl_cfg *cfg,
935 const struct iwl_trans_ops *ops);
936 void iwl_trans_free(struct iwl_trans *trans);
937-void iwl_trans_ref(struct iwl_trans *trans);
938-void iwl_trans_unref(struct iwl_trans *trans);
939
940 /*****************************************************
941 * driver (transport) register/unregister functions
942diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
943index 8e43da7..256e08b 100644
944--- a/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
945+++ b/drivers/net/wireless/intel/iwlwifi/mvm/Makefile
946@@ -16,5 +16,3 @@ ccflags-y += -I$(src)/../
947
948 # non-upstream things
949 iwlmvm-$(CPTCFG_IWLMVM_VENDOR_CMDS) += vendor-cmd.o
950-iwlmvm-$(CPTCFG_IWLWIFI_FRQ_MGR) += fm-ops.o
951-iwlmvm-$(CPTCFG_IWLWIFI_FRQ_MGR_TEST) += fm-test.o
952diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
953index bd9c105..7fb4ac9 100644
954--- a/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
955+++ b/drivers/net/wireless/intel/iwlwifi/mvm/coex.c
956@@ -7,7 +7,7 @@
957 *
958 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
959 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
960- * Copyright(c) 2018 Intel Corporation
961+ * Copyright(c) 2018 - 2019 Intel Corporation
962 *
963 * This program is free software; you can redistribute it and/or modify
964 * it under the terms of version 2 of the GNU General Public License as
965@@ -29,7 +29,7 @@
966 *
967 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
968 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
969- * Copyright(c) 2018 Intel Corporation
970+ * Copyright(c) 2018 - 2019 Intel Corporation
971 * All rights reserved.
972 *
973 * Redistribution and use in source and binary forms, with or without
974@@ -69,10 +69,6 @@
975 #include "mvm.h"
976 #include "iwl-debug.h"
977
978-#ifdef CPTCFG_IWLWIFI_LTE_COEX
979-#include "lte-coex.h"
980-#endif
981-
982 /* 20MHz / 40MHz below / 40Mhz above*/
983 static const __le64 iwl_ci_mask[][3] = {
984 /* dummy entry for channel 0 */
985@@ -622,11 +618,6 @@ u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
986 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id))
987 return LINK_QUAL_AGG_TIME_LIMIT_DEF;
988
989-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
990- /* 2G coex */
991- if (mvm->coex_2g_enabled)
992- return LINK_QUAL_AGG_TIME_LIMIT_BT_ACT;
993-#endif
994 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
995 BT_HIGH_TRAFFIC)
996 return LINK_QUAL_AGG_TIME_LIMIT_DEF;
997@@ -751,150 +742,3 @@ void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
998 iwl_mvm_bt_coex_notif_handle(mvm);
999 }
1000
1001-#ifdef CPTCFG_IWLWIFI_LTE_COEX
1002-int iwl_mvm_send_lte_coex_config_cmd(struct iwl_mvm *mvm)
1003-{
1004- const struct iwl_lte_coex_config_cmd *cmd = &mvm->lte_state.config;
1005-
1006- if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_LTE_COEX)) {
1007- IWL_DEBUG_COEX(mvm, "LTE-Coex not supported!\n");
1008- return -EOPNOTSUPP;
1009- }
1010-
1011- IWL_DEBUG_COEX(mvm, "LTE-Coex: lte_coex_config_cmd:\n"
1012- "\tstate: %d\n\tband: %d\n\tchan: %d\n",
1013- le32_to_cpu(cmd->lte_state), le32_to_cpu(cmd->lte_band),
1014- le32_to_cpu(cmd->lte_chan));
1015-
1016- IWL_DEBUG_COEX(mvm, "\ttx safe freq min: %d\n\ttx safe freq max: %d\n"
1017- "\trx safe freq min: %d\n\trx safe freq max: %d\n",
1018- le32_to_cpu(cmd->tx_safe_freq_min),
1019- le32_to_cpu(cmd->tx_safe_freq_max),
1020- le32_to_cpu(cmd->rx_safe_freq_min),
1021- le32_to_cpu(cmd->rx_safe_freq_max));
1022-
1023- return iwl_mvm_send_cmd_pdu(mvm, LTE_COEX_CONFIG_CMD, 0, sizeof(*cmd),
1024- cmd);
1025-}
1026-
1027-int iwl_mvm_send_lte_coex_wifi_reported_channel_cmd(struct iwl_mvm *mvm)
1028-{
1029- const struct iwl_lte_coex_wifi_reported_channel_cmd *cmd =
1030- &mvm->lte_state.rprtd_chan;
1031-
1032- if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_LTE_COEX)) {
1033- IWL_DEBUG_COEX(mvm, "LTE-Coex not supported!\n");
1034- return -EOPNOTSUPP;
1035- }
1036-
1037- IWL_DEBUG_COEX(mvm, "LTE-COEX: lte_coex_wifi_reported_channel_cmd:\n"
1038- "\tchannel: %d\n\tbandwidth: %d\n",
1039- le32_to_cpu(cmd->channel), le32_to_cpu(cmd->bandwidth));
1040-
1041- return iwl_mvm_send_cmd_pdu(mvm, LTE_COEX_WIFI_REPORTED_CHANNEL_CMD,
1042- 0, sizeof(*cmd), cmd);
1043-}
1044-
1045-int iwl_mvm_send_lte_coex_static_params_cmd(struct iwl_mvm *mvm)
1046-{
1047- const struct iwl_lte_coex_static_params_cmd *cmd = &mvm->lte_state.stat;
1048-
1049- if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_LTE_COEX)) {
1050- IWL_DEBUG_COEX(mvm, "LTE-Coex not supported!\n");
1051- return -EOPNOTSUPP;
1052- }
1053-
1054- IWL_DEBUG_COEX(mvm, "LTE-COEX: lte_coex_static_params_cmd:\n"
1055- "\tmfu config[0]: %d\n\ttx power[0]: %d\n",
1056- le32_to_cpu(cmd->mfu_config[0]),
1057- cmd->tx_power_in_dbm[0]);
1058-
1059- return iwl_mvm_send_cmd_pdu(mvm, LTE_COEX_STATIC_PARAMS_CMD, 0,
1060- sizeof(*cmd), cmd);
1061-}
1062-
1063-int iwl_mvm_send_lte_fine_tuning_params_cmd(struct iwl_mvm *mvm)
1064-{
1065- const struct iwl_lte_coex_fine_tuning_params_cmd *cmd =
1066- &mvm->lte_state.ft;
1067-
1068- if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_LTE_COEX)) {
1069- IWL_DEBUG_COEX(mvm, "LTE-Coex not supported!\n");
1070- return -EOPNOTSUPP;
1071- }
1072-
1073- IWL_DEBUG_COEX(mvm, "LTE-COEX: lte_fine_tuning_params_cmd:\n"
1074- "\trx protection assert timing: %d\n",
1075- le32_to_cpu(cmd->rx_protection_assert_timing));
1076-
1077- IWL_DEBUG_COEX(mvm, "\ttx protection assert timing: %d\n"
1078- "\trx protection timeout: %d\n\tmin tx power: %d\n",
1079- le32_to_cpu(cmd->tx_protection_assert_timing),
1080- le32_to_cpu(cmd->rx_protection_timeout),
1081- le32_to_cpu(cmd->min_tx_power));
1082-
1083- IWL_DEBUG_COEX(mvm, "\tul load uapsd threshold: %d\n"
1084- "\trx failure during ul uapsd threshold: %d\n",
1085- le32_to_cpu(cmd->lte_ul_load_uapsd_threshold),
1086- le32_to_cpu(cmd->rx_failure_during_ul_uapsd_threshold));
1087-
1088- IWL_DEBUG_COEX(mvm,
1089- "\trx failure during ul scan compensation threshold: %d\n"
1090- "\trx duration for ack protection: %d\n",
1091- le32_to_cpu(cmd->rx_failure_during_ul_sc_threshold),
1092- le32_to_cpu(cmd->rx_duration_for_ack_protection_us));
1093-
1094- IWL_DEBUG_COEX(mvm, "\tbeacon failure during ul counter: %d\n"
1095- "\tdtim failure during ul counter: %d\n",
1096- le32_to_cpu(cmd->beacon_failure_during_ul_counter),
1097- le32_to_cpu(cmd->dtim_failure_during_ul_counter));
1098-
1099- return iwl_mvm_send_cmd_pdu(mvm, LTE_COEX_FINE_TUNING_PARAMS_CMD,
1100- 0, sizeof(*cmd), cmd);
1101-}
1102-
1103-int iwl_mvm_send_lte_sps_cmd(struct iwl_mvm *mvm)
1104-{
1105- const struct iwl_lte_coex_sps_cmd *cmd = &mvm->lte_state.sps;
1106-
1107- if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_LTE_COEX)) {
1108- IWL_DEBUG_COEX(mvm, "LTE-Coex not supported!\n");
1109- return -EOPNOTSUPP;
1110- }
1111-
1112- IWL_DEBUG_COEX(mvm, "LTE-COEX: lte_sps_cmd:\n\tsps info: %d\n",
1113- le32_to_cpu(cmd->lte_semi_persistent_info));
1114-
1115- return iwl_mvm_send_cmd_pdu(mvm, LTE_COEX_SPS_CMD, 0, sizeof(*cmd),
1116- cmd);
1117-}
1118-
1119-void iwl_mvm_reset_lte_state(struct iwl_mvm *mvm)
1120-{
1121- struct lte_coex_state *lte_state = &mvm->lte_state;
1122-
1123- lte_state->state = LTE_OFF;
1124- lte_state->has_config = 0;
1125- lte_state->has_rprtd_chan = 0;
1126- lte_state->has_sps = 0;
1127- lte_state->has_ft = 0;
1128-}
1129-
1130-void iwl_mvm_send_lte_commands(struct iwl_mvm *mvm)
1131-{
1132- struct lte_coex_state *lte_state = &mvm->lte_state;
1133-
1134- lockdep_assert_held(&mvm->mutex);
1135-
1136- if (lte_state->has_static)
1137- iwl_mvm_send_lte_coex_static_params_cmd(mvm);
1138- if (lte_state->has_rprtd_chan)
1139- iwl_mvm_send_lte_coex_wifi_reported_channel_cmd(mvm);
1140- if (lte_state->state != LTE_OFF)
1141- iwl_mvm_send_lte_coex_config_cmd(mvm);
1142- if (lte_state->has_sps)
1143- iwl_mvm_send_lte_sps_cmd(mvm);
1144- if (lte_state->has_ft)
1145- iwl_mvm_send_lte_fine_tuning_params_cmd(mvm);
1146-}
1147-#endif /* CPTCFG_IWLWIFI_LTE_COEX */
1148diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1149index 68814b9..5e6cd75 100644
1150--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1151+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1152@@ -831,6 +831,8 @@ iwl_mvm_wowlan_config(struct iwl_mvm *mvm,
1153 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa,
1154 IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
1155
1156+ mvm->offload_tid = wowlan_config_cmd->offloading_tid;
1157+
1158 if (!unified_image) {
1159 ret = iwl_mvm_switch_to_d3(mvm);
1160 if (ret)
1161@@ -1656,6 +1658,13 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
1162 mvm_ap_sta->tid_data[i].seq_number = seq;
1163 }
1164
1165+ if (mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
1166+ i = mvm->offload_tid;
1167+ iwl_trans_set_q_ptrs(mvm->trans,
1168+ mvm_ap_sta->tid_data[i].txq_id,
1169+ mvm_ap_sta->tid_data[i].seq_number >> 4);
1170+ }
1171+
1172 /* now we have all the data we need, unlock to avoid mac80211 issues */
1173 mutex_unlock(&mvm->mutex);
1174
1175diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
1176index 02ff26d..222c4c8 100644
1177--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
1178+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
1179@@ -8,7 +8,7 @@
1180 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
1181 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1182 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
1183- * Copyright(c) 2018 Intel Corporation
1184+ * Copyright(c) 2018 - 2019 Intel Corporation
1185 *
1186 * This program is free software; you can redistribute it and/or modify
1187 * it under the terms of version 2 of the GNU General Public License as
1188@@ -31,7 +31,7 @@
1189 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
1190 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1191 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
1192- * Copyright(c) 2018 Intel Corporation
1193+ * Copyright(c) 2018 - 2019 Intel Corporation
1194 * All rights reserved.
1195 *
1196 * Redistribution and use in source and binary forms, with or without
1197@@ -201,19 +201,6 @@ static ssize_t iwl_dbgfs_tx_pwr_lmt_read(struct file *file,
1198 pos = scnprintf(buf, bufsz, "bss limit = %d\n",
1199 vif->bss_conf.txpower);
1200
1201-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
1202- {
1203- struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1204- struct iwl_mvm *mvm = mvmvif->mvm;
1205-
1206- mutex_lock(&mvm->mutex);
1207- if (mvmvif->phy_ctxt)
1208- pos += scnprintf(buf + pos, bufsz - pos, "fm limit = %d\n",
1209- mvmvif->phy_ctxt->fm_tx_power_limit);
1210- mutex_unlock(&mvm->mutex);
1211- }
1212-#endif
1213-
1214 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1215 }
1216
1217diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fm-ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/fm-ops.c
1218deleted file mode 100644
1219index f312f90..0000000
1220--- a/drivers/net/wireless/intel/iwlwifi/mvm/fm-ops.c
1221+++ /dev/null
1222@@ -1,837 +0,0 @@
1223-/******************************************************************************
1224- *
1225- * This file is provided under a dual BSD/GPLv2 license. When using or
1226- * redistributing this file, you may do so under either license.
1227- *
1228- * GPL LICENSE SUMMARY
1229- *
1230- * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
1231- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1232- *
1233- * This program is free software; you can redistribute it and/or modify
1234- * it under the terms of version 2 of the GNU General Public License as
1235- * published by the Free Software Foundation.
1236- *
1237- * This program is distributed in the hope that it will be useful, but
1238- * WITHOUT ANY WARRANTY; without even the implied warranty of
1239- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1240- * General Public License for more details.
1241- *
1242- * The full GNU General Public License is included in this distribution
1243- * in the file called COPYING.
1244- *
1245- * Contact Information:
1246- * Intel Linux Wireless <linuxwifi@intel.com>
1247- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
1248- *
1249- * BSD LICENSE
1250- *
1251- * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
1252- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1253- * All rights reserved.
1254- *
1255- * Redistribution and use in source and binary forms, with or without
1256- * modification, are permitted provided that the following conditions
1257- * are met:
1258- *
1259- * * Redistributions of source code must retain the above copyright
1260- * notice, this list of conditions and the following disclaimer.
1261- * * Redistributions in binary form must reproduce the above copyright
1262- * notice, this list of conditions and the following disclaimer in
1263- * the documentation and/or other materials provided with the
1264- * distribution.
1265- * * Neither the name Intel Corporation nor the names of its
1266- * contributors may be used to endorse or promote products derived
1267- * from this software without specific prior written permission.
1268- *
1269- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1270- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1271- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1272- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1273- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1274- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1275- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1276- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1277- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1278- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1279- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1280- *
1281- *****************************************************************************/
1282-#include <linux/fm/iui_fm.h>
1283-#include "mvm.h"
1284-
1285-/*
1286- * Used in the FM callback and is declared here since according
1287- * to the FM API, the callback does not receive an mvm pointer
1288- */
1289-static struct iwl_mvm *g_mvm;
1290-
1291-/* If in debug mode use the fm-test module instead of the original fm API */
1292-static bool debug_mode;
1293-
1294-struct chan_ifaces {
1295- struct iui_fm_wlan_channel_tx_power *chan_txpwr;
1296- int num_of_vif; /* for statistics */
1297-};
1298-
1299-struct chan_list {
1300- struct iui_fm_wlan_info *winfo;
1301- enum iwl_fm_chan_change_action action;
1302-};
1303-
1304-/* last reported channel notification to the FM */
1305-static struct iui_fm_wlan_info last_chan_notif;
1306-/* last dcdc values requested by the FM */
1307-static int g_dcdc_div0;
1308-static int g_dcdc_div1;
1309-
1310-static struct work_struct fm_chan_notif_wk;
1311-
1312-/*
1313- * Search for an interface with a given frequency
1314- */
1315-static void iwl_mvm_fm_iface_iterator(void *_data, u8 *mac,
1316- struct ieee80211_vif *vif)
1317-{
1318- struct chan_ifaces *data = _data;
1319- struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1320- struct ieee80211_chanctx_conf *chanctx_conf;
1321-
1322- /* P2P device or NAN are never assigned a channel */
1323- if ((vif->type == NL80211_IFTYPE_P2P_DEVICE) ||
1324- (vif->type == NL80211_IFTYPE_NAN))
1325- return;
1326-
1327- rcu_read_lock();
1328-
1329- chanctx_conf = rcu_dereference(vif->chanctx_conf);
1330- /* make sure the channel context is assigned */
1331- if (!chanctx_conf) {
1332- rcu_read_unlock();
1333- return;
1334- }
1335-
1336- if (chanctx_conf->min_def.center_freq1 ==
1337- KHZ_TO_MHZ(data->chan_txpwr->frequency)) {
1338- mvmvif->phy_ctxt->fm_tx_power_limit =
1339- data->chan_txpwr->max_tx_pwr;
1340- data->num_of_vif++;
1341- rcu_read_unlock();
1342- /* FM requests to remove Tx power limitation */
1343- if (data->chan_txpwr->max_tx_pwr == IUI_FM_WLAN_NO_TX_PWR_LIMIT)
1344- data->chan_txpwr->max_tx_pwr =
1345- IWL_DEFAULT_MAX_TX_POWER;
1346-
1347- iwl_mvm_fm_set_tx_power(g_mvm, vif,
1348- data->chan_txpwr->max_tx_pwr);
1349- return;
1350- }
1351-
1352- rcu_read_unlock();
1353-}
1354-
1355-/*
1356- * Search for an interface with a given frequency
1357- */
1358-static void iwl_mvm_fm_chan_vldt_iter(void *_data, u8 *mac,
1359- struct ieee80211_vif *vif)
1360-{
1361- struct chan_ifaces *data = _data;
1362- struct ieee80211_chanctx_conf *chanctx_conf;
1363-
1364- rcu_read_lock();
1365-
1366- chanctx_conf = rcu_dereference(vif->chanctx_conf);
1367- /* make sure the channel context is assigned */
1368- if (!chanctx_conf) {
1369- rcu_read_unlock();
1370- return;
1371- }
1372-
1373- if (chanctx_conf->min_def.center_freq1 ==
1374- KHZ_TO_MHZ(data->chan_txpwr->frequency))
1375- data->num_of_vif++;
1376-
1377- rcu_read_unlock();
1378-}
1379-
1380-static enum iui_fm_wlan_bandwidth
1381-iwl_mvm_fm_get_bandwidth(enum nl80211_chan_width bandwidth)
1382-{
1383- switch (bandwidth) {
1384- case NL80211_CHAN_WIDTH_20_NOHT:
1385- return IUI_FM_WLAN_BW_20MHZ;
1386- case NL80211_CHAN_WIDTH_20:
1387- return IUI_FM_WLAN_BW_20MHZ;
1388- case NL80211_CHAN_WIDTH_40:
1389- return IUI_FM_WLAN_BW_40MHZ;
1390- case NL80211_CHAN_WIDTH_80:
1391- return IUI_FM_WLAN_BW_80MHZ;
1392- case NL80211_CHAN_WIDTH_160:
1393- return IUI_FM_WLAN_BW_160MHZ;
1394- default:
1395- return IUI_FM_WLAN_BW_INVALID;
1396- }
1397-}
1398-
1399-/*
1400- * Search for all channels used by interfaces
1401- */
1402-static void iwl_mvm_fm_chan_iterator(struct ieee80211_hw *hw,
1403- struct ieee80211_chanctx_conf *ctx,
1404- void *_data)
1405-{
1406- int i;
1407- enum nl80211_chan_width band;
1408- u32 freq;
1409- struct chan_list *data = _data;
1410- struct iui_fm_wlan_info *winfo = data->winfo;
1411-
1412- if (winfo->num_channels == IUI_FM_WLAN_MAX_CHANNELS)
1413- return;
1414-
1415- freq = MHZ_TO_KHZ(ctx->min_def.center_freq1);
1416- band = ctx->min_def.width;
1417-
1418- for (i = 0; i < winfo->num_channels; i++)
1419- if (winfo->channel_info[i].frequency == freq) {
1420- /*
1421- * channel exists - but bandwidth maybe invalid since
1422- * we are removing a ctx that operates on this channel
1423- */
1424- winfo->channel_info[winfo->num_channels].bandwidth =
1425- iwl_mvm_fm_get_bandwidth(band);
1426- return; /* channel already exists in list */
1427- }
1428-
1429- winfo->channel_info[winfo->num_channels].frequency = freq;
1430- winfo->channel_info[winfo->num_channels].bandwidth =
1431- iwl_mvm_fm_get_bandwidth(band);
1432-
1433- winfo->num_channels++;
1434-}
1435-
1436-/*
1437- * Handling Frequency Managers Tx power mitigation Request.
1438- * Reducing the Tx power of all interfaces that use a specific channel.
1439- */
1440-static enum iui_fm_mitigation_status
1441-iwl_mvm_fm_mitig_txpwr(struct iui_fm_wlan_mitigation *mit)
1442-{
1443- int i;
1444- struct chan_ifaces chan_ifaces;
1445- struct iui_fm_wlan_channel_tx_power *chan_txpwr_list =
1446- mit->channel_tx_pwr;
1447- u32 num_channels = mit->num_channels;
1448-
1449- /* Not required to mitigate tx power */
1450- if (!(mit->bitmask & WLAN_MITI))
1451- goto ret;
1452-
1453- if (IUI_FM_WLAN_MAX_CHANNELS < num_channels)
1454- return IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1455-
1456- for (i = 0; i < num_channels; i++) {
1457- chan_ifaces.chan_txpwr = &chan_txpwr_list[i];
1458- chan_ifaces.num_of_vif = 0;
1459- /* find all interfaces that use this channel */
1460- ieee80211_iterate_active_interfaces(g_mvm->hw,
1461- IEEE80211_IFACE_ITER_NORMAL,
1462- iwl_mvm_fm_iface_iterator,
1463- &chan_ifaces);
1464- IWL_DEBUG_EXTERNAL(g_mvm,
1465- "FM: Changed Tx power to %d for %d"
1466- " vifs on channel %d\n",
1467- chan_ifaces.chan_txpwr->max_tx_pwr,
1468- chan_ifaces.num_of_vif,
1469- chan_ifaces.chan_txpwr->frequency);
1470- }
1471-ret:
1472- return IUI_FM_MITIGATION_COMPLETE_OK;
1473-}
1474-
1475-/*
1476- * Handling Frequency Managers ADC/DAC mitigation Request
1477- * TODO: implement
1478- */
1479-static enum iui_fm_mitigation_status
1480-iwl_mvm_fm_mitig_adc_dac_freq(struct iui_fm_wlan_mitigation *mit)
1481-{
1482- u32 adc_dac_freq = mit->wlan_adc_dac_freq;
1483-
1484- /* Not required to mitigate adc dac */
1485- if (!(mit->bitmask & WLAN_MITI))
1486- goto ret;
1487-
1488- if (adc_dac_freq != 0)
1489- return IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1490-
1491- IWL_DEBUG_EXTERNAL(g_mvm, "FM: adc - dac mitigation\n");
1492-ret:
1493- return IUI_FM_MITIGATION_COMPLETE_OK;
1494-}
1495-
1496-/*
1497- * Handling Frequency Managers Rx Gain mitigation Request
1498- * TODO: implement
1499- */
1500-static enum iui_fm_mitigation_status
1501-iwl_mvm_fm_mitig_rxgain_behavior(struct iui_fm_wlan_mitigation *mit)
1502-{
1503- enum iui_fm_wlan_rx_gain_behavior rx_gain = mit->rx_gain_behavior;
1504-
1505- /* Not required to mitigate rx gain */
1506- if (!(mit->bitmask & WLAN_MITI))
1507- goto ret;
1508-
1509- if (rx_gain != IUI_FM_WLAN_RX_GAIN_NORMAL)
1510- return IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1511-
1512- IWL_DEBUG_EXTERNAL(g_mvm,
1513- "FM: rxgain behaviour mitigation - not implemented\n");
1514-ret:
1515- return IUI_FM_MITIGATION_COMPLETE_OK;
1516-}
1517-
1518-/*
1519- * Enables/Disable 2G coex mode - aggregation limiting.
1520- */
1521-static enum iui_fm_mitigation_status
1522-iwl_mvm_fm_2g_coex(struct iui_fm_wlan_mitigation *mit)
1523-{
1524- enum iui_fm_mitigation_status ret = IUI_FM_MITIGATION_COMPLETE_OK;
1525- struct iwl_config_2g_coex_cmd cmd = {};
1526- int i;
1527- struct iui_fm_wlan_channel_tx_power *chan;
1528- struct iui_fm_wlan_channel_tx_power *chan_txpwr_list =
1529- mit->channel_tx_pwr;
1530- u32 num_channels = mit->num_channels;
1531-
1532- /* Not required to mitigate 2g coex */
1533- if (!(mit->bitmask & WLAN_MITI))
1534- return ret;
1535-
1536- /* fw does not support the 2g coex cmd */
1537- if (!fw_has_capa(&g_mvm->fw->ucode_capa,
1538- IWL_UCODE_TLV_CAPA_2G_COEX_SUPPORT))
1539- goto sofia_xmm;
1540-
1541- /* No need to change 2g coex state */
1542- if (g_mvm->coex_2g_enabled == mit->wlan_2g_coex_enable)
1543- return ret;
1544-
1545- g_mvm->coex_2g_enabled = mit->wlan_2g_coex_enable;
1546-
1547- cmd.enabled = cpu_to_le32(g_mvm->coex_2g_enabled);
1548-
1549- mutex_lock(&g_mvm->mutex);
1550- ret = iwl_mvm_send_cmd_pdu(g_mvm, CONFIG_2G_COEX_CMD, 0, sizeof(cmd),
1551- &cmd);
1552- mutex_unlock(&g_mvm->mutex);
1553- if (ret) {
1554- IWL_ERR(g_mvm, "Failed to send 2g coex command(%sabling)\n",
1555- g_mvm->coex_2g_enabled ? "en" : "dis");
1556- return IUI_FM_MITIGATION_ERROR;
1557- }
1558- IWL_DEBUG_EXTERNAL(g_mvm,
1559- "FM 2G coex: %sabling 2G coex mode (sent fw cmd)\n",
1560- g_mvm->coex_2g_enabled ? "en" : "dis");
1561- return ret;
1562-
1563-sofia_xmm:
1564- /* Flow for SOFIA 3G & XMM6321 - don't support the 2g coex cmd */
1565- if (IUI_FM_WLAN_MAX_CHANNELS < num_channels)
1566- return IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1567-
1568- for (i = 0; i < num_channels; i++) {
1569- chan = &chan_txpwr_list[i];
1570- if (chan->frequency == FM_2G_COEX_ENABLE_DISABLE) {
1571- mutex_lock(&g_mvm->mutex);
1572- if (chan->max_tx_pwr == FM_2G_COEX_ENABLE) {
1573- g_mvm->coex_2g_enabled = true;
1574- } else if (chan->max_tx_pwr == FM_2G_COEX_DISABLE) {
1575- g_mvm->coex_2g_enabled = false;
1576- } else {
1577- IWL_DEBUG_EXTERNAL(g_mvm,
1578- "FM 2G coex: ERROR: Invalid paramters for enable/disable(%d)\n",
1579- chan->max_tx_pwr);
1580- ret = IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1581- }
1582- IWL_DEBUG_EXTERNAL(g_mvm,
1583- "FM 2G coex: %sabling 2G coex mode\n",
1584- g_mvm->coex_2g_enabled ?
1585- "en" : "dis");
1586- mutex_unlock(&g_mvm->mutex);
1587- break;
1588- }
1589- }
1590-
1591- return ret;
1592-}
1593-
1594-static int iwl_mvm_fm_send_dcdc_cmd(u32 div0, u32 div1, u32 flags)
1595-{
1596- int ret;
1597- struct iwl_dc2dc_config_resp *resp;
1598- struct iwl_rx_packet *pkt;
1599- struct iwl_dc2dc_config_cmd dcdc = {
1600- .flags = cpu_to_le32(flags),
1601- .dc2dc_freq_tune0 = cpu_to_le32(div0),
1602- .dc2dc_freq_tune1 = cpu_to_le32(div1),
1603- };
1604- struct iwl_host_cmd cmd = {
1605- .id = DC2DC_CONFIG_CMD,
1606- .flags = CMD_WANT_SKB,
1607- .data = { &dcdc },
1608- .len = { sizeof(struct iwl_dc2dc_config_cmd) },
1609- };
1610-
1611- /* fw does not support the dcdc cmd */
1612- if (!fw_has_capa(&g_mvm->fw->ucode_capa,
1613- IWL_UCODE_TLV_CAPA_DC2DC_CONFIG_SUPPORT))
1614- return -EINVAL;
1615-
1616- ret = iwl_mvm_send_cmd(g_mvm, &cmd);
1617-
1618- if (ret) {
1619- IWL_ERR(g_mvm, "FM: Failed to send dcdc cmd (ret = %d)\n", ret);
1620- return ret;
1621- }
1622-
1623- pkt = cmd.resp_pkt;
1624- if (!pkt) {
1625- IWL_ERR(g_mvm, "FM: Error DCDC cmd response is NULL\n");
1626- return -EIO;
1627- }
1628- resp = (void *)pkt->data;
1629-
1630- /* update the current dcdc values */
1631- g_dcdc_div0 = le32_to_cpu(resp->dc2dc_freq_tune0);
1632- g_dcdc_div1 = le32_to_cpu(resp->dc2dc_freq_tune1);
1633-
1634- iwl_free_resp(&cmd);
1635- return ret;
1636-}
1637-
1638-/*
1639- * Enables/Disable DCDC mitigation
1640- * In some scenarios, DCDC inserts noise to FMR due to its (DCDC's)
1641- * internal clock rate. When WiFi is ON the noise level is very high,
1642- * and therefore DCDC needs to change its clock rate.
1643- */
1644-static enum iui_fm_mitigation_status
1645-iwl_mvm_fm_mitig_dcdc(struct iui_fm_wlan_mitigation *mit)
1646-{
1647- enum iui_fm_mitigation_status ret = IUI_FM_MITIGATION_COMPLETE_OK;
1648-
1649- /* Not required to mitigate dcdc */
1650- if (!(mit->bitmask & DCDC_MITI))
1651- return ret;
1652-
1653- /* Current dcdc values match requested values */
1654- if (mit->dcdc_div0 == g_dcdc_div0 && mit->dcdc_div1 == g_dcdc_div0) {
1655- IWL_DEBUG_EXTERNAL(g_mvm,
1656- "FM DCDC: Current dcdc values match requested values - not mitigating\n");
1657- goto out;
1658- }
1659-
1660- mutex_lock(&g_mvm->mutex);
1661- ret = iwl_mvm_fm_send_dcdc_cmd(mit->dcdc_div0, mit->dcdc_div1,
1662- DCDC_FREQ_TUNE_SET);
1663- mutex_unlock(&g_mvm->mutex);
1664-
1665- if (ret)
1666- ret = IUI_FM_MITIGATION_ERROR;
1667-
1668-out:
1669- IWL_DEBUG_EXTERNAL(g_mvm,
1670- "FM DCDC: mitigation %s (div0 = %d, div1 = %d)\n",
1671- ret ? "failed" : "succeeded", g_dcdc_div0,
1672- g_dcdc_div1);
1673-
1674- return ret;
1675-}
1676-
1677-/*
1678- * Send the FM the original DCDC values, so that FM can know when to activate
1679- * the DCDC mitigation.
1680- */
1681-void iwl_mvm_fm_notify_current_dcdc(void)
1682-{
1683- int ret;
1684- struct iui_fm_freq_notification notification;
1685- struct iui_fm_wlan_info winfo;
1686-
1687- if (!g_mvm)
1688- return;
1689-
1690- memset(&winfo, 0, sizeof(struct iui_fm_wlan_info));
1691-
1692- /* Get current DCDC from the FW */
1693- ret = iwl_mvm_fm_send_dcdc_cmd(0, 0, 0);
1694- if (ret)
1695- goto out;
1696-
1697- winfo.dcdc_div0 = g_dcdc_div0;
1698- winfo.dcdc_div1 = g_dcdc_div1;
1699-
1700- /* mark the change that we are reporting */
1701- winfo.bitmask |= DCDC_UPDATE;
1702-
1703- notification.type = IUI_FM_FREQ_NOTIFICATION_TYPE_WLAN;
1704- notification.info.wlan_info = &winfo;
1705-
1706- ret = iwl_mvm_fm_notify_frequency(debug_mode, IUI_FM_MACRO_ID_WLAN,
1707- &notification);
1708-
1709-out:
1710- IWL_DEBUG_EXTERNAL(g_mvm,
1711- "FM: notified fm about dcdc div0 = %d div1 = %d (fail = %d)\n",
1712- winfo.dcdc_div0, winfo.dcdc_div1, ret);
1713-}
1714-
1715-/*
1716- * Check if the list of channels that the FM supplied is valid
1717- */
1718-static bool iwl_mvm_fm_invalid_channel_list(struct iui_fm_wlan_mitigation *mit)
1719-{
1720- struct iui_fm_wlan_channel_tx_power *chan_txpwr_list =
1721- mit->channel_tx_pwr;
1722- u32 num_channels = mit->num_channels;
1723- u8 i, j;
1724-
1725- /* Check if the same frequency appears twice */
1726- for (i = 0; i < num_channels; i++) {
1727- for (j = 0; j < num_channels; j++) {
1728- if (chan_txpwr_list[i].frequency ==
1729- chan_txpwr_list[j].frequency && i != j) {
1730- int freq;
1731-
1732- freq = chan_txpwr_list[i].frequency;
1733- IWL_DEBUG_EXTERNAL(g_mvm,
1734- "FM: Invalid channel list: duplicated frequencies (freq = %d)\n",
1735- freq);
1736- return true;
1737- }
1738- }
1739- }
1740-
1741- /* Check that all of the channels are used */
1742- for (i = 0; i < num_channels; i++) {
1743- struct chan_ifaces chan_ifaces = {
1744- .chan_txpwr = &chan_txpwr_list[i],
1745- .num_of_vif = 0,
1746- };
1747- ieee80211_iterate_active_interfaces(g_mvm->hw,
1748- IEEE80211_IFACE_ITER_NORMAL,
1749- iwl_mvm_fm_chan_vldt_iter,
1750- &chan_ifaces);
1751- if (!chan_ifaces.num_of_vif) {
1752- IWL_DEBUG_EXTERNAL(g_mvm,
1753- "FM: Invalid channel list: frequency is not in use (freq = %d)\n",
1754- chan_txpwr_list[i].frequency);
1755- return true;
1756- }
1757- }
1758-
1759- return false;
1760-}
1761-
1762-/*
1763- * Frequency Mitigation Callback function implementation.
1764- * Frequency Manager can ask to:
1765- * 1. Limit Tx power on specific channels
1766- * 2. Change ADC/DAC frequency - Currently not supported
1767- * 3. Request Rx Gain behavior - Currently not supported
1768- * 4. Enter 2G coex mode
1769- * 5. Change dcdc clock values
1770- */
1771-static enum iui_fm_mitigation_status
1772-iwl_mvm_fm_wlan_mitigation(const enum iui_fm_macro_id macro_id,
1773- const struct iui_fm_mitigation *mitigation,
1774- const uint32_t sequence)
1775-{
1776- enum iui_fm_mitigation_status ret;
1777- struct iui_fm_wlan_mitigation *mit;
1778-
1779- if (WARN_ON(!g_mvm))
1780- return IUI_FM_MITIGATION_ERROR;
1781-
1782- if (macro_id != IUI_FM_MACRO_ID_WLAN ||
1783- mitigation->type != IUI_FM_MITIGATION_TYPE_WLAN) {
1784- ret = IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1785- goto end;
1786- }
1787-
1788- mit = mitigation->info.wlan_mitigation;
1789-
1790- if (iwl_mvm_fm_invalid_channel_list(mit))
1791- return IUI_FM_MITIGATION_ERROR_INVALID_PARAM;
1792-
1793- IWL_DEBUG_EXTERNAL(g_mvm, "FM: fm mitigation callback bit mask 0x%x\n",
1794- mit->bitmask);
1795-
1796- ret = iwl_mvm_fm_mitig_dcdc(mit);
1797- if (ret)
1798- goto end;
1799-
1800- /* Enable/Disable 2G coex mode */
1801- ret = iwl_mvm_fm_2g_coex(mit);
1802- if (ret)
1803- goto end;
1804-
1805- /*
1806- * Going to mitigate the Tx power of all stations using the channels in
1807- * the channel list mit->channel_tx_pwr received from the FM.
1808- */
1809- ret = iwl_mvm_fm_mitig_txpwr(mit);
1810- if (ret)
1811- goto end;
1812-
1813- ret = iwl_mvm_fm_mitig_adc_dac_freq(mit);
1814-
1815- if (ret)
1816- goto end;
1817-
1818- ret = iwl_mvm_fm_mitig_rxgain_behavior(mit);
1819-end:
1820- IWL_DEBUG_EXTERNAL(g_mvm, "FM: fm mitigation callback %s\n",
1821- ret ? "failed" : "succeeded");
1822- return ret;
1823-}
1824-
1825-/*
1826- * Check if the new list of active channels that the FM is going to be
1827- * updated with differs from the old list.
1828- * The check includes the channel frequency & BW.
1829- */
1830-static bool iwl_mvm_fm_channel_changed(struct iui_fm_wlan_info *winfo)
1831-{
1832- int i, j;
1833- bool changed;
1834-
1835- for (i = 0; i < winfo->num_channels; i++) {
1836- changed = true;
1837- for (j = 0; j < last_chan_notif.num_channels; j++) {
1838- /* The channel was not updated */
1839- if (winfo->channel_info[i].frequency ==
1840- last_chan_notif.channel_info[j].frequency &&
1841- winfo->channel_info[i].bandwidth ==
1842- last_chan_notif.channel_info[j].bandwidth) {
1843- changed = false;
1844- break;
1845- }
1846- }
1847- /* Channel was updated */
1848- if (changed)
1849- return true;
1850- }
1851-
1852- IWL_DEBUG_EXTERNAL(g_mvm,
1853- "FM: Channel list has not changed - not reporting\n");
1854- return false;
1855-}
1856-
1857-/*
1858- * Check if the new list of channels being reported to the FM is missing
1859- * channels that have been removed - but not reported as removed.
1860- *
1861- * The check is done by checking the old list of active channels that was
1862- * reported to the FM, and making sure that the active channel is still in the
1863- * new list. If the channel is absent from the list - it means that it is no
1864- * longer in use, so report it invalid.
1865- *
1866- * For example in case of connecting to an AP on 80MHZ BW. At first the
1867- * connection will be on the primary channel with 20MHZ, and then it will be
1868- * modified to the center frequency with 80MHZ, but the primary channel will not
1869- * be reported as removed. So we need to report this channel as invalid.
1870- *
1871- */
1872-static void iwl_mvm_fm_remove_channels(struct iui_fm_wlan_info *winfo)
1873-{
1874- int i, j;
1875- bool found;
1876-
1877- for (i = 0; i < last_chan_notif.num_channels; i++) {
1878- /* Can't report more channels since we are in the max */
1879- if (winfo->num_channels == IUI_FM_WLAN_MAX_CHANNELS)
1880- return;
1881- found = false;
1882-
1883- if (last_chan_notif.channel_info[i].bandwidth ==
1884- IUI_FM_WLAN_BW_INVALID)
1885- continue;
1886- /*
1887- * Search for the old reported channel in the new reported
1888- * channels
1889- */
1890- for (j = 0; j < winfo->num_channels; j++) {
1891- if (last_chan_notif.channel_info[i].frequency ==
1892- winfo->channel_info[j].frequency) {
1893- found = true;
1894- break;
1895- }
1896- }
1897- /*
1898- * The old reported channel is not in the new ones (It was
1899- * removed) - Adding it to the report.
1900- */
1901- if (!found) {
1902- winfo->channel_info[winfo->num_channels].frequency =
1903- last_chan_notif.channel_info[i].frequency;
1904- winfo->channel_info[winfo->num_channels].bandwidth =
1905- IUI_FM_WLAN_BW_INVALID;
1906- winfo->num_channels++;
1907- IWL_DEBUG_EXTERNAL(g_mvm,
1908- "FM: reporting channel %d invalid\n",
1909- last_chan_notif.channel_info[i].
1910- frequency);
1911- }
1912- }
1913-}
1914-
1915-static void iwl_mvm_fm_notif_chan_change_wk(struct work_struct *wk)
1916-{
1917- int ret;
1918- struct iui_fm_freq_notification notification;
1919-
1920- /* FM is enabled - but registration failed */
1921- if (!g_mvm)
1922- return;
1923-
1924- mutex_lock(&g_mvm->mutex);
1925-
1926- notification.type = IUI_FM_FREQ_NOTIFICATION_TYPE_WLAN;
1927- notification.info.wlan_info = &last_chan_notif;
1928- /* parameter not yet supported */
1929- notification.info.wlan_info->wlan_adc_dac_freq = 0;
1930-
1931- ret = iwl_mvm_fm_notify_frequency(debug_mode, IUI_FM_MACRO_ID_WLAN,
1932- &notification);
1933-
1934- IWL_DEBUG_EXTERNAL(g_mvm,
1935- "FM: notified fm about channel change (fail = %d)\n",
1936- ret);
1937-
1938- mutex_unlock(&g_mvm->mutex);
1939-}
1940-
1941-/*
1942- * Notify Frequency Manager that an interface changed a channel.
1943- */
1944-void iwl_mvm_fm_notify_channel_change(struct ieee80211_chanctx_conf *ctx,
1945- enum iwl_fm_chan_change_action action)
1946-{
1947- int i;
1948- struct iui_fm_wlan_info winfo = {
1949- .num_channels = 0,
1950- };
1951- struct chan_list chan_info = {
1952- .winfo = &winfo,
1953- .action = action,
1954- };
1955-
1956- /* FM is enabled - but registration failed */
1957- if (!g_mvm)
1958- return;
1959-
1960- lockdep_assert_held(&g_mvm->mutex);
1961-
1962- /*
1963- * if notifying the FM about adding/removing a channel ctx we
1964- * need to add this channel to the list before iterating over
1965- * the channel list since the list is updated only after this
1966- * function is called.
1967- */
1968- if (action != IWL_FM_CHANGE_CHANCTX) {
1969- winfo.channel_info[0].frequency =
1970- MHZ_TO_KHZ(ctx->min_def.center_freq1);
1971- winfo.channel_info[0].bandwidth =
1972- iwl_mvm_fm_get_bandwidth(ctx->min_def.width);
1973- /* when removing a channel - report the BW invalid */
1974- winfo.num_channels++;
1975- if (action == IWL_FM_REMOVE_CHANCTX)
1976- winfo.channel_info[0].bandwidth =
1977- IUI_FM_WLAN_BW_INVALID;
1978- }
1979-
1980- /* finding all bandwidths of used channels for FM notification */
1981- ieee80211_iter_chan_contexts_atomic(g_mvm->hw,
1982- iwl_mvm_fm_chan_iterator,
1983- &chan_info);
1984-
1985- iwl_mvm_fm_remove_channels(&winfo);
1986-
1987- for (i = 0; i < winfo.num_channels; i++)
1988- IWL_DEBUG_EXTERNAL(g_mvm,
1989- "FM: notifying fm about: channel=%d bandwith=%d\n",
1990- winfo.channel_info[i].frequency,
1991- winfo.channel_info[i].bandwidth);
1992-
1993- /* Do not report to FM if no change happened */
1994- if (!iwl_mvm_fm_channel_changed(&winfo))
1995- return;
1996-
1997- /* mark the change that we are reporting */
1998- winfo.bitmask = WLAN_UPDATE;
1999- /* Update the last notification to the FM */
2000- memcpy(&last_chan_notif, &winfo, sizeof(struct iui_fm_wlan_info));
2001-
2002- schedule_work(&fm_chan_notif_wk);
2003-}
2004-
2005-/*
2006- * Register the Frequency Mitigation Callback function implementation with
2007- * Frequency Manager to receive Frequency Mitigation messages from Frequency
2008- * Manager.
2009- */
2010-int iwl_mvm_fm_register(struct iwl_mvm *mvm)
2011-{
2012- int ret;
2013-
2014- if (g_mvm)
2015- return -EINVAL;
2016-
2017- g_mvm = mvm;
2018- INIT_WORK(&fm_chan_notif_wk, iwl_mvm_fm_notif_chan_change_wk);
2019-
2020-#ifdef CPTCFG_IWLWIFI_SUPPORT_DEBUG_OVERRIDES
2021- debug_mode = g_mvm->trans->dbg_cfg.fm_debug_mode;
2022-#else
2023- debug_mode = false;
2024-#endif
2025-
2026- ret = iwl_mvm_fm_register_callback(debug_mode, IUI_FM_MACRO_ID_WLAN,
2027- iwl_mvm_fm_wlan_mitigation);
2028-
2029- IWL_DEBUG_EXTERNAL(g_mvm,
2030- "FM: registering fm callback function (fail = %d)\n",
2031- ret);
2032- if (ret)
2033- g_mvm = NULL;
2034-
2035- return ret ? -EINVAL : ret;
2036-}
2037-
2038-/*
2039- * Unregister the Frequency Mitigation Callback function implementation
2040- */
2041-int iwl_mvm_fm_unregister(struct iwl_mvm *mvm)
2042-{
2043- int ret;
2044-
2045- if (g_mvm != mvm)
2046- return 0;
2047-
2048- ret = iwl_mvm_fm_register_callback(debug_mode, IUI_FM_MACRO_ID_WLAN,
2049- NULL);
2050-
2051- IWL_DEBUG_EXTERNAL(g_mvm,
2052- "FM: unregistering fm callback function (fail = %d)\n",
2053- ret);
2054-
2055- cancel_work_sync(&fm_chan_notif_wk);
2056- g_mvm = NULL;
2057-
2058- return ret ? -EINVAL : ret;
2059-}
2060diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fm-test.c b/drivers/net/wireless/intel/iwlwifi/mvm/fm-test.c
2061deleted file mode 100644
2062index 385c92f..0000000
2063--- a/drivers/net/wireless/intel/iwlwifi/mvm/fm-test.c
2064+++ /dev/null
2065@@ -1,264 +0,0 @@
2066-/******************************************************************************
2067- *
2068- * This file is provided under a dual BSD/GPLv2 license. When using or
2069- * redistributing this file, you may do so under either license.
2070- *
2071- * GPL LICENSE SUMMARY
2072- *
2073- * Copyright(c) 2013 - 2015 Intel Corporation. All rights reserved.
2074- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
2075- *
2076- * This program is free software; you can redistribute it and/or modify
2077- * it under the terms of version 2 of the GNU General Public License as
2078- * published by the Free Software Foundation.
2079- *
2080- * This program is distributed in the hope that it will be useful, but
2081- * WITHOUT ANY WARRANTY; without even the implied warranty of
2082- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2083- * General Public License for more details.
2084- *
2085- * The full GNU General Public License is included in this distribution
2086- * in the file called COPYING.
2087- *
2088- * Contact Information:
2089- * Intel Linux Wireless <linuxwifi@intel.com>
2090- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
2091- *
2092- * BSD LICENSE
2093- *
2094- * Copyright(c) 2013 - 2015 Intel Corporation. All rights reserved.
2095- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
2096- * All rights reserved.
2097- *
2098- * Redistribution and use in source and binary forms, with or without
2099- * modification, are permitted provided that the following conditions
2100- * are met:
2101- *
2102- * * Redistributions of source code must retain the above copyright
2103- * notice, this list of conditions and the following disclaimer.
2104- * * Redistributions in binary form must reproduce the above copyright
2105- * notice, this list of conditions and the following disclaimer in
2106- * the documentation and/or other materials provided with the
2107- * distribution.
2108- * * Neither the name Intel Corporation nor the names of its
2109- * contributors may be used to endorse or promote products derived
2110- * from this software without specific prior written permission.
2111- *
2112- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2113- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2114- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2115- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2116- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2117- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2118- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2119- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2120- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2121- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2122- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2123- *
2124- *****************************************************************************/
2125-#include <linux/fm/iui_fm.h>
2126-#include <linux/kernel.h>
2127-#include <linux/debugfs.h>
2128-#include <linux/netdevice.h>
2129-
2130-/*
2131- * UT framework to debug Frequency Manager on any platform.
2132- *
2133- * The framework contains stub functions & debugfs entries so the iwlwifi driver
2134- * can run the FM code without having an active FM in the background.
2135- *
2136- * FM--> iwlwifi driver API:
2137- * Done via debugfs entry: request the driver to mitigate its activity.
2138- * Through the debugfs the user can request driver to start tx power &
2139- * 2g coex mitigation.
2140- *
2141- * Iwlwfi driver-->FM API
2142- * Done via internal "stub" functions that will simulate the calls to the FM
2143- * If the debug mode is set, the calls to the real API functions are ignored,
2144- * and the stubs are called instead.
2145- *
2146- * To activate the FM debug mode you need to:
2147- * 1. Enable the IWLWIFI_FRQ_MGR_TEST config (it will enable by default the
2148- * IWLWIFI_FRQ_MGR config)
2149- * 2. add fm_debug_mode=0x1 in the file iwl-dbg-cfg.ini
2150- *
2151- * NOTE: If the platform does not have a FM then the ut will use the
2152- * include/linux/fm/iui_fm_test.h header file, otherwise it will use the
2153- * platform header file.
2154- */
2155-
2156-/* pointer to callback function in debug mode */
2157-static iui_fm_mitigation_cb fm_callback;
2158-static struct iui_fm_wlan_info fm_notif;
2159-static struct dentry *fm_debug_dir;
2160-
2161-static ssize_t
2162-iwl_mvm_fm_debug_mitigate_write(struct file *file,
2163- const char __user *user_buf,
2164- size_t count, loff_t *ppos)
2165-{
2166- struct iui_fm_mitigation mitigation;
2167- struct iui_fm_wlan_mitigation wm;
2168- char buf[128];
2169- size_t buf_size = sizeof(buf);
2170- int mitigate_2g;
2171- int ret;
2172- int mitigate_dcdc;
2173-
2174- mitigation.info.wlan_mitigation = &wm;
2175- mitigation.type = IUI_FM_MITIGATION_TYPE_WLAN;
2176-
2177- if (copy_from_user(buf, user_buf, buf_size))
2178- return -EFAULT;
2179-
2180- /* All platforms that are not xmm6321 & SOFIA 3G */
2181- if (IUI_FM_WLAN_MAX_CHANNELS == 4) {
2182- if (sscanf(buf, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
2183- &wm.num_channels,
2184- &wm.channel_tx_pwr[0].frequency,
2185- &wm.channel_tx_pwr[0].max_tx_pwr,
2186- &wm.channel_tx_pwr[1].frequency,
2187- &wm.channel_tx_pwr[1].max_tx_pwr,
2188- &wm.channel_tx_pwr[2].frequency,
2189- &wm.channel_tx_pwr[2].max_tx_pwr,
2190- &wm.channel_tx_pwr[3].frequency,
2191- &wm.channel_tx_pwr[3].max_tx_pwr,
2192- &mitigate_dcdc,
2193- &wm.dcdc_div0,
2194- &wm.dcdc_div1,
2195- &mitigate_2g,
2196- &wm.wlan_2g_coex_enable) != 14)
2197- return -EINVAL;
2198- } else if (sscanf(buf, "%d,%d,%d,%d,%d", &wm.num_channels,
2199- &wm.channel_tx_pwr[0].frequency,
2200- &wm.channel_tx_pwr[0].max_tx_pwr,
2201- &wm.channel_tx_pwr[1].frequency,
2202- &wm.channel_tx_pwr[1].max_tx_pwr) != 5) {
2203- return -EINVAL;
2204- }
2205-
2206- if (IUI_FM_WLAN_MAX_CHANNELS < wm.num_channels)
2207- return -EINVAL;
2208-
2209- wm.wlan_adc_dac_freq = 0;
2210- wm.rx_gain_behavior = IUI_FM_WLAN_RX_GAIN_NORMAL;
2211-
2212- wm.bitmask = 0;
2213-
2214- /* Set bit bitmask to indicate the required mitigations */
2215- if (wm.num_channels || mitigate_2g)
2216- wm.bitmask |= WLAN_MITI;
2217- if (mitigate_dcdc)
2218- wm.bitmask |= DCDC_MITI;
2219-
2220- ret = fm_callback(IUI_FM_MACRO_ID_WLAN, &mitigation, 0);
2221- pr_info("FM[test-mode]: mitigation callback %s (bitmask = 0x%x)\n",
2222- ret ? "failed" : "succeeded", wm.bitmask);
2223-
2224- return count;
2225-}
2226-
2227-static ssize_t
2228-iwl_mvm_fm_debug_notify_read(struct file *file, char __user *userbuf,
2229- size_t count, loff_t *ppos)
2230-{
2231- char buf[512];
2232- int bufsz = sizeof(buf);
2233- int pos = 0;
2234- u8 i;
2235-
2236- pos += scnprintf(buf + pos, bufsz - pos, "num_channels=%d\n",
2237- fm_notif.num_channels);
2238- for (i = 0; i < fm_notif.num_channels; i++)
2239- pos += scnprintf(buf + pos, bufsz - pos,
2240- "channel=%d, bandwidth=%d\n",
2241- fm_notif.channel_info[i].frequency,
2242- fm_notif.channel_info[i].bandwidth);
2243-
2244- pos += scnprintf(buf + pos, bufsz - pos, "dcdc_div0=%d\n",
2245- fm_notif.dcdc_div0);
2246- pos += scnprintf(buf + pos, bufsz - pos, "dcdc_div1=%d\n",
2247- fm_notif.dcdc_div1);
2248-
2249- return simple_read_from_buffer(userbuf, count, ppos, buf, pos);
2250-}
2251-
2252-static const struct file_operations fm_debug_mitigate_ops = {
2253- .write = iwl_mvm_fm_debug_mitigate_write,
2254- .open = simple_open,
2255- .llseek = generic_file_llseek,
2256-};
2257-
2258-static const struct file_operations fm_debug_notify_ops = {
2259- .read = iwl_mvm_fm_debug_notify_read,
2260- .open = simple_open,
2261- .llseek = generic_file_llseek,
2262-};
2263-
2264-static int iwl_mvm_fm_create_debugfs(void)
2265-{
2266- struct dentry *entry;
2267-
2268- fm_debug_dir = debugfs_create_dir("frq_mgr", NULL);
2269-
2270- if (!fm_debug_dir)
2271- goto err;
2272-
2273- entry = debugfs_create_file("mitigate", S_IWUSR, fm_debug_dir,
2274- NULL, &fm_debug_mitigate_ops);
2275- if (!entry)
2276- goto err;
2277-
2278- entry = debugfs_create_file("notify", S_IRUSR, fm_debug_dir,
2279- NULL, &fm_debug_notify_ops);
2280- if (!entry)
2281- goto err;
2282-
2283- return 0;
2284-err:
2285- pr_info("FM: Could not create debugfs entries\n");
2286- debugfs_remove_recursive(fm_debug_dir);
2287- return -1;
2288-}
2289-
2290-int32_t
2291-iwl_mvm_fm_test_register_callback(const enum iui_fm_macro_id macro_id,
2292- const iui_fm_mitigation_cb mitigation_cb)
2293-{
2294- int ret = 0;
2295-
2296- fm_callback = mitigation_cb;
2297-
2298- /* Unregister fm callback */
2299- if (!mitigation_cb) {
2300- debugfs_remove_recursive(fm_debug_dir);
2301- goto end;
2302- }
2303-
2304- /* Register fm callback */
2305- if (iwl_mvm_fm_create_debugfs()) {
2306- ret = -1;
2307- goto end;
2308- }
2309-
2310-end:
2311- pr_info("FM[test-mode]: %sregistering fm callback function (fail = %d)\n",
2312- ret ? "un" : "", ret);
2313- return ret;
2314-}
2315-
2316-int32_t
2317-iwl_mvm_fm_test_notify_frequency(const enum iui_fm_macro_id macro_id,
2318- const struct iui_fm_freq_notification *
2319- const notification)
2320-{
2321- /* Platform does not have a FM or test mode was requested */
2322- memcpy(&fm_notif, notification->info.wlan_info,
2323- sizeof(struct iui_fm_wlan_info));
2324-
2325- pr_info("FM[test-mode]: notifying fm about change (mask = 0x%x)\n",
2326- notification->info.wlan_info->bitmask);
2327-
2328- return 0;
2329-}
2330diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2331index 8ce91d4..bb2ad8b 100644
2332--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2333+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
2334@@ -1244,13 +1244,8 @@ static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
2335 }
2336
2337 iwl_fw_dbg_stop_sync(&mvm->fwrt);
2338- /*
2339- * Stop and start the transport without entering low power
2340- * mode. This will save the state of other components on the
2341- * device that are triggered by the INIT firwmare (MFUART).
2342- */
2343- _iwl_trans_stop_device(mvm->trans, false);
2344- ret = _iwl_trans_start_hw(mvm->trans, false);
2345+ iwl_trans_stop_device(mvm->trans);
2346+ ret = iwl_trans_start_hw(mvm->trans);
2347 if (ret)
2348 return ret;
2349
2350@@ -1422,7 +1417,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
2351 goto error;
2352 }
2353
2354-#ifdef CONFIG_THERMAL
2355 if (iwl_mvm_is_tt_in_fw(mvm)) {
2356 /* in order to give the responsibility of ct-kill and
2357 * TX backoff to FW we need to send empty temperature reporting
2358@@ -1434,6 +1428,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
2359 iwl_mvm_tt_tx_backoff(mvm, 0);
2360 }
2361
2362+#ifdef CONFIG_THERMAL
2363 /* TODO: read the budget from BIOS / Platform NVM */
2364
2365 /*
2366@@ -1446,9 +1441,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
2367 if (ret)
2368 goto error;
2369 }
2370-#else
2371- /* Initialize tx backoffs to the minimal possible */
2372- iwl_mvm_tt_tx_backoff(mvm, 0);
2373 #endif
2374
2375 if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2))
2376@@ -1479,10 +1471,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
2377 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
2378 iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB);
2379
2380-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2381- iwl_mvm_send_lte_commands(mvm);
2382-#endif
2383-
2384 #ifdef CPTCFG_IWLMVM_VENDOR_CMDS
2385 /* set_mode must be IWL_TX_POWER_MODE_SET_DEVICE if this was
2386 * ever initialized.
2387@@ -1506,10 +1494,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
2388 }
2389 #endif
2390
2391-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2392- iwl_mvm_fm_notify_current_dcdc();
2393-#endif
2394-
2395 if (iwl_acpi_get_eckv(mvm->dev, &mvm->ext_clock_valid))
2396 IWL_DEBUG_INFO(mvm, "ECKV table doesn't exist in BIOS\n");
2397
2398diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/lte-coex.h b/drivers/net/wireless/intel/iwlwifi/mvm/lte-coex.h
2399deleted file mode 100644
2400index 5bf99ee..0000000
2401--- a/drivers/net/wireless/intel/iwlwifi/mvm/lte-coex.h
2402+++ /dev/null
2403@@ -1,125 +0,0 @@
2404-/******************************************************************************
2405- *
2406- * This file is provided under a dual BSD/GPLv2 license. When using or
2407- * redistributing this file, you may do so under either license.
2408- *
2409- * GPL LICENSE SUMMARY
2410- *
2411- * Copyright(c) 2014 Intel Corporation. All rights reserved.
2412- * Copyright(c) 2014 Intel Mobile Communications GmbH
2413- *
2414- * This program is free software; you can redistribute it and/or modify
2415- * it under the terms of version 2 of the GNU General Public License as
2416- * published by the Free Software Foundation.
2417- *
2418- * This program is distributed in the hope that it will be useful, but
2419- * WITHOUT ANY WARRANTY; without even the implied warranty of
2420- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2421- * General Public License for more details.
2422- *
2423- * The full GNU General Public License is included in this distribution
2424- * in the file called COPYING.
2425- *
2426- * Contact Information:
2427- * Intel Linux Wireless <linuxwifi@intel.com>
2428- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
2429- *
2430- * BSD LICENSE
2431- *
2432- * Copyright(c) 2014 Intel Corporation. All rights reserved.
2433- * Copyright(c) 2014 Intel Mobile Communications GmbH
2434- * All rights reserved.
2435- *
2436- * Redistribution and use in source and binary forms, with or without
2437- * modification, are permitted provided that the following conditions
2438- * are met:
2439- *
2440- * * Redistributions of source code must retain the above copyright
2441- * notice, this list of conditions and the following disclaimer.
2442- * * Redistributions in binary form must reproduce the above copyright
2443- * notice, this list of conditions and the following disclaimer in
2444- * the documentation and/or other materials provided with the
2445- * distribution.
2446- * * Neither the name Intel Corporation nor the names of its
2447- * contributors may be used to endorse or promote products derived
2448- * from this software without specific prior written permission.
2449- *
2450- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2451- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2452- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2453- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2454- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2455- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2456- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2457- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2458- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2459- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2460- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2461- *
2462- *****************************************************************************/
2463-
2464-#ifndef __coex_h__
2465-#define __coex_h__
2466-
2467-#include <linux/types.h>
2468-
2469-/* LTE-Coex protocol user space commands */
2470-
2471-#define LTE_OFF 0
2472-#define LTE_IDLE 1
2473-#define LTE_CONNECTED 2
2474-
2475-/* LTE-Coex error codes */
2476-
2477-#define LTE_OK 0
2478-/* LTE state machine violation */
2479-#define LTE_STATE_ERR 1
2480-#define LTE_ILLEGAL_PARAMS 2
2481-#define LTE_INVALID_DATA 3
2482-#define LTE_OTHER_ERR 4
2483-
2484-
2485-struct lte_coex_state_cmd {
2486- __u8 lte_state;
2487-} __packed;
2488-
2489-#define LTE_MWS_CONF_LENGTH 12
2490-#define LTE_SAFE_PT_LENGTH 32
2491-#define LTE_SAFE_PT_FIRST -128
2492-#define LTE_SAFE_PT_LAST 127
2493-struct lte_coex_config_info_cmd {
2494- __u32 mws_conf_data[LTE_MWS_CONF_LENGTH];
2495- __s8 safe_power_table[LTE_SAFE_PT_LENGTH];
2496-} __packed;
2497-
2498-#define LTE_CONNECTED_BANDS_LENGTH 8
2499-#define LTE_FRAME_STRUCT_LENGTH 2
2500-#define LTE_TX_POWER_LENGTH 14
2501-#define LTE_FRQ_MIN 2400
2502-#define LTE_FRQ_MAX 2500
2503-#define LTE_MAX_TX_MIN 0
2504-#define LTE_MAX_TX_MAX 31
2505-struct lte_coex_dynamic_info_cmd {
2506- __u32 lte_connected_bands[LTE_CONNECTED_BANDS_LENGTH];
2507- __u32 lte_frame_structure[LTE_FRAME_STRUCT_LENGTH];
2508- __u16 wifi_tx_safe_freq_min;
2509- __u16 wifi_tx_safe_freq_max;
2510- __u16 wifi_rx_safe_freq_min;
2511- __u16 wifi_rx_safe_freq_max;
2512- __u8 wifi_max_tx_power[LTE_TX_POWER_LENGTH];
2513-} __packed;
2514-
2515-struct lte_coex_sps_info_cmd {
2516- __u32 sps_info;
2517-} __packed;
2518-
2519-#define LTE_RC_CHAN_MIN 1
2520-#define LTE_RC_CHAN_MAX 14
2521-#define LTE_RC_BW_MIN 0
2522-#define LTE_RC_BW_MAX 3
2523-struct lte_coex_wifi_reported_chan_cmd {
2524- __u8 chan;
2525- __u8 bandwidth;
2526-} __packed;
2527-
2528-#endif /* __coex_h__ */
2529diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
2530index 9c26dd4..ebcacd1 100644
2531--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
2532+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
2533@@ -633,6 +633,8 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
2534 /* We need the dtim_period to set the MAC as associated */
2535 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
2536 !force_assoc_off) {
2537+ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
2538+ u8 ap_sta_id = mvmvif->ap_sta_id;
2539 u32 dtim_offs;
2540
2541 /*
2542@@ -668,7 +670,29 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
2543 dtim_offs);
2544
2545 ctxt_sta->is_assoc = cpu_to_le32(1);
2546- cmd.filter_flags |= cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
2547+
2548+ /*
2549+ * allow multicast data frames only as long as the station is
2550+ * authorized, i.e., GTK keys are already installed (if needed)
2551+ */
2552+ if (ap_sta_id < IWL_MVM_STATION_COUNT) {
2553+ struct ieee80211_sta *sta;
2554+
2555+ rcu_read_lock();
2556+
2557+ sta = rcu_dereference(mvm->fw_id_to_mac_id[ap_sta_id]);
2558+ if (!IS_ERR_OR_NULL(sta)) {
2559+ struct iwl_mvm_sta *mvmsta =
2560+ iwl_mvm_sta_from_mac80211(sta);
2561+
2562+ if (mvmsta->sta_state ==
2563+ IEEE80211_STA_AUTHORIZED)
2564+ cmd.filter_flags |=
2565+ cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
2566+ }
2567+
2568+ rcu_read_unlock();
2569+ }
2570 } else {
2571 ctxt_sta->is_assoc = cpu_to_le32(0);
2572
2573diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2574index 60a345c..c610056 100644
2575--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2576+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
2577@@ -1124,15 +1124,6 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
2578 mvm->ps_disabled = false;
2579 mvm->rfkill_safe_init_done = false;
2580
2581-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2582- /*
2583- * In case that 2g coex was enabled - and now the FW is being
2584- * restarted, we need to disable 2g coex mode in the driver as well
2585- * so that the fw & driver will be synced on the mode.
2586- */
2587- mvm->coex_2g_enabled = false;
2588-#endif
2589-
2590 /* just in case one was running */
2591 iwl_mvm_cleanup_roc_te(mvm);
2592 ieee80211_remain_on_channel_expired(mvm->hw);
2593@@ -1368,18 +1359,6 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2594 .v5.v3.pwr_restriction = cpu_to_le16(8 * tx_power),
2595 };
2596
2597-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2598- struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
2599-
2600- /*
2601- * if set Tx power request did not come from Frequency Manager(FM)
2602- * Take minimum between wanted Tx power to FM Tx power limit
2603- */
2604- if (mvmvif->phy_ctxt && tx_power > mvmvif->phy_ctxt->fm_tx_power_limit)
2605- cmd.v5.v3.pwr_restriction =
2606- cpu_to_le16(mvmvif->phy_ctxt->fm_tx_power_limit);
2607-#endif
2608-
2609 if (tx_power == IWL_DEFAULT_MAX_TX_POWER)
2610 cmd.v5.v3.pwr_restriction = cpu_to_le16(IWL_DEV_MAX_TX_POWER);
2611
2612@@ -1395,35 +1374,6 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2613 return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd);
2614 }
2615
2616-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2617-int iwl_mvm_fm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2618- s8 txpower)
2619-{
2620- int ret;
2621-
2622- mutex_lock(&mvm->mutex);
2623- /* set Tx power to min between drivers limit and FM limit */
2624- ret = iwl_mvm_set_tx_power(mvm, vif, min_t(s8, txpower,
2625- vif->bss_conf.txpower));
2626- mutex_unlock(&mvm->mutex);
2627- return ret;
2628-}
2629-
2630-/*
2631- * Updates Tx power limitation for the mac if FM has already limited
2632- * the Tx power on the channel that this mac is using.
2633- */
2634-static void iwl_mvm_update_ctx_tx_power_limit(struct iwl_mvm *mvm,
2635- struct ieee80211_vif *vif,
2636- struct iwl_mvm_phy_ctxt *phy_ctxt)
2637-{
2638- /* Tx power has not been limited by FM */
2639- if (phy_ctxt->fm_tx_power_limit == IWL_DEFAULT_MAX_TX_POWER)
2640- return;
2641- iwl_mvm_set_tx_power(mvm, vif, phy_ctxt->fm_tx_power_limit);
2642-}
2643-#endif
2644-
2645 static int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,
2646 struct ieee80211_vif *vif)
2647 {
2648@@ -1620,10 +1570,6 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
2649 if (ret)
2650 goto out_unref_phy;
2651
2652-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2653- iwl_mvm_update_ctx_tx_power_limit(mvm, vif, mvmvif->phy_ctxt);
2654-#endif
2655-
2656 ret = iwl_mvm_add_p2p_bcast_sta(mvm, vif);
2657 if (ret)
2658 goto out_unbind;
2659@@ -2647,10 +2593,6 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
2660 if (ret)
2661 goto out_remove;
2662
2663-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2664- iwl_mvm_update_ctx_tx_power_limit(mvm, vif, mvmvif->phy_ctxt);
2665-#endif
2666-
2667 /*
2668 * This is not very nice, but the simplest:
2669 * For older FWs adding the mcast sta before the bcast station may
2670@@ -3323,10 +3265,20 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
2671 /* enable beacon filtering */
2672 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
2673
2674+ /*
2675+ * Now that the station is authorized, i.e., keys were already
2676+ * installed, need to indicate to the FW that
2677+ * multicast data frames can be forwarded to the driver
2678+ */
2679+ iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
2680+
2681 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
2682 true);
2683 } else if (old_state == IEEE80211_STA_AUTHORIZED &&
2684 new_state == IEEE80211_STA_ASSOC) {
2685+ /* Multicast data frames are no longer allowed */
2686+ iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
2687+
2688 /* disable beacon filtering */
2689 ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
2690 WARN_ON(ret &&
2691@@ -4083,10 +4035,6 @@ static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
2692 iwl_mvm_phy_ctxt_ref(mvm, phy_ctxt);
2693 *phy_ctxt_id = phy_ctxt->id;
2694
2695-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2696- iwl_mvm_fm_notify_channel_change(ctx, IWL_FM_ADD_CHANCTX);
2697-#endif
2698-
2699 out:
2700 return ret;
2701 }
2702@@ -4113,9 +4061,6 @@ static void __iwl_mvm_remove_chanctx(struct iwl_mvm *mvm,
2703 lockdep_assert_held(&mvm->mutex);
2704
2705 iwl_mvm_phy_ctxt_unref(mvm, phy_ctxt);
2706-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2707- iwl_mvm_fm_notify_channel_change(ctx, IWL_FM_REMOVE_CHANCTX);
2708-#endif
2709 }
2710
2711 static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,
2712@@ -4164,9 +4109,6 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
2713 iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, def,
2714 ctx->rx_chains_static,
2715 ctx->rx_chains_dynamic);
2716-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2717- iwl_mvm_fm_notify_channel_change(ctx, IWL_FM_CHANGE_CHANCTX);
2718-#endif
2719
2720 out_unlock:
2721 mutex_unlock(&mvm->mutex);
2722@@ -4217,10 +4159,6 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
2723 if (ret)
2724 goto out;
2725
2726-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2727- iwl_mvm_update_ctx_tx_power_limit(mvm, vif, mvmvif->phy_ctxt);
2728-#endif
2729-
2730 /*
2731 * Power state must be updated before quotas,
2732 * otherwise fw will complain.
2733diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
2734index 372e86e..e140a1f 100644
2735--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
2736+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
2737@@ -89,10 +89,6 @@
2738 #include "fw/acpi.h"
2739 #include "iwl-nvm-parse.h"
2740
2741-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2742-#include "lte-coex.h"
2743-#endif
2744-
2745 #include <linux/average.h>
2746
2747 #define IWL_MVM_MAX_ADDRESSES 5
2748@@ -162,10 +158,6 @@ struct iwl_mvm_phy_ctxt {
2749 */
2750 struct ieee80211_channel *channel;
2751
2752-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2753- /* Frequency Manager tx power limit*/
2754- s8 fm_tx_power_limit;
2755-#endif
2756 };
2757
2758 struct iwl_mvm_time_event_data {
2759@@ -598,24 +590,6 @@ struct iwl_mvm_frame_stats {
2760 int last_frame_idx;
2761 };
2762
2763-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2764-struct lte_coex_state {
2765- u8 state;
2766-
2767- bool has_static;
2768- bool has_config;
2769- bool has_sps;
2770- bool has_rprtd_chan;
2771- bool has_ft;
2772-
2773- struct iwl_lte_coex_static_params_cmd stat;
2774- struct iwl_lte_coex_config_cmd config;
2775- struct iwl_lte_coex_sps_cmd sps;
2776- struct iwl_lte_coex_wifi_reported_channel_cmd rprtd_chan;
2777- struct iwl_lte_coex_fine_tuning_params_cmd ft;
2778-};
2779-#endif
2780-
2781 #define IWL_MVM_DEBUG_SET_TEMPERATURE_DISABLE 0xff
2782 #define IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -100
2783 #define IWL_MVM_DEBUG_SET_TEMPERATURE_MAX 200
2784@@ -1062,6 +1036,7 @@ struct iwl_mvm {
2785 struct ieee80211_channel **nd_channels;
2786 int n_nd_channels;
2787 bool net_detect;
2788+ u8 offload_tid;
2789 #ifdef CPTCFG_IWLWIFI_DEBUGFS
2790 bool d3_wake_sysassert;
2791 bool d3_test_active;
2792@@ -1080,17 +1055,9 @@ struct iwl_mvm {
2793 u8 bt_tx_prio;
2794 enum iwl_bt_force_ant_mode bt_force_ant_mode;
2795
2796-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2797- /* LTE-Coex */
2798- struct lte_coex_state lte_state;
2799-#endif
2800 /* Aux ROC */
2801 struct list_head aux_roc_te_list;
2802
2803-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2804- /* 2G-Coex */
2805- bool coex_2g_enabled;
2806-#endif
2807 /* Thermal Throttling and CTkill */
2808 struct iwl_mvm_tt_mgmt thermal_throttle;
2809 #ifdef CONFIG_THERMAL
2810@@ -1519,6 +1486,12 @@ static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm)
2811 IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG);
2812 }
2813
2814+static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm)
2815+{
2816+ return fw_has_api(&mvm->fw->ucode_capa,
2817+ IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);
2818+}
2819+
2820 static inline bool iwl_mvm_has_new_rx_stats_api(struct iwl_mvm *mvm)
2821 {
2822 return fw_has_api(&mvm->fw->ucode_capa,
2823@@ -1548,7 +1521,6 @@ iwl_mvm_get_agg_status(struct iwl_mvm *mvm, void *tx_resp)
2824
2825 static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm)
2826 {
2827-#ifdef CONFIG_THERMAL
2828 /* these two TLV are redundant since the responsibility to CT-kill by
2829 * FW happens only after we send at least one command of
2830 * temperature THs report.
2831@@ -1557,9 +1529,6 @@ static inline bool iwl_mvm_is_tt_in_fw(struct iwl_mvm *mvm)
2832 IWL_UCODE_TLV_CAPA_CT_KILL_BY_FW) &&
2833 fw_has_capa(&mvm->fw->ucode_capa,
2834 IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT);
2835-#else /* CONFIG_THERMAL */
2836- return false;
2837-#endif /* CONFIG_THERMAL */
2838 }
2839
2840 static inline bool iwl_mvm_is_ctdp_supported(struct iwl_mvm *mvm)
2841@@ -2087,27 +2056,6 @@ void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm);
2842 int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm);
2843 int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget);
2844
2845-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2846-/* Frequency Manager */
2847-#define FM_2G_COEX_ENABLE_DISABLE 0xFFFFFFFF
2848-#define FM_2G_COEX_ENABLE -100
2849-#define FM_2G_COEX_DISABLE 25
2850-
2851-enum iwl_fm_chan_change_action {
2852- IWL_FM_ADD_CHANCTX = 0,
2853- IWL_FM_REMOVE_CHANCTX = 1,
2854- IWL_FM_CHANGE_CHANCTX = 2,
2855-};
2856-
2857-int iwl_mvm_fm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2858- s8 txpower);
2859-void iwl_mvm_fm_notify_channel_change(struct ieee80211_chanctx_conf *ctx,
2860- enum iwl_fm_chan_change_action action);
2861-void iwl_mvm_fm_notify_current_dcdc(void);
2862-int iwl_mvm_fm_register(struct iwl_mvm *mvm);
2863-int iwl_mvm_fm_unregister(struct iwl_mvm *mvm);
2864-#endif
2865-
2866 /* Location Aware Regulatory */
2867 struct iwl_mcc_update_resp *
2868 iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
2869@@ -2205,16 +2153,6 @@ void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
2870 void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
2871 u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed);
2872
2873-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2874-int iwl_mvm_send_lte_coex_static_params_cmd(struct iwl_mvm *mvm);
2875-int iwl_mvm_send_lte_coex_config_cmd(struct iwl_mvm *mvm);
2876-int iwl_mvm_send_lte_coex_wifi_reported_channel_cmd(struct iwl_mvm *mvm);
2877-int iwl_mvm_send_lte_sps_cmd(struct iwl_mvm *mvm);
2878-int iwl_mvm_send_lte_fine_tuning_params_cmd(struct iwl_mvm *mvm);
2879-void iwl_mvm_reset_lte_state(struct iwl_mvm *mvm);
2880-void iwl_mvm_send_lte_commands(struct iwl_mvm *mvm);
2881-#endif
2882-
2883 void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
2884 unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
2885 struct ieee80211_vif *vif,
2886diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
2887index 018d6e0..ca25c5c 100644
2888--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
2889+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
2890@@ -399,21 +399,12 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = {
2891 HCMD_NAME(TIME_QUOTA_CMD),
2892 HCMD_NAME(NON_QOS_TX_COUNTER_CMD),
2893 HCMD_NAME(LEDS_CMD),
2894-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2895- HCMD_NAME(LTE_COEX_CONFIG_CMD),
2896- HCMD_NAME(LTE_COEX_WIFI_REPORTED_CHANNEL_CMD),
2897- HCMD_NAME(LTE_COEX_STATIC_PARAMS_CMD),
2898- HCMD_NAME(LTE_COEX_SPS_CMD),
2899-#endif
2900 HCMD_NAME(LQ_CMD),
2901 HCMD_NAME(FW_PAGING_BLOCK_CMD),
2902 HCMD_NAME(SCAN_OFFLOAD_REQUEST_CMD),
2903 HCMD_NAME(SCAN_OFFLOAD_ABORT_CMD),
2904 HCMD_NAME(HOT_SPOT_CMD),
2905 HCMD_NAME(SCAN_OFFLOAD_PROFILES_QUERY_CMD),
2906-#ifdef CPTCFG_IWLWIFI_LTE_COEX
2907- HCMD_NAME(LTE_COEX_FINE_TUNING_PARAMS_CMD),
2908-#endif
2909 HCMD_NAME(BT_COEX_UPDATE_REDUCED_TXP),
2910 HCMD_NAME(BT_COEX_CI),
2911 HCMD_NAME(PHY_CONFIGURATION_CMD),
2912@@ -1024,12 +1015,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
2913 else
2914 memset(&mvm->rx_stats, 0, sizeof(struct mvm_statistics_rx));
2915
2916-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2917- err = iwl_mvm_fm_register(mvm);
2918- if (err)
2919- pr_err("Unable to register with Frequency Manager: %d\n", err);
2920-#endif
2921-
2922 #ifdef CPTCFG_IWLWIFI_SUPPORT_DEBUG_OVERRIDES
2923 iwl_mvm_init_modparams(mvm);
2924 #endif
2925@@ -1066,10 +1051,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
2926
2927 ieee80211_unregister_hw(mvm->hw);
2928
2929-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2930- iwl_mvm_fm_unregister(mvm);
2931-#endif
2932-
2933 kfree(mvm->scan_cmd);
2934 kfree(mvm->mcast_filter_cmd);
2935 mvm->mcast_filter_cmd = NULL;
2936diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
2937index cd5ff55..9925616 100644
2938--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
2939+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
2940@@ -7,8 +7,8 @@
2941 *
2942 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
2943 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
2944- * Copyright(c) 2017 Intel Deutschland GmbH
2945- * Copyright(c) 2018 Intel Corporation
2946+ * Copyright(c) 2017 Intel Deutschland GmbH
2947+ * Copyright(c) 2018 - 2019 Intel Corporation
2948 *
2949 * This program is free software; you can redistribute it and/or modify
2950 * it under the terms of version 2 of the GNU General Public License as
2951@@ -30,7 +30,7 @@
2952 *
2953 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
2954 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
2955- * Copyright(c) 2018 Intel Corporation
2956+ * Copyright(c) 2018 - 2019 Intel Corporation
2957 * All rights reserved.
2958 *
2959 * Redistribution and use in source and binary forms, with or without
2960@@ -221,10 +221,6 @@ int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
2961
2962 ctxt->channel = chandef->chan;
2963
2964-#ifdef CPTCFG_IWLWIFI_FRQ_MGR
2965- ctxt->fm_tx_power_limit = IWL_DEFAULT_MAX_TX_POWER;
2966-#endif
2967-
2968 return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef,
2969 chains_static, chains_dynamic,
2970 FW_CTXT_ACTION_ADD, 0);
2971diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
2972index 4a7b1e6..761a3e6 100644
2973--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
2974+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
2975@@ -193,7 +193,7 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
2976 int i, highest_mcs;
2977
2978 for (i = 0; i < sta->rx_nss; i++) {
2979- if (i == MAX_NSS)
2980+ if (i == IWL_TLC_NSS_MAX)
2981 break;
2982
2983 highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, i + 1);
2984@@ -204,9 +204,10 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
2985 if (sta->bandwidth == IEEE80211_STA_RX_BW_20)
2986 supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9);
2987
2988- cmd->ht_rates[i][0] = cpu_to_le16(supp);
2989+ cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cpu_to_le16(supp);
2990 if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
2991- cmd->ht_rates[i][1] = cmd->ht_rates[i][0];
2992+ cmd->ht_rates[i][IWL_TLC_HT_BW_160] =
2993+ cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160];
2994 }
2995 }
2996
2997@@ -241,7 +242,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
2998 le16_to_cpu(sband->iftype_data->he_cap.he_mcs_nss_supp.tx_mcs_160);
2999 int i;
3000
3001- for (i = 0; i < sta->rx_nss && i < MAX_NSS; i++) {
3002+ for (i = 0; i < sta->rx_nss && i < IWL_TLC_NSS_MAX; i++) {
3003 u16 _mcs_160 = (mcs_160 >> (2 * i)) & 0x3;
3004 u16 _mcs_80 = (mcs_80 >> (2 * i)) & 0x3;
3005 u16 _tx_mcs_160 = (tx_mcs_160 >> (2 * i)) & 0x3;
3006@@ -255,7 +256,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
3007 }
3008 if (_mcs_80 > _tx_mcs_80)
3009 _mcs_80 = _tx_mcs_80;
3010- cmd->ht_rates[i][0] =
3011+ cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] =
3012 cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_80));
3013
3014 /* If one side doesn't support - mark both as not supporting */
3015@@ -266,7 +267,7 @@ rs_fw_he_set_enabled_rates(const struct ieee80211_sta *sta,
3016 }
3017 if (_mcs_160 > _tx_mcs_160)
3018 _mcs_160 = _tx_mcs_160;
3019- cmd->ht_rates[i][1] =
3020+ cmd->ht_rates[i][IWL_TLC_HT_BW_160] =
3021 cpu_to_le16(rs_fw_he_ieee80211_mcs_to_rs_mcs(_mcs_160));
3022 }
3023 }
3024@@ -300,8 +301,10 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
3025 rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd);
3026 } else if (ht_cap->ht_supported) {
3027 cmd->mode = IWL_TLC_MNG_MODE_HT;
3028- cmd->ht_rates[0][0] = cpu_to_le16(ht_cap->mcs.rx_mask[0]);
3029- cmd->ht_rates[1][0] = cpu_to_le16(ht_cap->mcs.rx_mask[1]);
3030+ cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_HT_BW_NONE_160] =
3031+ cpu_to_le16(ht_cap->mcs.rx_mask[0]);
3032+ cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_HT_BW_NONE_160] =
3033+ cpu_to_le16(ht_cap->mcs.rx_mask[1]);
3034 }
3035 }
3036
3037@@ -433,6 +436,16 @@ void rs_fw_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
3038 iwl_mvm_reset_frame_stats(mvm);
3039 #endif
3040 rs_fw_set_supp_rates(sta, sband, &cfg_cmd);
3041+#ifdef CPTCFG_IWLWIFI_SUPPORT_DEBUG_OVERRIDES
3042+ /*
3043+ * if AP disables mimo on 160bw (cmd->ht_rates[1][1] == 0
3044+ * we disable mimo on 80bw cmd->ht_rates[1][0]
3045+ */
3046+ if (mvm->trans->dbg_cfg.tx_siso_80bw_like_160bw &&
3047+ !cfg_cmd.ht_rates[1][1])
3048+ cfg_cmd.ht_rates[1][0] = 0;
3049+
3050+#endif
3051
3052 /*
3053 * since TLC offload works with one mode we can assume
3054diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
3055index 446d523..4acee82 100644
3056--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
3057+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
3058@@ -77,7 +77,10 @@
3059 #define IWL_SCAN_DWELL_FRAGMENTED 44
3060 #define IWL_SCAN_DWELL_EXTENDED 90
3061 #define IWL_SCAN_NUM_OF_FRAGS 3
3062+#define IWL_SCAN_LAST_2_4_CHN 14
3063
3064+#define IWL_SCAN_BAND_5_2 0
3065+#define IWL_SCAN_BAND_2_4 1
3066
3067 /* adaptive dwell max budget time [TU] for full scan */
3068 #define IWL_SCAN_ADWELL_MAX_BUDGET_FULL_SCAN 300
3069@@ -956,11 +959,24 @@ static int iwl_mvm_scan_lmac_flags(struct iwl_mvm *mvm,
3070 return flags;
3071 }
3072
3073+static void
3074+iwl_mvm_scan_set_legacy_probe_req(struct iwl_scan_probe_req_v1 *p_req,
3075+ struct iwl_scan_probe_req *src_p_req)
3076+{
3077+ int i;
3078+
3079+ p_req->mac_header = src_p_req->mac_header;
3080+ for (i = 0; i < SCAN_NUM_BAND_PROBE_DATA_V_1; i++)
3081+ p_req->band_data[i] = src_p_req->band_data[i];
3082+ p_req->common_data = src_p_req->common_data;
3083+ memcpy(p_req->buf, src_p_req->buf, sizeof(p_req->buf));
3084+}
3085+
3086 static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3087 struct iwl_mvm_scan_params *params)
3088 {
3089 struct iwl_scan_req_lmac *cmd = mvm->scan_cmd;
3090- struct iwl_scan_probe_req *preq =
3091+ struct iwl_scan_probe_req_v1 *preq =
3092 (void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) *
3093 mvm->fw->ucode_capa.n_scan_channels);
3094 u32 ssid_bitmap = 0;
3095@@ -1030,7 +1046,7 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3096 iwl_mvm_lmac_scan_cfg_channels(mvm, params->channels,
3097 params->n_channels, ssid_bitmap, cmd);
3098
3099- *preq = params->preq;
3100+ iwl_mvm_scan_set_legacy_probe_req(preq, &params->preq);
3101
3102 return 0;
3103 }
3104@@ -1408,9 +1424,17 @@ iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm,
3105
3106 for (i = 0; i < n_channels; i++) {
3107 channel_cfg[i].flags = cpu_to_le32(ssid_bitmap);
3108- channel_cfg[i].channel_num = channels[i]->hw_value;
3109- channel_cfg[i].iter_count = 1;
3110- channel_cfg[i].iter_interval = 0;
3111+ channel_cfg[i].v1.channel_num = channels[i]->hw_value;
3112+ if (iwl_mvm_is_scan_ext_chan_supported(mvm)) {
3113+ channel_cfg[i].v2.band =
3114+ channels[i]->hw_value <= IWL_SCAN_LAST_2_4_CHN ?
3115+ IWL_SCAN_BAND_2_4 : IWL_SCAN_BAND_5_2;
3116+ channel_cfg[i].v2.iter_count = 1;
3117+ channel_cfg[i].v2.iter_interval = 0;
3118+ } else {
3119+ channel_cfg[i].v1.iter_count = 1;
3120+ channel_cfg[i].v1.iter_interval = 0;
3121+ }
3122 }
3123 }
3124
3125@@ -1500,9 +1524,12 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3126 struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
3127 struct iwl_scan_umac_chan_param *chan_param;
3128 void *cmd_data = iwl_mvm_get_scan_req_umac_data(mvm);
3129- struct iwl_scan_req_umac_tail *sec_part = cmd_data +
3130- sizeof(struct iwl_scan_channel_cfg_umac) *
3131- mvm->fw->ucode_capa.n_scan_channels;
3132+ void *sec_part = cmd_data + sizeof(struct iwl_scan_channel_cfg_umac) *
3133+ mvm->fw->ucode_capa.n_scan_channels;
3134+ struct iwl_scan_req_umac_tail_v2 *tail_v2 =
3135+ (struct iwl_scan_req_umac_tail_v2 *)sec_part;
3136+ struct iwl_scan_req_umac_tail_v1 *tail_v1;
3137+ struct iwl_ssid_ie *direct_scan;
3138 int uid, i;
3139 u32 ssid_bitmap = 0;
3140 u8 channel_flags = 0;
3141@@ -1564,18 +1591,12 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3142 chan_param->flags = channel_flags;
3143 chan_param->count = params->n_channels;
3144
3145- iwl_scan_build_ssids(params, sec_part->direct_scan, &ssid_bitmap);
3146-
3147- iwl_mvm_umac_scan_cfg_channels(mvm, params->channels,
3148- params->n_channels, ssid_bitmap,
3149- cmd_data);
3150-
3151 for (i = 0; i < params->n_scan_plans; i++) {
3152 struct cfg80211_sched_scan_plan *scan_plan =
3153 &params->scan_plans[i];
3154
3155- sec_part->schedule[i].iter_count = scan_plan->iterations;
3156- sec_part->schedule[i].interval =
3157+ tail_v2->schedule[i].iter_count = scan_plan->iterations;
3158+ tail_v2->schedule[i].interval =
3159 cpu_to_le16(scan_plan->interval);
3160 }
3161
3162@@ -1585,12 +1606,24 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3163 * For example, when regular scan is requested the driver sets one scan
3164 * plan with one iteration.
3165 */
3166- if (!sec_part->schedule[i - 1].iter_count)
3167- sec_part->schedule[i - 1].iter_count = 0xff;
3168+ if (!tail_v2->schedule[i - 1].iter_count)
3169+ tail_v2->schedule[i - 1].iter_count = 0xff;
3170
3171- sec_part->delay = cpu_to_le16(params->delay);
3172- sec_part->preq = params->preq;
3173+ tail_v2->delay = cpu_to_le16(params->delay);
3174
3175+ if (iwl_mvm_is_scan_ext_chan_supported(mvm)) {
3176+ tail_v2->preq = params->preq;
3177+ direct_scan = tail_v2->direct_scan;
3178+ } else {
3179+ tail_v1 = (struct iwl_scan_req_umac_tail_v1 *)sec_part;
3180+ iwl_mvm_scan_set_legacy_probe_req(&tail_v1->preq,
3181+ &params->preq);
3182+ direct_scan = tail_v1->direct_scan;
3183+ }
3184+ iwl_scan_build_ssids(params, direct_scan, &ssid_bitmap);
3185+ iwl_mvm_umac_scan_cfg_channels(mvm, params->channels,
3186+ params->n_channels, ssid_bitmap,
3187+ cmd_data);
3188 return 0;
3189 }
3190
3191@@ -2020,6 +2053,7 @@ static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type)
3192 int iwl_mvm_scan_size(struct iwl_mvm *mvm)
3193 {
3194 int base_size = IWL_SCAN_REQ_UMAC_SIZE_V1;
3195+ int tail_size;
3196
3197 if (iwl_mvm_is_adaptive_dwell_v2_supported(mvm))
3198 base_size = IWL_SCAN_REQ_UMAC_SIZE_V8;
3199@@ -2028,16 +2062,21 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm)
3200 else if (iwl_mvm_cdb_scan_api(mvm))
3201 base_size = IWL_SCAN_REQ_UMAC_SIZE_V6;
3202
3203- if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN))
3204+ if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
3205+ if (iwl_mvm_is_scan_ext_chan_supported(mvm))
3206+ tail_size = sizeof(struct iwl_scan_req_umac_tail_v2);
3207+ else
3208+ tail_size = sizeof(struct iwl_scan_req_umac_tail_v1);
3209+
3210 return base_size +
3211 sizeof(struct iwl_scan_channel_cfg_umac) *
3212 mvm->fw->ucode_capa.n_scan_channels +
3213- sizeof(struct iwl_scan_req_umac_tail);
3214-
3215+ tail_size;
3216+ }
3217 return sizeof(struct iwl_scan_req_lmac) +
3218 sizeof(struct iwl_scan_channel_cfg_lmac) *
3219 mvm->fw->ucode_capa.n_scan_channels +
3220- sizeof(struct iwl_scan_probe_req);
3221+ sizeof(struct iwl_scan_probe_req_v1);
3222 }
3223
3224 /*
3225diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c b/drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c
3226index 7cf15d1..c3ab21b 100644
3227--- a/drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c
3228+++ b/drivers/net/wireless/intel/iwlwifi/mvm/vendor-cmd.c
3229@@ -67,10 +67,6 @@
3230 #include "mvm.h"
3231 #include "iwl-vendor-cmd.h"
3232
3233-#ifdef CPTCFG_IWLWIFI_LTE_COEX
3234-#include "lte-coex.h"
3235-#endif
3236-
3237 #include "iwl-io.h"
3238 #include "iwl-prph.h"
3239
3240@@ -267,360 +263,6 @@ free:
3241 return retval;
3242 }
3243
3244-#ifdef CPTCFG_IWLWIFI_LTE_COEX
3245-static int iwl_vendor_lte_coex_state_cmd(struct wiphy *wiphy,
3246- struct wireless_dev *wdev,
3247- const void *data, int data_len)
3248-{
3249- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
3250- struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3251- const struct lte_coex_state_cmd *cmd = data;
3252- struct sk_buff *skb;
3253- int err = LTE_OK;
3254-
3255- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 100);
3256- if (!skb)
3257- return -ENOMEM;
3258-
3259- if (data_len != sizeof(*cmd)) {
3260- err = LTE_INVALID_DATA;
3261- goto out;
3262- }
3263-
3264- IWL_DEBUG_COEX(mvm, "LTE-COEX: state cmd:\n\tstate: %d\n",
3265- cmd->lte_state);
3266-
3267- switch (cmd->lte_state) {
3268- case LTE_OFF:
3269- if (mvm->lte_state.has_config &&
3270- mvm->lte_state.state != LTE_CONNECTED) {
3271- err = LTE_STATE_ERR;
3272- goto out;
3273- }
3274- mvm->lte_state.state = LTE_OFF;
3275- mvm->lte_state.has_config = 0;
3276- mvm->lte_state.has_rprtd_chan = 0;
3277- mvm->lte_state.has_sps = 0;
3278- mvm->lte_state.has_ft = 0;
3279- break;
3280- case LTE_IDLE:
3281- if (!mvm->lte_state.has_static ||
3282- (mvm->lte_state.has_config &&
3283- mvm->lte_state.state != LTE_CONNECTED)) {
3284- err = LTE_STATE_ERR;
3285- goto out;
3286- }
3287- mvm->lte_state.has_config = 0;
3288- mvm->lte_state.has_sps = 0;
3289- mvm->lte_state.state = LTE_IDLE;
3290- break;
3291- case LTE_CONNECTED:
3292- if (!(mvm->lte_state.has_config)) {
3293- err = LTE_STATE_ERR;
3294- goto out;
3295- }
3296- mvm->lte_state.state = LTE_CONNECTED;
3297- break;
3298- default:
3299- err = LTE_ILLEGAL_PARAMS;
3300- goto out;
3301- }
3302-
3303- mvm->lte_state.config.lte_state = cpu_to_le32(mvm->lte_state.state);
3304-
3305- mutex_lock(&mvm->mutex);
3306- if (iwl_mvm_send_lte_coex_config_cmd(mvm))
3307- err = LTE_OTHER_ERR;
3308- mutex_unlock(&mvm->mutex);
3309-
3310-out:
3311- if (err)
3312- iwl_mvm_reset_lte_state(mvm);
3313-
3314- if (nla_put_u8(skb, NLA_BINARY, err)) {
3315- kfree_skb(skb);
3316- return -ENOBUFS;
3317- }
3318-
3319- return cfg80211_vendor_cmd_reply(skb);
3320-}
3321-
3322-static int iwl_vendor_lte_coex_config_cmd(struct wiphy *wiphy,
3323- struct wireless_dev *wdev,
3324- const void *data, int data_len)
3325-{
3326- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
3327- struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3328- const struct lte_coex_config_info_cmd *cmd = data;
3329- struct iwl_lte_coex_static_params_cmd *stat = &mvm->lte_state.stat;
3330- struct sk_buff *skb;
3331- int err = LTE_OK;
3332- int i, j;
3333-
3334- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 100);
3335- if (!skb)
3336- return -ENOMEM;
3337-
3338- if (data_len != sizeof(*cmd)) {
3339- err = LTE_INVALID_DATA;
3340- goto out;
3341- }
3342-
3343- IWL_DEBUG_COEX(mvm, "LTE-COEX: config cmd:\n");
3344-
3345- /* send static config only once in the FW life */
3346- if (mvm->lte_state.has_static)
3347- goto out;
3348-
3349- for (i = 0; i < LTE_MWS_CONF_LENGTH; i++) {
3350- IWL_DEBUG_COEX(mvm, "\tmws config data[%d]: %d\n", i,
3351- cmd->mws_conf_data[i]);
3352- stat->mfu_config[i] = cpu_to_le32(cmd->mws_conf_data[i]);
3353- }
3354-
3355- if (cmd->safe_power_table[0] != LTE_SAFE_PT_FIRST ||
3356- cmd->safe_power_table[LTE_SAFE_PT_LENGTH - 1] !=
3357- LTE_SAFE_PT_LAST) {
3358- err = LTE_ILLEGAL_PARAMS;
3359- goto out;
3360- }
3361-
3362- /* power table must be ascending ordered */
3363- j = LTE_SAFE_PT_FIRST;
3364- for (i = 0; i < LTE_SAFE_PT_LENGTH; i++) {
3365- IWL_DEBUG_COEX(mvm, "\tsafe power table[%d]: %d\n", i,
3366- cmd->safe_power_table[i]);
3367- if (cmd->safe_power_table[i] < j) {
3368- err = LTE_ILLEGAL_PARAMS;
3369- goto out;
3370- }
3371- j = cmd->safe_power_table[i];
3372- stat->tx_power_in_dbm[i] = cmd->safe_power_table[i];
3373- }
3374-
3375- mutex_lock(&mvm->mutex);
3376- if (iwl_mvm_send_lte_coex_static_params_cmd(mvm))
3377- err = LTE_OTHER_ERR;
3378- else
3379- mvm->lte_state.has_static = 1;
3380- mutex_unlock(&mvm->mutex);
3381-
3382-out:
3383- if (err)
3384- iwl_mvm_reset_lte_state(mvm);
3385-
3386- if (nla_put_u8(skb, NLA_BINARY, err)) {
3387- kfree_skb(skb);
3388- return -ENOBUFS;
3389- }
3390-
3391- return cfg80211_vendor_cmd_reply(skb);
3392-}
3393-
3394-static int in_range(int val, int min, int max)
3395-{
3396- return (val >= min) && (val <= max);
3397-}
3398-
3399-static bool is_valid_lte_range(u16 min, u16 max)
3400-{
3401- return (min == 0 && max == 0) ||
3402- (max >= min &&
3403- in_range(min, LTE_FRQ_MIN, LTE_FRQ_MAX) &&
3404- in_range(max, LTE_FRQ_MIN, LTE_FRQ_MAX));
3405-}
3406-
3407-static int iwl_vendor_lte_coex_dynamic_info_cmd(struct wiphy *wiphy,
3408- struct wireless_dev *wdev,
3409- const void *data, int data_len)
3410-{
3411- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
3412- struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3413- const struct lte_coex_dynamic_info_cmd *cmd = data;
3414- struct iwl_lte_coex_config_cmd *config = &mvm->lte_state.config;
3415- struct sk_buff *skb;
3416- int err = LTE_OK;
3417- int i;
3418-
3419- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 100);
3420- if (!skb)
3421- return -ENOMEM;
3422-
3423- if (data_len != sizeof(*cmd)) {
3424- err = LTE_INVALID_DATA;
3425- goto out;
3426- }
3427-
3428- if (!mvm->lte_state.has_static ||
3429- (mvm->lte_state.has_config &&
3430- mvm->lte_state.state != LTE_CONNECTED)) {
3431- err = LTE_STATE_ERR;
3432- goto out;
3433- }
3434-
3435- IWL_DEBUG_COEX(mvm, "LTE-COEX: dynamic cmd:\n"
3436- "\tlte band[0]: %d, chan[0]: %d\n\ttx range: %d - %d\n"
3437- "\trx range: %d - %d\n", cmd->lte_connected_bands[0],
3438- cmd->lte_connected_bands[1], cmd->wifi_tx_safe_freq_min,
3439- cmd->wifi_tx_safe_freq_max, cmd->wifi_rx_safe_freq_min,
3440- cmd->wifi_rx_safe_freq_max);
3441-
3442- /* TODO: validate lte connected bands and channel, and frame struct */
3443- config->lte_band = cpu_to_le32(cmd->lte_connected_bands[0]);
3444- config->lte_chan = cpu_to_le32(cmd->lte_connected_bands[1]);
3445- for (i = 0; i < LTE_FRAME_STRUCT_LENGTH; i++) {
3446- IWL_DEBUG_COEX(mvm, "\tframe structure[%d]: %d\n", i,
3447- cmd->lte_frame_structure[i]);
3448- config->lte_frame_structure[i] =
3449- cpu_to_le32(cmd->lte_frame_structure[i]);
3450- }
3451- if (!is_valid_lte_range(cmd->wifi_tx_safe_freq_min,
3452- cmd->wifi_tx_safe_freq_max) ||
3453- !is_valid_lte_range(cmd->wifi_rx_safe_freq_min,
3454- cmd->wifi_rx_safe_freq_max)) {
3455- err = LTE_ILLEGAL_PARAMS;
3456- goto out;
3457- }
3458- config->tx_safe_freq_min = cpu_to_le32(cmd->wifi_tx_safe_freq_min);
3459- config->tx_safe_freq_max = cpu_to_le32(cmd->wifi_tx_safe_freq_max);
3460- config->rx_safe_freq_min = cpu_to_le32(cmd->wifi_rx_safe_freq_min);
3461- config->rx_safe_freq_max = cpu_to_le32(cmd->wifi_rx_safe_freq_max);
3462- for (i = 0; i < LTE_TX_POWER_LENGTH; i++) {
3463- IWL_DEBUG_COEX(mvm, "\twifi max tx power[%d]: %d\n", i,
3464- cmd->wifi_max_tx_power[i]);
3465- if (!in_range(cmd->wifi_max_tx_power[i], LTE_MAX_TX_MIN,
3466- LTE_MAX_TX_MAX)) {
3467- err = LTE_ILLEGAL_PARAMS;
3468- goto out;
3469- }
3470- config->max_tx_power[i] = cmd->wifi_max_tx_power[i];
3471- }
3472-
3473- mvm->lte_state.has_config = 1;
3474-
3475- if (mvm->lte_state.state == LTE_CONNECTED) {
3476- mutex_lock(&mvm->mutex);
3477- if (iwl_mvm_send_lte_coex_config_cmd(mvm))
3478- err = LTE_OTHER_ERR;
3479- mutex_unlock(&mvm->mutex);
3480- }
3481-out:
3482- if (err)
3483- iwl_mvm_reset_lte_state(mvm);
3484-
3485- if (nla_put_u8(skb, NLA_BINARY, err)) {
3486- kfree_skb(skb);
3487- return -ENOBUFS;
3488- }
3489-
3490- return cfg80211_vendor_cmd_reply(skb);
3491-}
3492-
3493-static int iwl_vendor_lte_sps_cmd(struct wiphy *wiphy,
3494- struct wireless_dev *wdev, const void *data,
3495- int data_len)
3496-{
3497- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
3498- struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3499- const struct lte_coex_sps_info_cmd *cmd = data;
3500- struct iwl_lte_coex_sps_cmd *sps = &mvm->lte_state.sps;
3501- struct sk_buff *skb;
3502- int err = LTE_OK;
3503-
3504- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 100);
3505- if (!skb)
3506- return -ENOMEM;
3507-
3508- if (data_len != sizeof(*cmd)) {
3509- err = LTE_INVALID_DATA;
3510- goto out;
3511- }
3512-
3513- IWL_DEBUG_COEX(mvm, "LTE-COEX: sps cmd:\n\tsps info: %d\n",
3514- cmd->sps_info);
3515-
3516- if (mvm->lte_state.state != LTE_CONNECTED) {
3517- err = LTE_STATE_ERR;
3518- goto out;
3519- }
3520-
3521- /* TODO: validate SPS */
3522- sps->lte_semi_persistent_info = cpu_to_le32(cmd->sps_info);
3523-
3524- mutex_lock(&mvm->mutex);
3525- if (iwl_mvm_send_lte_sps_cmd(mvm))
3526- err = LTE_OTHER_ERR;
3527- else
3528- mvm->lte_state.has_sps = 1;
3529- mutex_unlock(&mvm->mutex);
3530-
3531-out:
3532- if (err)
3533- iwl_mvm_reset_lte_state(mvm);
3534-
3535- if (nla_put_u8(skb, NLA_BINARY, err)) {
3536- kfree_skb(skb);
3537- return -ENOBUFS;
3538- }
3539-
3540- return cfg80211_vendor_cmd_reply(skb);
3541-}
3542-
3543-static int
3544-iwl_vendor_lte_coex_wifi_reported_channel_cmd(struct wiphy *wiphy,
3545- struct wireless_dev *wdev,
3546- const void *data, int data_len)
3547-{
3548- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
3549- struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3550- const struct lte_coex_wifi_reported_chan_cmd *cmd = data;
3551- struct iwl_lte_coex_wifi_reported_channel_cmd *rprtd_chan =
3552- &mvm->lte_state.rprtd_chan;
3553- struct sk_buff *skb;
3554- int err = LTE_OK;
3555-
3556- skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 100);
3557- if (!skb)
3558- return -ENOMEM;
3559-
3560- if (data_len != sizeof(*cmd)) {
3561- err = LTE_INVALID_DATA;
3562- goto out;
3563- }
3564-
3565- IWL_DEBUG_COEX(mvm, "LTE-COEX: wifi reported channel cmd:\n"
3566- "\tchannel: %d, bandwidth: %d\n", cmd->chan,
3567- cmd->bandwidth);
3568-
3569- if (!in_range(cmd->chan, LTE_RC_CHAN_MIN, LTE_RC_CHAN_MAX) ||
3570- !in_range(cmd->bandwidth, LTE_RC_BW_MIN, LTE_RC_BW_MAX)) {
3571- err = LTE_ILLEGAL_PARAMS;
3572- goto out;
3573- }
3574-
3575- rprtd_chan->channel = cpu_to_le32(cmd->chan);
3576- rprtd_chan->bandwidth = cpu_to_le32(cmd->bandwidth);
3577-
3578- mutex_lock(&mvm->mutex);
3579- if (iwl_mvm_send_lte_coex_wifi_reported_channel_cmd(mvm))
3580- err = LTE_OTHER_ERR;
3581- else
3582- mvm->lte_state.has_rprtd_chan = 1;
3583- mutex_unlock(&mvm->mutex);
3584-
3585-out:
3586- if (err)
3587- iwl_mvm_reset_lte_state(mvm);
3588-
3589- if (nla_put_u8(skb, NLA_BINARY, err)) {
3590- kfree_skb(skb);
3591- return -ENOBUFS;
3592- }
3593-
3594- return cfg80211_vendor_cmd_reply(skb);
3595-}
3596-#endif /* CPTCFG_IWLWIFI_LTE_COEX */
3597-
3598 static int iwl_vendor_frame_filter_cmd(struct wiphy *wiphy,
3599 struct wireless_dev *wdev,
3600 const void *data, int data_len)
3601@@ -1563,53 +1205,6 @@ static const struct wiphy_vendor_command iwl_mvm_vendor_commands[] = {
3602 WIPHY_VENDOR_CMD_NEED_RUNNING,
3603 .doit = iwl_mvm_get_low_latency,
3604 },
3605-#ifdef CPTCFG_IWLWIFI_LTE_COEX
3606- {
3607- .info = {
3608- .vendor_id = INTEL_OUI,
3609- .subcmd = IWL_MVM_VENDOR_CMD_LTE_STATE,
3610- },
3611- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
3612- WIPHY_VENDOR_CMD_NEED_RUNNING,
3613- .doit = iwl_vendor_lte_coex_state_cmd,
3614- },
3615- {
3616- .info = {
3617- .vendor_id = INTEL_OUI,
3618- .subcmd = IWL_MVM_VENDOR_CMD_LTE_COEX_CONFIG_INFO,
3619- },
3620- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
3621- WIPHY_VENDOR_CMD_NEED_RUNNING,
3622- .doit = iwl_vendor_lte_coex_config_cmd,
3623- },
3624- {
3625- .info = {
3626- .vendor_id = INTEL_OUI,
3627- .subcmd = IWL_MVM_VENDOR_CMD_LTE_COEX_DYNAMIC_INFO,
3628- },
3629- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
3630- WIPHY_VENDOR_CMD_NEED_RUNNING,
3631- .doit = iwl_vendor_lte_coex_dynamic_info_cmd,
3632- },
3633- {
3634- .info = {
3635- .vendor_id = INTEL_OUI,
3636- .subcmd = IWL_MVM_VENDOR_CMD_LTE_COEX_SPS_INFO,
3637- },
3638- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
3639- WIPHY_VENDOR_CMD_NEED_RUNNING,
3640- .doit = iwl_vendor_lte_sps_cmd,
3641- },
3642- {
3643- .info = {
3644- .vendor_id = INTEL_OUI,
3645- .subcmd = IWL_MVM_VENDOR_CMD_LTE_COEX_WIFI_RPRTD_CHAN,
3646- },
3647- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
3648- WIPHY_VENDOR_CMD_NEED_RUNNING,
3649- .doit = iwl_vendor_lte_coex_wifi_reported_channel_cmd,
3650- },
3651-#endif /* CPTCFG_IWLWIFI_LTE_COEX */
3652 {
3653 .info = {
3654 .vendor_id = INTEL_OUI,
3655diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
3656index 8b2364a..fee789b 100644
3657--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
3658+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
3659@@ -65,7 +65,6 @@
3660 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3661
3662 #include <linux/module.h>
3663-#include <linux/pm_runtime.h>
3664 #include <linux/pci.h>
3665 #include <linux/acpi.h>
3666
3667@@ -875,25 +874,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3668 /* register transport layer debugfs here */
3669 iwl_trans_pcie_dbgfs_register(iwl_trans);
3670
3671- /* if RTPM is in use, enable it in our device */
3672- if (iwl_trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) {
3673- /* We explicitly set the device to active here to
3674- * clear contingent errors.
3675- */
3676- pm_runtime_set_active(&pdev->dev);
3677-
3678- pm_runtime_set_autosuspend_delay(&pdev->dev,
3679- iwlwifi_mod_params.d0i3_timeout);
3680- pm_runtime_use_autosuspend(&pdev->dev);
3681-
3682- /* We are not supposed to call pm_runtime_allow() by
3683- * ourselves, but let userspace enable runtime PM via
3684- * sysfs. However, since we don't enable this from
3685- * userspace yet, we need to allow/forbid() ourselves.
3686- */
3687- pm_runtime_allow(&pdev->dev);
3688- }
3689-
3690 /* The PCI device starts with a reference taken and we are
3691 * supposed to release it here. But to simplify the
3692 * interaction with the opmode, we don't do it now, but let
3693@@ -911,15 +891,6 @@ static void iwl_pci_remove(struct pci_dev *pdev)
3694 {
3695 struct iwl_trans *trans = pci_get_drvdata(pdev);
3696
3697- /* if RTPM was in use, restore it to the state before probe */
3698- if (trans->runtime_pm_mode != IWL_PLAT_PM_MODE_DISABLED) {
3699- /* We should not call forbid here, but we do for now.
3700- * Check the comment to pm_runtime_allow() in
3701- * iwl_pci_probe().
3702- */
3703- pm_runtime_forbid(trans->dev);
3704- }
3705-
3706 iwl_drv_stop(trans->drv);
3707
3708 iwl_trans_pcie_free(trans);
3709@@ -977,76 +948,6 @@ static int iwl_pci_resume(struct device *device)
3710 return 0;
3711 }
3712
3713-int iwl_pci_fw_enter_d0i3(struct iwl_trans *trans)
3714-{
3715- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3716- int ret;
3717-
3718- if (test_bit(STATUS_FW_ERROR, &trans->status))
3719- return 0;
3720-
3721- set_bit(STATUS_TRANS_GOING_IDLE, &trans->status);
3722-
3723- /* config the fw */
3724- ret = iwl_op_mode_enter_d0i3(trans->op_mode);
3725- if (ret == 1) {
3726- IWL_DEBUG_RPM(trans, "aborting d0i3 entrance\n");
3727- clear_bit(STATUS_TRANS_GOING_IDLE, &trans->status);
3728- return -EBUSY;
3729- }
3730- if (ret)
3731- goto err;
3732-
3733- ret = wait_event_timeout(trans_pcie->d0i3_waitq,
3734- test_bit(STATUS_TRANS_IDLE, &trans->status),
3735- msecs_to_jiffies(IWL_TRANS_IDLE_TIMEOUT));
3736- if (!ret) {
3737- IWL_ERR(trans, "Timeout entering D0i3\n");
3738- ret = -ETIMEDOUT;
3739- goto err;
3740- }
3741-
3742- clear_bit(STATUS_TRANS_GOING_IDLE, &trans->status);
3743-
3744- return 0;
3745-err:
3746- clear_bit(STATUS_TRANS_GOING_IDLE, &trans->status);
3747- iwl_trans_fw_error(trans);
3748- return ret;
3749-}
3750-
3751-int iwl_pci_fw_exit_d0i3(struct iwl_trans *trans)
3752-{
3753- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3754- int ret;
3755-
3756- /* sometimes a D0i3 entry is not followed through */
3757- if (!test_bit(STATUS_TRANS_IDLE, &trans->status))
3758- return 0;
3759-
3760- /* config the fw */
3761- ret = iwl_op_mode_exit_d0i3(trans->op_mode);
3762- if (ret)
3763- goto err;
3764-
3765- /* we clear STATUS_TRANS_IDLE only when D0I3_END command is completed */
3766-
3767- ret = wait_event_timeout(trans_pcie->d0i3_waitq,
3768- !test_bit(STATUS_TRANS_IDLE, &trans->status),
3769- msecs_to_jiffies(IWL_TRANS_IDLE_TIMEOUT));
3770- if (!ret) {
3771- IWL_ERR(trans, "Timeout exiting D0i3\n");
3772- ret = -ETIMEDOUT;
3773- goto err;
3774- }
3775-
3776- return 0;
3777-err:
3778- clear_bit(STATUS_TRANS_IDLE, &trans->status);
3779- iwl_trans_fw_error(trans);
3780- return ret;
3781-}
3782-
3783 static const struct dev_pm_ops iwl_dev_pm_ops = {
3784 SET_SYSTEM_SLEEP_PM_OPS(iwl_pci_suspend,
3785 iwl_pci_resume)
3786diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
3787index 1f8e9a6..48017cc 100644
3788--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
3789+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
3790@@ -558,7 +558,6 @@ struct iwl_trans_pcie {
3791 bool ucode_write_complete;
3792 wait_queue_head_t ucode_write_waitq;
3793 wait_queue_head_t wait_command_queue;
3794- wait_queue_head_t d0i3_waitq;
3795
3796 u8 page_offs, dev_cmd_offs;
3797
3798@@ -581,7 +580,6 @@ struct iwl_trans_pcie {
3799 /*protect hw register */
3800 spinlock_t reg_lock;
3801 bool cmd_hold_nic_awake;
3802- bool ref_cmd_in_flight;
3803
3804 #ifdef CPTCFG_IWLWIFI_DEBUGFS
3805 struct cont_rec fw_mon_data;
3806@@ -696,6 +694,7 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
3807 struct iwl_rx_cmd_buffer *rxb);
3808 void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
3809 struct sk_buff_head *skbs);
3810+void iwl_trans_pcie_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr);
3811 void iwl_trans_pcie_tx_reset(struct iwl_trans *trans);
3812 void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
3813 struct iwl_txq *txq, u16 byte_cnt,
3814@@ -1063,9 +1062,6 @@ void iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans);
3815 static inline void iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans) { }
3816 #endif
3817
3818-int iwl_pci_fw_exit_d0i3(struct iwl_trans *trans);
3819-int iwl_pci_fw_enter_d0i3(struct iwl_trans *trans);
3820-
3821 void iwl_pcie_rx_allocator_work(struct work_struct *data);
3822
3823 /* common functions that are used by gen2 transport */
3824@@ -1119,9 +1115,8 @@ int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
3825 struct iwl_device_cmd *dev_cmd, int txq_id);
3826 int iwl_trans_pcie_gen2_send_hcmd(struct iwl_trans *trans,
3827 struct iwl_host_cmd *cmd);
3828-void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans,
3829- bool low_power);
3830-void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power);
3831+void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans);
3832+void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans);
3833 void iwl_pcie_gen2_txq_unmap(struct iwl_trans *trans, int txq_id);
3834 void iwl_pcie_gen2_tx_free(struct iwl_trans *trans);
3835 void iwl_pcie_gen2_tx_stop(struct iwl_trans *trans);
3836diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
3837index 104b7cc..c099ad8 100644
3838--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
3839+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
3840@@ -136,7 +136,7 @@ static void iwl_pcie_gen2_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
3841 BIT(trans->cfg->csr->flag_init_done));
3842 }
3843
3844-void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
3845+void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)
3846 {
3847 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3848
3849@@ -215,7 +215,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
3850 iwl_pcie_prepare_card_hw(trans);
3851 }
3852
3853-void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
3854+void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)
3855 {
3856 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3857 bool was_in_rfkill;
3858@@ -223,7 +223,7 @@ void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
3859 mutex_lock(&trans_pcie->mutex);
3860 trans_pcie->opmode_down = true;
3861 was_in_rfkill = test_bit(STATUS_RFKILL_OPMODE, &trans->status);
3862- _iwl_trans_pcie_gen2_stop_device(trans, low_power);
3863+ _iwl_trans_pcie_gen2_stop_device(trans);
3864 iwl_trans_pcie_handle_stop_rfkill(trans, was_in_rfkill);
3865 mutex_unlock(&trans_pcie->mutex);
3866 }
3867diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3868index 77e740d..1e63a59 100644
3869--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3870+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
3871@@ -69,7 +69,6 @@
3872 #include <linux/bitops.h>
3873 #include <linux/gfp.h>
3874 #include <linux/vmalloc.h>
3875-#include <linux/pm_runtime.h>
3876 #include <linux/module.h>
3877 #include <linux/wait.h>
3878
3879@@ -1279,7 +1278,7 @@ static void iwl_pcie_init_msix(struct iwl_trans_pcie *trans_pcie)
3880 trans_pcie->hw_mask = trans_pcie->hw_init_mask;
3881 }
3882
3883-static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
3884+static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans)
3885 {
3886 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3887
3888@@ -1495,7 +1494,7 @@ void iwl_trans_pcie_handle_stop_rfkill(struct iwl_trans *trans,
3889 iwl_trans_pcie_rf_kill(trans, hw_rfkill);
3890 }
3891
3892-static void iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
3893+static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
3894 {
3895 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3896 bool was_in_rfkill;
3897@@ -1503,7 +1502,7 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
3898 mutex_lock(&trans_pcie->mutex);
3899 trans_pcie->opmode_down = true;
3900 was_in_rfkill = test_bit(STATUS_RFKILL_OPMODE, &trans->status);
3901- _iwl_trans_pcie_stop_device(trans, low_power);
3902+ _iwl_trans_pcie_stop_device(trans);
3903 iwl_trans_pcie_handle_stop_rfkill(trans, was_in_rfkill);
3904 mutex_unlock(&trans_pcie->mutex);
3905 }
3906@@ -1519,9 +1518,9 @@ void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state)
3907 state ? "disabled" : "enabled");
3908 if (iwl_op_mode_hw_rf_kill(trans->op_mode, state)) {
3909 if (trans->cfg->gen2)
3910- _iwl_trans_pcie_gen2_stop_device(trans, true);
3911+ _iwl_trans_pcie_gen2_stop_device(trans);
3912 else
3913- _iwl_trans_pcie_stop_device(trans, true);
3914+ _iwl_trans_pcie_stop_device(trans);
3915 }
3916 }
3917
3918@@ -1780,7 +1779,7 @@ static int iwl_trans_pcie_clear_persistence_bit(struct iwl_trans *trans)
3919 return 0;
3920 }
3921
3922-static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
3923+static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans)
3924 {
3925 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3926 int err;
3927@@ -1816,20 +1815,16 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
3928 /* ...rfkill can call stop_device and set it false if needed */
3929 iwl_pcie_check_hw_rf_kill(trans);
3930
3931- /* Make sure we sync here, because we'll need full access later */
3932- if (low_power)
3933- pm_runtime_resume(trans->dev);
3934-
3935 return 0;
3936 }
3937
3938-static int iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
3939+static int iwl_trans_pcie_start_hw(struct iwl_trans *trans)
3940 {
3941 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3942 int ret;
3943
3944 mutex_lock(&trans_pcie->mutex);
3945- ret = _iwl_trans_pcie_start_hw(trans, low_power);
3946+ ret = _iwl_trans_pcie_start_hw(trans);
3947 mutex_unlock(&trans_pcie->mutex);
3948
3949 return ret;
3950@@ -2413,41 +2408,6 @@ static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg,
3951 spin_unlock_irqrestore(&trans_pcie->reg_lock, flags);
3952 }
3953
3954-static void iwl_trans_pcie_ref(struct iwl_trans *trans)
3955-{
3956- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3957-
3958- if (iwlwifi_mod_params.d0i3_disable)
3959- return;
3960-
3961- pm_runtime_get(&trans_pcie->pci_dev->dev);
3962-
3963-#ifdef CONFIG_PM
3964-#if (defined(CONFIG_PM_RUNTIME) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
3965- IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
3966- atomic_read(&trans_pcie->pci_dev->dev.power.usage_count));
3967-#endif
3968-#endif /* CONFIG_PM */
3969-}
3970-
3971-static void iwl_trans_pcie_unref(struct iwl_trans *trans)
3972-{
3973- struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3974-
3975- if (iwlwifi_mod_params.d0i3_disable)
3976- return;
3977-
3978- pm_runtime_mark_last_busy(&trans_pcie->pci_dev->dev);
3979- pm_runtime_put_autosuspend(&trans_pcie->pci_dev->dev);
3980-
3981-#ifdef CONFIG_PM
3982-#if (defined(CONFIG_PM_RUNTIME) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
3983- IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
3984- atomic_read(&trans_pcie->pci_dev->dev.power.usage_count));
3985-#endif
3986-#endif /* CONFIG_PM */
3987-}
3988-
3989 static const char *get_csr_string(int cmd)
3990 {
3991 #define IWL_CMD(x) case x: return #x
3992@@ -3369,18 +3329,11 @@ static struct iwl_trans_dump_data
3993 #ifdef CONFIG_PM_SLEEP
3994 static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
3995 {
3996- if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 &&
3997- (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3))
3998- return iwl_pci_fw_enter_d0i3(trans);
3999-
4000 return 0;
4001 }
4002
4003 static void iwl_trans_pcie_resume(struct iwl_trans *trans)
4004 {
4005- if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 &&
4006- (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3))
4007- iwl_pci_fw_exit_d0i3(trans);
4008 }
4009 #endif /* CONFIG_PM_SLEEP */
4010
4011@@ -3399,8 +3352,6 @@ static void iwl_trans_pcie_resume(struct iwl_trans *trans)
4012 .grab_nic_access = iwl_trans_pcie_grab_nic_access, \
4013 .release_nic_access = iwl_trans_pcie_release_nic_access, \
4014 .set_bits_mask = iwl_trans_pcie_set_bits_mask, \
4015- .ref = iwl_trans_pcie_ref, \
4016- .unref = iwl_trans_pcie_unref, \
4017 .dump_data = iwl_trans_pcie_dump_data, \
4018 .d3_suspend = iwl_trans_pcie_d3_suspend, \
4019 .d3_resume = iwl_trans_pcie_d3_resume, \
4020@@ -3454,6 +3405,8 @@ static const struct iwl_trans_ops trans_ops_pcie_gen2 = {
4021 .tx = iwl_trans_pcie_gen2_tx,
4022 .reclaim = iwl_trans_pcie_reclaim,
4023
4024+ .set_q_ptrs = iwl_trans_pcie_set_q_ptrs,
4025+
4026 .txq_alloc = iwl_trans_pcie_dyn_txq_alloc,
4027 .txq_free = iwl_trans_pcie_dyn_txq_free,
4028 .wait_txq_empty = iwl_trans_pcie_wait_txq_empty,
4029@@ -3722,8 +3675,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
4030 /* Initialize the wait queue for commands */
4031 init_waitqueue_head(&trans_pcie->wait_command_queue);
4032
4033- init_waitqueue_head(&trans_pcie->d0i3_waitq);
4034-
4035 if (trans_pcie->msix_enabled) {
4036 ret = iwl_pcie_init_msix_handler(pdev, trans_pcie);
4037 if (ret)
4038@@ -3748,8 +3699,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
4039 WQ_HIGHPRI | WQ_UNBOUND, 1);
4040 INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
4041
4042- trans->runtime_pm_mode = IWL_PLAT_PM_MODE_DISABLED;
4043-
4044 #ifdef CPTCFG_IWLWIFI_DEBUGFS
4045 trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED;
4046 mutex_init(&trans_pcie->fw_mon_data.mutex);
4047diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
4048index af389f0..2740032 100644
4049--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
4050+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
4051@@ -50,7 +50,6 @@
4052 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4053 *
4054 *****************************************************************************/
4055-#include <linux/pm_runtime.h>
4056 #include <net/tso.h>
4057 #include <linux/tcp.h>
4058
4059@@ -654,12 +653,8 @@ int iwl_trans_pcie_gen2_tx(struct iwl_trans *trans, struct sk_buff *skb,
4060 iwl_pcie_gen2_get_num_tbs(trans, tfd));
4061
4062 /* start timer if queue currently empty */
4063- if (txq->read_ptr == txq->write_ptr) {
4064- if (txq->wd_timeout)
4065- mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);
4066- IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", txq->id);
4067- iwl_trans_ref(trans);
4068- }
4069+ if (txq->read_ptr == txq->write_ptr && txq->wd_timeout)
4070+ mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);
4071
4072 /* Tell device the write index *just past* this latest filled TFD */
4073 txq->write_ptr = iwl_queue_inc_wrap(trans, txq->write_ptr);
4074@@ -904,12 +899,6 @@ static int iwl_pcie_gen2_enqueue_hcmd(struct iwl_trans *trans,
4075 mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);
4076
4077 spin_lock_irqsave(&trans_pcie->reg_lock, flags);
4078- if (!(cmd->flags & CMD_SEND_IN_IDLE) &&
4079- !trans_pcie->ref_cmd_in_flight) {
4080- trans_pcie->ref_cmd_in_flight = true;
4081- IWL_DEBUG_RPM(trans, "set ref_cmd_in_flight - ref\n");
4082- iwl_trans_ref(trans);
4083- }
4084 /* Increment and update queue's write index */
4085 txq->write_ptr = iwl_queue_inc_wrap(trans, txq->write_ptr);
4086 iwl_pcie_gen2_txq_inc_wr_ptr(trans, txq);
4087@@ -943,16 +932,6 @@ static int iwl_pcie_gen2_send_hcmd_sync(struct iwl_trans *trans,
4088
4089 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", cmd_str);
4090
4091- if (pm_runtime_suspended(&trans_pcie->pci_dev->dev)) {
4092- ret = wait_event_timeout(trans_pcie->d0i3_waitq,
4093- pm_runtime_active(&trans_pcie->pci_dev->dev),
4094- msecs_to_jiffies(IWL_TRANS_IDLE_TIMEOUT));
4095- if (!ret) {
4096- IWL_ERR(trans, "Timeout exiting D0i3 before hcmd\n");
4097- return -ETIMEDOUT;
4098- }
4099- }
4100-
4101 cmd_idx = iwl_pcie_gen2_enqueue_hcmd(trans, cmd);
4102 if (cmd_idx < 0) {
4103 ret = cmd_idx;
4104@@ -1077,23 +1056,6 @@ void iwl_pcie_gen2_txq_unmap(struct iwl_trans *trans, int txq_id)
4105 }
4106 iwl_pcie_gen2_free_tfd(trans, txq);
4107 txq->read_ptr = iwl_queue_inc_wrap(trans, txq->read_ptr);
4108-
4109- if (txq->read_ptr == txq->write_ptr) {
4110- unsigned long flags;
4111-
4112- spin_lock_irqsave(&trans_pcie->reg_lock, flags);
4113- if (txq_id != trans_pcie->cmd_queue) {
4114- IWL_DEBUG_RPM(trans, "Q %d - last tx freed\n",
4115- txq->id);
4116- iwl_trans_unref(trans);
4117- } else if (trans_pcie->ref_cmd_in_flight) {
4118- trans_pcie->ref_cmd_in_flight = false;
4119- IWL_DEBUG_RPM(trans,
4120- "clear ref_cmd_in_flight\n");
4121- iwl_trans_unref(trans);
4122- }
4123- spin_unlock_irqrestore(&trans_pcie->reg_lock, flags);
4124- }
4125 }
4126
4127 while (!skb_queue_empty(&txq->overflow_q)) {
4128diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
4129index 7c601ac..a1e4835 100644
4130--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
4131+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
4132@@ -65,7 +65,6 @@
4133 #include <linux/ieee80211.h>
4134 #include <linux/slab.h>
4135 #include <linux/sched.h>
4136-#include <linux/pm_runtime.h>
4137 #include <net/ip6_checksum.h>
4138 #include <net/tso.h>
4139
4140@@ -637,12 +636,6 @@ static void iwl_pcie_clear_cmd_in_flight(struct iwl_trans *trans)
4141
4142 lockdep_assert_held(&trans_pcie->reg_lock);
4143
4144- if (trans_pcie->ref_cmd_in_flight) {
4145- trans_pcie->ref_cmd_in_flight = false;
4146- IWL_DEBUG_RPM(trans, "clear ref_cmd_in_flight - unref\n");
4147- iwl_trans_unref(trans);
4148- }
4149-
4150 if (!trans->cfg->base_params->apmg_wake_up_wa)
4151 return;
4152 if (WARN_ON(!trans_pcie->cmd_hold_nic_awake))
4153@@ -681,13 +674,8 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id)
4154 unsigned long flags;
4155
4156 spin_lock_irqsave(&trans_pcie->reg_lock, flags);
4157- if (txq_id != trans_pcie->cmd_queue) {
4158- IWL_DEBUG_RPM(trans, "Q %d - last tx freed\n",
4159- txq->id);
4160- iwl_trans_unref(trans);
4161- } else {
4162+ if (txq_id == trans_pcie->cmd_queue)
4163 iwl_pcie_clear_cmd_in_flight(trans);
4164- }
4165 spin_unlock_irqrestore(&trans_pcie->reg_lock, flags);
4166 }
4167 }
4168@@ -1223,15 +1211,22 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
4169 txq->overflow_tx = false;
4170 }
4171
4172- if (txq->read_ptr == txq->write_ptr) {
4173- IWL_DEBUG_RPM(trans, "Q %d - last tx reclaimed\n", txq->id);
4174- iwl_trans_unref(trans);
4175- }
4176-
4177 out:
4178 spin_unlock_bh(&txq->lock);
4179 }
4180
4181+/* Set wr_ptr of specific device and txq */
4182+void iwl_trans_pcie_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr)
4183+{
4184+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
4185+ struct iwl_txq *txq = trans_pcie->txq[txq_id];
4186+
4187+ lockdep_assert_held(&txq->lock);
4188+
4189+ txq->write_ptr = ptr;
4190+ txq->read_ptr = txq->write_ptr;
4191+}
4192+
4193 static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans,
4194 const struct iwl_host_cmd *cmd)
4195 {
4196@@ -1245,13 +1240,6 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans,
4197 if (test_bit(STATUS_TRANS_DEAD, &trans->status))
4198 return -ENODEV;
4199
4200- if (!(cmd->flags & CMD_SEND_IN_IDLE) &&
4201- !trans_pcie->ref_cmd_in_flight) {
4202- trans_pcie->ref_cmd_in_flight = true;
4203- IWL_DEBUG_RPM(trans, "set ref_cmd_in_flight - ref\n");
4204- iwl_trans_ref(trans);
4205- }
4206-
4207 /*
4208 * wake up the NIC to make sure that the firmware will see the host
4209 * command - we will let the NIC sleep once all the host commands
4210@@ -1865,20 +1853,6 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
4211 wake_up(&trans_pcie->wait_command_queue);
4212 }
4213
4214- if (meta->flags & CMD_MAKE_TRANS_IDLE) {
4215- IWL_DEBUG_INFO(trans, "complete %s - mark trans as idle\n",
4216- iwl_get_cmd_string(trans, cmd->hdr.cmd));
4217- set_bit(STATUS_TRANS_IDLE, &trans->status);
4218- wake_up(&trans_pcie->d0i3_waitq);
4219- }
4220-
4221- if (meta->flags & CMD_WAKE_UP_TRANS) {
4222- IWL_DEBUG_INFO(trans, "complete %s - clear trans idle flag\n",
4223- iwl_get_cmd_string(trans, cmd->hdr.cmd));
4224- clear_bit(STATUS_TRANS_IDLE, &trans->status);
4225- wake_up(&trans_pcie->d0i3_waitq);
4226- }
4227-
4228 meta->flags = 0;
4229
4230 spin_unlock_bh(&txq->lock);
4231@@ -1925,16 +1899,6 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
4232 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n",
4233 iwl_get_cmd_string(trans, cmd->id));
4234
4235- if (pm_runtime_suspended(&trans_pcie->pci_dev->dev)) {
4236- ret = wait_event_timeout(trans_pcie->d0i3_waitq,
4237- pm_runtime_active(&trans_pcie->pci_dev->dev),
4238- msecs_to_jiffies(IWL_TRANS_IDLE_TIMEOUT));
4239- if (!ret) {
4240- IWL_ERR(trans, "Timeout exiting D0i3 before hcmd\n");
4241- return -ETIMEDOUT;
4242- }
4243- }
4244-
4245 cmd_idx = iwl_pcie_enqueue_hcmd(trans, cmd);
4246 if (cmd_idx < 0) {
4247 ret = cmd_idx;
4248@@ -2517,22 +2481,18 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
4249 wait_write_ptr = ieee80211_has_morefrags(fc);
4250
4251 /* start timer if queue currently empty */
4252- if (txq->read_ptr == txq->write_ptr) {
4253- if (txq->wd_timeout) {
4254- /*
4255- * If the TXQ is active, then set the timer, if not,
4256- * set the timer in remainder so that the timer will
4257- * be armed with the right value when the station will
4258- * wake up.
4259- */
4260- if (!txq->frozen)
4261- mod_timer(&txq->stuck_timer,
4262- jiffies + txq->wd_timeout);
4263- else
4264- txq->frozen_expiry_remainder = txq->wd_timeout;
4265- }
4266- IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", txq->id);
4267- iwl_trans_ref(trans);
4268+ if (txq->read_ptr == txq->write_ptr && txq->wd_timeout) {
4269+ /*
4270+ * If the TXQ is active, then set the timer, if not,
4271+ * set the timer in remainder so that the timer will
4272+ * be armed with the right value when the station will
4273+ * wake up.
4274+ */
4275+ if (!txq->frozen)
4276+ mod_timer(&txq->stuck_timer,
4277+ jiffies + txq->wd_timeout);
4278+ else
4279+ txq->frozen_expiry_remainder = txq->wd_timeout;
4280 }
4281
4282 /* Tell device the write index *just past* this latest filled TFD */
4283diff --git a/drivers/net/wireless/intel/iwlwifi/xvt/fw.c b/drivers/net/wireless/intel/iwlwifi/xvt/fw.c
4284index 95a3eca..6755e7d 100644
4285--- a/drivers/net/wireless/intel/iwlwifi/xvt/fw.c
4286+++ b/drivers/net/wireless/intel/iwlwifi/xvt/fw.c
4287@@ -322,7 +322,7 @@ static int iwl_xvt_config_ltr(struct iwl_xvt *xvt)
4288 return iwl_xvt_send_cmd_pdu(xvt, LTR_CONFIG, 0, sizeof(cmd), &cmd);
4289 }
4290
4291-int iwl_xvt_run_fw(struct iwl_xvt *xvt, u32 ucode_type, bool cont_run)
4292+int iwl_xvt_run_fw(struct iwl_xvt *xvt, u32 ucode_type)
4293 {
4294 int ret;
4295
4296@@ -338,13 +338,10 @@ int iwl_xvt_run_fw(struct iwl_xvt *xvt, u32 ucode_type, bool cont_run)
4297 iwl_xvt_txq_disable(xvt);
4298 }
4299 iwl_fw_dbg_stop_sync(&xvt->fwrt);
4300- _iwl_trans_stop_device(xvt->trans, !cont_run);
4301+ iwl_trans_stop_device(xvt->trans);
4302 }
4303
4304- if (cont_run)
4305- ret = _iwl_trans_start_hw(xvt->trans, false);
4306- else
4307- ret = iwl_trans_start_hw(xvt->trans);
4308+ ret = iwl_trans_start_hw(xvt->trans);
4309 if (ret) {
4310 IWL_ERR(xvt, "Failed to start HW\n");
4311 return ret;
4312diff --git a/drivers/net/wireless/intel/iwlwifi/xvt/user-infc.c b/drivers/net/wireless/intel/iwlwifi/xvt/user-infc.c
4313index 137fd8c..ee89d9a 100644
4314--- a/drivers/net/wireless/intel/iwlwifi/xvt/user-infc.c
4315+++ b/drivers/net/wireless/intel/iwlwifi/xvt/user-infc.c
4316@@ -482,11 +482,12 @@ init_error:
4317 iwl_trans_stop_device(xvt->trans);
4318 return err;
4319 }
4320-static int iwl_xvt_run_runtime_fw(struct iwl_xvt *xvt, bool cont_run)
4321+
4322+static int iwl_xvt_run_runtime_fw(struct iwl_xvt *xvt)
4323 {
4324 int err;
4325
4326- err = iwl_xvt_run_fw(xvt, IWL_UCODE_REGULAR, cont_run);
4327+ err = iwl_xvt_run_fw(xvt, IWL_UCODE_REGULAR);
4328 if (err)
4329 goto fw_error;
4330
4331@@ -557,7 +558,7 @@ static int iwl_xvt_start_op_mode(struct iwl_xvt *xvt)
4332 */
4333 if (!(xvt->sw_stack_cfg.load_mask & IWL_XVT_LOAD_MASK_INIT)) {
4334 if (xvt->sw_stack_cfg.load_mask & IWL_XVT_LOAD_MASK_RUNTIME) {
4335- err = iwl_xvt_run_runtime_fw(xvt, false);
4336+ err = iwl_xvt_run_runtime_fw(xvt);
4337 } else {
4338 if (xvt->state != IWL_XVT_STATE_UNINITIALIZED) {
4339 xvt->fw_running = false;
4340@@ -579,7 +580,7 @@ static int iwl_xvt_start_op_mode(struct iwl_xvt *xvt)
4341 /* when fw image is unified, only regular ucode is loaded. */
4342 if (iwl_xvt_is_unified_fw(xvt))
4343 ucode_type = IWL_UCODE_REGULAR;
4344- err = iwl_xvt_run_fw(xvt, ucode_type, false);
4345+ err = iwl_xvt_run_fw(xvt, ucode_type);
4346 if (err)
4347 return err;
4348
4349@@ -665,7 +666,7 @@ static int iwl_xvt_continue_init(struct iwl_xvt *xvt)
4350
4351 if (xvt->sw_stack_cfg.load_mask & IWL_XVT_LOAD_MASK_RUNTIME)
4352 /* Run runtime FW stops the device by itself if error occurs */
4353- err = iwl_xvt_run_runtime_fw(xvt, true);
4354+ err = iwl_xvt_run_runtime_fw(xvt);
4355
4356 goto cont_init_end;
4357
4358diff --git a/drivers/net/wireless/intel/iwlwifi/xvt/xvt.h b/drivers/net/wireless/intel/iwlwifi/xvt/xvt.h
4359index 8ede75f..baae1bf 100644
4360--- a/drivers/net/wireless/intel/iwlwifi/xvt/xvt.h
4361+++ b/drivers/net/wireless/intel/iwlwifi/xvt/xvt.h
4362@@ -7,7 +7,7 @@
4363 *
4364 * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
4365 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
4366- * Copyright(c) 2018 Intel Corporation
4367+ * Copyright(c) 2018 - 2019 Intel Corporation
4368 *
4369 * This program is free software; you can redistribute it and/or modify
4370 * it under the terms of version 2 of the GNU General Public License as
4371@@ -29,7 +29,7 @@
4372 *
4373 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
4374 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
4375- * Copyright(c) 2018 Intel Corporation
4376+ * Copyright(c) 2018 - 2019 Intel Corporation
4377 * All rights reserved.
4378 *
4379 * Redistribution and use in source and binary forms, with or without
4380@@ -443,7 +443,7 @@ int iwl_xvt_user_cmd_execute(struct iwl_testmode *testmode, u32 cmd,
4381 struct iwl_tm_data *data_out, bool *supported_cmd);
4382
4383 /* FW */
4384-int iwl_xvt_run_fw(struct iwl_xvt *xvt, u32 ucode_type, bool cont_run);
4385+int iwl_xvt_run_fw(struct iwl_xvt *xvt, u32 ucode_type);
4386
4387 /* NVM */
4388 int iwl_xvt_nvm_init(struct iwl_xvt *xvt);
4389diff --git a/include/linux/fm/iui_fm.h b/include/linux/fm/iui_fm.h
4390deleted file mode 100644
4391index 1411a3b..0000000
4392--- a/include/linux/fm/iui_fm.h
4393+++ /dev/null
4394@@ -1,143 +0,0 @@
4395-/******************************************************************************
4396- *
4397- * This file is provided under a dual BSD/GPLv2 license. When using or
4398- * redistributing this file, you may do so under either license.
4399- *
4400- * GPL LICENSE SUMMARY
4401- *
4402- * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved.
4403- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
4404- *
4405- * This program is free software; you can redistribute it and/or modify
4406- * it under the terms of version 2 of the GNU General Public License as
4407- * published by the Free Software Foundation.
4408- *
4409- * This program is distributed in the hope that it will be useful, but
4410- * WITHOUT ANY WARRANTY; without even the implied warranty of
4411- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4412- * General Public License for more details.
4413- *
4414- * You should have received a copy of the GNU General Public License
4415- * along with this program; if not, write to the Free Software
4416- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
4417- * USA
4418- *
4419- * The full GNU General Public License is included in this distribution
4420- * in the file called COPYING.
4421- *
4422- * Contact Information:
4423- * Intel Linux Wireless <linuxwifi@intel.com>
4424- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
4425- *
4426- * BSD LICENSE
4427- *
4428- * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved.
4429- * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
4430- * All rights reserved.
4431- *
4432- * Redistribution and use in source and binary forms, with or without
4433- * modification, are permitted provided that the following conditions
4434- * are met:
4435- *
4436- * * Redistributions of source code must retain the above copyright
4437- * notice, this list of conditions and the following disclaimer.
4438- * * Redistributions in binary form must reproduce the above copyright
4439- * notice, this list of conditions and the following disclaimer in
4440- * the documentation and/or other materials provided with the
4441- * distribution.
4442- * * Neither the name Intel Corporation nor the names of its
4443- * contributors may be used to endorse or promote products derived
4444- * from this software without specific prior written permission.
4445- *
4446- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4447- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4448- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4449- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4450- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4451- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4452- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4453- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4454- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4455- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4456- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4457- *
4458- *****************************************************************************/
4459-
4460-#ifndef __FM_TEST_IUI_H
4461-#define __FM_TEST_IUI_H
4462-
4463-#include <linux/errno.h>
4464-
4465-#if defined(CONFIG_IUI_FM) /* Use platform h file - NOT XMM6312/SOFIA-3G */
4466-#include <linux/fm/iui_fm_lte.h>
4467-#else /* Platform doesn't have FM - use test h file */
4468-#include "iui_fm_test.h"
4469-#endif /* CONFIG_IUI_FM */
4470-
4471-#ifdef CPTCFG_IWLWIFI_FRQ_MGR_TEST
4472-int32_t
4473-iwl_mvm_fm_test_register_callback(const enum iui_fm_macro_id macro_id,
4474- const iui_fm_mitigation_cb mitigation_cb);
4475-int32_t
4476-iwl_mvm_fm_test_notify_frequency(const enum iui_fm_macro_id macro_id,
4477- const struct iui_fm_freq_notification *
4478- const notification);
4479-#endif /* CPTCFG_IWLWIFI_FRQ_MGR_TEST */
4480-
4481-/*
4482- * If platform has FM then we have 2 modes:
4483- * Regular mode: Call the FM register function
4484- * Debug mode: Don't call the FM register function & use test mode
4485- * implementation.
4486- * If platform does not have FM then we use test mode implementation.
4487- */
4488-static inline
4489-int32_t iwl_mvm_fm_register_callback(bool dbg_mode,
4490- const enum iui_fm_macro_id macro_id,
4491- const iui_fm_mitigation_cb mitigation_cb)
4492-{
4493-#ifdef CPTCFG_IWLWIFI_FRQ_MGR_TEST
4494- /* Platform does not have a FM or test mode was requested */
4495- if (dbg_mode)
4496- return iwl_mvm_fm_test_register_callback(macro_id,
4497- mitigation_cb);
4498-#endif /* CPTCFG_IWLWIFI_FRQ_MGR_TEST */
4499-
4500-#if defined(CONFIG_IUI_FM) /* Not XMM6321/Sofa-3G - Platform has a FM */
4501- return iui_fm_register_mitigation_callback_lte(macro_id,
4502- mitigation_cb);
4503-#else
4504-
4505- return -EPERM; /* fm_debug_mode was not set */
4506-#endif /* CONFIG_IUI_FM */
4507-}
4508-
4509-/*
4510- * If platform has FM then we have 2 modes:
4511- * Regular mode: Call the FM notify function
4512- * Debug mode: Don't call the FM notify function & use test mode
4513- * implementation.
4514- * If platfom does not have FM then we use test mode implementation.
4515- */
4516-static inline
4517-int32_t iwl_mvm_fm_notify_frequency(bool dbg_mode,
4518- const enum iui_fm_macro_id macro_id,
4519- const struct iui_fm_freq_notification *
4520- const notification)
4521-{
4522-#ifdef CPTCFG_IWLWIFI_FRQ_MGR_TEST
4523- /* Platform does not have a FM or test mode was requested */
4524- if (dbg_mode)
4525- return iwl_mvm_fm_test_notify_frequency(macro_id,
4526- notification);
4527-#endif /* CPTCFG_IWLWIFI_FRQ_MGR_TEST */
4528-
4529-#if defined(CONFIG_IUI_FM) /* Not XMM6312/Sofia-3G - Platform has a FM */
4530- return iui_fm_notify_frequency_lte(macro_id, notification);
4531-#else
4532- return -EPERM; /* fm_debug_mode was not set */
4533-#endif /*CONFIG_IUI_FM */
4534-}
4535-
4536-#endif /* __FM_IUI_H */
4537-
4538diff --git a/include/linux/fm/iui_fm_test.h b/include/linux/fm/iui_fm_test.h
4539deleted file mode 100644
4540index e347a55..0000000
4541--- a/include/linux/fm/iui_fm_test.h
4542+++ /dev/null
4543@@ -1,796 +0,0 @@
4544-/*
4545- * Copyright (C) 2013 Intel Mobile Communications GmbH
4546- *
4547- * This software is licensed under the terms of the GNU General Public
4548- * License version 2, as published by the Free Software Foundation, and
4549- * may be copied, distributed, and modified under those terms.
4550- *
4551- * This program is distributed in the hope that it will be useful,
4552- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4553- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4554- * GNU General Public License for more details.
4555- */
4556-
4557-#ifndef _IUI_FM_H
4558-#define _IUI_FM_H
4559-
4560-/**
4561- * @file iui_fm.h
4562- * @brief The IUI Frequency Manager interface exposes an RPC-compatible
4563- * interface to pass frequency information between macros on the AP and
4564- * the Frequency Manager component on the MEX.
4565- *
4566- * @addtogroup ISPEC_FREQ_MANAGER Frequency manager
4567- * @{
4568- */
4569-
4570-#ifdef __cplusplus
4571-extern "C" {
4572-#endif /* __cplusplus */
4573-
4574-/* Choose whether to use integer types defined in the Linux Kernel (for kernel
4575- builds) or C Library (for Userspace/MEX builds). */
4576-#ifdef __KERNEL__
4577-#include <linux/types.h>
4578-#include <linux/kernel.h>
4579-#define INT32_MAX INT_MAX
4580-#else /* __KERNEL__ */
4581-#include <stdint.h>
4582-#endif /* __KERNEL__ */
4583-
4584-/**
4585- * Zero-based enum of Frequency Manager Macro ID's.
4586- * Identifies a Frequency Manager Macro in the IuiFm API's.
4587- *
4588- * @IUI_FM_MACRO_ID_INVALID: Invalid Macro ID
4589- * @IUI_FM_MACRO_ID_EMMC: SD/eMMC Macro
4590- * @IUI_FM_MACRO_ID_CLASS_D: Class D Amplifier Macro
4591- * @IUI_FM_MACRO_ID_PMU_CP: PMU Charge Pump Macro
4592- * @IUI_FM_MACRO_ID_MS_CP: MS Charge Pump Macro
4593- * @IUI_FM_MACRO_ID_DCDC: DC to DC Converter Macro
4594- * @IUI_FM_MACRO_ID_RESERVED: not in use
4595- * @IUI_FM_MACRO_ID_WLAN: Wireless LAN Macro
4596- * @IUI_FM_MACRO_ID_FMR: FM Radio Macro
4597- * @IUI_FM_MACRO_ID_BT: Bluetooth Macro
4598- * @IUI_FM_MACRO_ID_GNSS: Global Navigation Satellite System
4599- * (GPS/GLONASS) Macro
4600- * @IUI_FM_MACRO_ID_MAX: Number of Macro's defined, used
4601- * internally for range checking
4602- * @IUI_FM_MACRO_ID_FIRST: Point to the first macro ID, used internally
4603- * for iteration and range checking
4604- */
4605-enum iui_fm_macro_id {
4606- IUI_FM_MACRO_ID_INVALID = -1,
4607- IUI_FM_MACRO_ID_EMMC = 0,
4608- IUI_FM_MACRO_ID_CLASS_D = 1,
4609- IUI_FM_MACRO_ID_PMU_CP = 2,
4610- IUI_FM_MACRO_ID_MS_CP = 3,
4611- IUI_FM_MACRO_ID_DCDC = 4,
4612- IUI_FM_MACRO_ID_RESERVED = 5,
4613- IUI_FM_MACRO_ID_WLAN = 6,
4614- IUI_FM_MACRO_ID_FMR = 7,
4615- IUI_FM_MACRO_ID_BT = 8,
4616- IUI_FM_MACRO_ID_GNSS = 9,
4617- IUI_FM_MACRO_ID_MAX = 10,
4618- IUI_FM_MACRO_ID_FIRST = IUI_FM_MACRO_ID_EMMC
4619-};
4620-
4621-/**
4622- * Enum used to indicate the priority of a mitigation request.
4623- *
4624- * @IUI_FM_MITIGATION_PRIORITY_NORMAL: The priority value of a mitigation
4625- * request when not in an emergency call
4626- * or situation.
4627- * @IUI_FM_MITIGATION_PRIORITY_EMERGENCY: Can be used during an emergency call
4628- * to indicate that the mitigation
4629- * request should be applied with more
4630- * haste than usual, even if this causes
4631- * a degredation in currently-running
4632- * processes.
4633- */
4634-enum iui_fm_mitigation_priority {
4635- IUI_FM_MITIGATION_PRIORITY_NORMAL = 0,
4636- IUI_FM_MITIGATION_PRIORITY_EMERGENCY = 1
4637-};
4638-
4639-/**
4640- * Enum used to identify an SD/eMMC device.
4641- *
4642- * @IUI_FM_EMMC_DEVICE_ID_0: SD/eMMC Device 0
4643- * @IUI_FM_EMMC_DEVICE_ID_1: SD/eMMC Device 1
4644- * @IUI_FM_EMMC_DEVICE_ID_2: SD/eMMC Device 2
4645- * @IUI_FM_EMMC_DEVICE_ID_MAX: Number of SD/eMMC Devices Defined, used
4646- * internally for range checking and array sizing
4647- */
4648-enum iui_fm_emmc_device_id {
4649- IUI_FM_EMMC_DEVICE_ID_0 = 0,
4650- IUI_FM_EMMC_DEVICE_ID_1 = 1,
4651- IUI_FM_EMMC_DEVICE_ID_2 = 2,
4652- IUI_FM_EMMC_DEVICE_ID_MAX = 3
4653-};
4654-
4655-/**
4656- * Enum used to indicate from which main clock the operating frequency
4657- * of an SD/eMMC device is derived.
4658- *
4659- * Possible SD/eMMC operating frequencies are derived by dividing the selected
4660- * main clock frequency by powers of 2. The largest possible divisor is that
4661- * which results in the lowest operating frequency greater than 200 KHz. Hence
4662- * the possible operating frequencies are:
4663- *
4664- * Clock Source: 104 MHz:
4665- * 2^0: 104 MHz
4666- * 2^1: 52 MHz
4667- * 2^2: 26 MHz
4668- * 2^3: 13 MHz
4669- * 2^4: 6.5 MHz
4670- * 2^5: 3.25 MHz
4671- * 2^6: 1.625 MHz
4672- * 2^7: 812.5 KHz
4673- * 2^8: 406.25 KHz
4674- * 2^9: 203.125 KHz
4675- *
4676- * Clock Source: 96 MHz:
4677- * 2^0: 96 MHz
4678- * 2^1: 48 MHz
4679- * 2^2: 24 MHz
4680- * 2^3: 12 MHz
4681- * 2^4: 6 MHz
4682- * 2^5: 3 MHz
4683- * 2^6: 1.5 MHz
4684- * 2^7: 750 KHz
4685- * 2^8: 375 KHz
4686- *
4687- * @IUI_FM_EMMC_CLOCK_SRC_104MHZ 104 MHz main clock source for SD/eMMC.
4688- * @IUI_FM_EMMC_CLOCK_SRC_96MHZ 96 MHz main clock source for SD/eMMC.
4689- */
4690-enum iui_fm_emmc_clock_src {
4691- IUI_FM_EMMC_CLOCK_SRC_104MHZ = 0,
4692- IUI_FM_EMMC_CLOCK_SRC_96MHZ = 1
4693-};
4694-
4695-/**
4696- * @brief Bitfield structure of 32-bit width to store the operating frequency
4697- * information for one SD/eMMC device.
4698- *
4699- * @frequency SD/eMMC Operating Frequency in KHz.
4700- * @clk_src SD/eMMC Clock Source. Values in enum iui_fm_emmc_clock_src.
4701- */
4702-struct iui_fm_emmc_freq_bitfield {
4703- uint32_t frequency:28;
4704- uint32_t clk_src:4;
4705-};
4706-
4707-/**
4708- * @brief Contains operating frequency information for all of the SD/eMMC
4709- * devices.
4710- *
4711- * @emmc_frequency Array of frequency information for each EMMC device.
4712- */
4713-struct iui_fm_emmc_freq_info {
4714- struct iui_fm_emmc_freq_bitfield
4715- emmc_frequency[IUI_FM_EMMC_DEVICE_ID_MAX];
4716-};
4717-
4718-/**
4719- * @brief Enum representing the possible channel bandwidths used by the WLAN
4720- * macro.
4721- *
4722- * @IUI_FM_WLAN_BW_INVALID Used if WLAN channel is in disconnected state.
4723- * @IUI_FM_WLAN_BW_20MHZ 20 MHz bandwidth.
4724- * @IUI_FM_WLAN_BW_40MHZ 40 MHz bandwidth (NOT SUPPORTED).
4725- * @IUI_FM_WLAN_BW_80MHZ 80 MHz bandwidth (NOT SUPPORTED).
4726- */
4727-enum iui_fm_wlan_bandwidth {
4728- IUI_FM_WLAN_BW_INVALID = -1,
4729- IUI_FM_WLAN_BW_20MHZ = 0,
4730- IUI_FM_WLAN_BW_40MHZ = 1,
4731- IUI_FM_WLAN_BW_80MHZ = 2,
4732- IUI_FM_WLAN_BW_160MHZ = 3
4733-};
4734-
4735-/**
4736- * Structure used to store the frequency and bandwidth of a WLAN channel.
4737- *
4738- * @frequency Current WLAN channel center frequency in KHz if in
4739- * transfer/receive mode, or an invalid value otherwise.
4740- * Available values: 2412000-2484000, 3657500-3690000,
4741- * 4915000-5825000 (KHz).
4742- * @bandwadth Channel bandwidth enum. Set to IUI_FM_WLAN_BW_INVALID if WLAN
4743- * channel is disconnected.
4744- */
4745-struct iui_fm_wlan_channel_info {
4746- uint32_t frequency;
4747- enum iui_fm_wlan_bandwidth bandwidth;
4748-};
4749-
4750-/**
4751- * Maximum number of channels that can be used by the WLAN macro at a time.
4752- */
4753-#define IUI_FM_WLAN_MAX_CHANNELS 4
4754-#define DCDC_UPDATE 1
4755-#define WLAN_UPDATE 2
4756-#define DCDC_MITI DCDC_UPDATE
4757-#define WLAN_MITI WLAN_UPDATE
4758-
4759-/**
4760- * @brief Structure used for Frequency Notification by the WLAN macro.
4761- *
4762- * @num_channels Number of valid elements in the channel_info array, set to
4763- * the number of channels currently in use by the WLAN macro, or
4764- * 0 if WLAN is not in transfer/receive mode.
4765- * @channel_info Array of WLAN channel information structures. Only the first
4766- * num_channels elements are valid.
4767- * @wlan_adc_dac_freq Current WLAN ADC/DAC frequency in KHz. Available
4768- * values: 0 (parameter not yet supported).
4769- */
4770-struct iui_fm_wlan_info {
4771- uint32_t num_channels;
4772- struct iui_fm_wlan_channel_info channel_info[IUI_FM_WLAN_MAX_CHANNELS];
4773- uint32_t wlan_adc_dac_freq;
4774- uint32_t dcdc_div0;
4775- uint32_t dcdc_div1;
4776- uint32_t bitmask;
4777-};
4778-
4779-/**
4780- * Special value for the max_tx_pwr field of struct
4781- * iui_fm_wlan_channel_tx_power to clear a previously-set TX power limit.
4782- */
4783-#define IUI_FM_WLAN_NO_TX_PWR_LIMIT INT32_MAX
4784-
4785-/**
4786- * @brief Structure to store the maximum allowed transmit power for one WLAN
4787- * channel.
4788- *
4789- * @frequency WLAN Channel Frequency in KHz.
4790- * @max_tx_pwr Maximum allowed transmit power for the given channel frequency
4791- * in dBm within the range 0 to +30, or
4792- * IUI_FM_WLAN_NO_TX_PWR_LIMIT to cancel a previously-set transmit
4793- * power limit.
4794- */
4795-struct iui_fm_wlan_channel_tx_power {
4796- uint32_t frequency;
4797- int32_t max_tx_pwr;
4798-};
4799-
4800-/**
4801- * @brief Enum defining mitigation actions for WLAN macro to implement for the
4802- * WLAN RX Gain Stage behavior.
4803- *
4804- * @IUI_FM_WLAN_RX_GAIN_NORMAL RX Gain Stage should behave as
4805- * normal with no reduction in gain.
4806- * @IUI_FM_WLAN_RX_GAIN_REDUCE_AUTO RX Gain should be reduced by an
4807- * unspecified amount. The WLAN macro
4808- * is to determine the appropriate gain
4809- * reduction amount internally.
4810- * @IUI_FM_WLAN_RX_GAIN_REDUCE_SPECIFIED RX Gain should be reduced by the
4811- * specified amount (NOT SUPPORTED).
4812- */
4813-enum iui_fm_wlan_rx_gain_behavior {
4814- IUI_FM_WLAN_RX_GAIN_NORMAL = 0,
4815- IUI_FM_WLAN_RX_GAIN_REDUCE_AUTO = 1
4816-/* IUI_FM_WLAN_RX_GAIN_REDUCE_SPECIFIED = 2 */
4817-};
4818-
4819-/**
4820- * @brief Mitigation information structure for the WLAN macro.
4821- *
4822- * @num_channels Number of valid elements in the channel_tx_pwr array,
4823- * set to the number of channels for which the maximum
4824- * allowed transmit power is being set.
4825- * @channel_tx_pwr Array of maximum allowed transmit power for zero or more
4826- * WLAN channels. Only the first num_channels elements are
4827- * valid.
4828- * @wlan_adc_dac_freq Requested WLAN ADC/DAC frequency in KHz. Available
4829- * values: 0 (parameter not yet supported).
4830- * @rx_gain_behavior Indicates the requested behavior of the WLAN RX Gain
4831- * Stage (NOT SUPPORTED).
4832- * @rx_gain_reduction Amount by which to reduce the WLAN RX Gain (in dB) if
4833- * the rx_gain_bahavior field is set to
4834- * IUI_FM_WLAN_RX_GAIN_REDUCE_SPECIFIED (NOT SUPPORTED).
4835- */
4836-struct iui_fm_wlan_mitigation {
4837- uint32_t num_channels;
4838- struct iui_fm_wlan_channel_tx_power
4839- channel_tx_pwr[IUI_FM_WLAN_MAX_CHANNELS];
4840- uint32_t wlan_adc_dac_freq;
4841- enum iui_fm_wlan_rx_gain_behavior rx_gain_behavior;
4842-/* uint32_t rx_gain_reduction; */
4843- uint32_t wlan_2g_coex_enable;
4844- uint32_t dcdc_div0;
4845- uint32_t dcdc_div1;
4846- uint32_t bitmask;
4847-};
4848-
4849-/**
4850- * @brief Enum representing the injection side indicated by the FM Radio
4851- * macro.
4852- *
4853- * @IUI_FM_FMR_INJECTION_SIDE_LOW FM Radio Low Side Injection.
4854- * @IUI_FM_FMR_INJECTION_SIDE_HIGH FM Radio High Side Injection.
4855- */
4856-enum iui_fm_fmr_injection_side {
4857- IUI_FM_FMR_INJECTION_SIDE_LOW = 0,
4858- IUI_FM_FMR_INJECTION_SIDE_HIGH = 1
4859-};
4860-
4861-/**
4862- * @brief Structure containing the operating information for the FM Radio
4863- * macro.
4864- *
4865- * @rx_freq Tuned frequency in KHz, or 0 if FM Radio is not in use.
4866- * @inj_side Injection Side currently in use.
4867- */
4868-struct iui_fm_fmr_info {
4869- uint32_t rx_freq;
4870- enum iui_fm_fmr_injection_side inj_side;
4871-};
4872-
4873-/**
4874- * @brief Indicates the status of the Bluetooth module.
4875- *
4876- * @IUI_FM_BT_STATE_OFF Bluetooth module is turned off.
4877- * @IUI_FM_BT_STATE_ON Bluetooth module is turned on.
4878- */
4879-enum iui_fm_bt_state {
4880- IUI_FM_BT_STATE_OFF = 0, /**< Bluetooth module is turned off. */
4881- IUI_FM_BT_STATE_ON = 1 /**< Bluetooth module is turned on. */
4882-};
4883-
4884-/**
4885- * @brief Structure containing the operating information for the Bluetooth
4886- * macro.
4887- *
4888- * Passed by the Bluetooth macro to Frequency Manager as a Frequency
4889- * Notification.
4890- *
4891- * @bt_state Current state of the Bluetooth macro.
4892- */
4893-struct iui_fm_bt_info {
4894- enum iui_fm_bt_state bt_state;
4895-};
4896-
4897-/**
4898- * @brief Define the number of Bluetooth hopping channels available.
4899- */
4900-#define IUI_FM_BT_NUM_CHANNELS 79
4901-
4902-/**
4903- * @brief Number of bits in one word of the Bluetooth Channel Mask.
4904- */
4905-#define IUI_FM_BT_CHANNEL_MASK_WORD_BITS 32
4906-
4907-/**
4908- * @brief Number of words needed to contain the full Bluetooth Channel
4909- * Bitmask.
4910- *
4911- * For 79 hopping channels, 3 32-bit words are needed.
4912- */
4913-#define IUI_FM_BT_CHANNEL_MASK_WORDS 3
4914-
4915-/**
4916- * @brief Bitfield structure representing a hopping channel mask for the
4917- * Bluetooth Macro.
4918- *
4919- * A set bit indicates a Bluetooth hopping frequency that should be avoided in
4920- * order to mitigate crosstalk with another macro.
4921- *
4922- * @bt_ch_mask Array of words containing the Bluetooth Channel Mask. Each bit
4923- * represents one Bluetooth hopping frequency, with the least of
4924- * the first word representing the lowest frequency Bluetooth
4925- * Hopping Frequency. If the number of hopping frequencies
4926- * available is not a multiple of the word width (in bits), then
4927- * the remaining unused bits in the last word are ignored. If a
4928- * bit is set, the Bluetooth Hopping Frequency corresponding to
4929- * that bit should be avoided by the Bluetooth Macro in order to
4930- * avoid crosstalk with another macro.
4931- */
4932-struct iui_fm_bt_channel_mask {
4933- uint32_t bt_ch_mask[IUI_FM_BT_CHANNEL_MASK_WORDS];
4934-};
4935-
4936-/**
4937- * @brief GNSS Macro State enum indicating which (if any) of the GNSS
4938- * technologies are being used.
4939- *
4940- * @IUI_FM_GNSS_STATE_OFF GNSS macro is switched off.
4941- * @IUI_FM_GNSS_STATE_GPS_ACTIVE GNSS macro is on and in GPS mode.
4942- * @IUI_FM_GNSS_STATE_GLONASS_ACTIVE GNSS macro is on and in GLONASS
4943- * mode.
4944- * @IUI_FM_GNSS_STATE_GPS_GLONASS_ACTIVE GNSS macro is on and in GPS+GLONASS
4945- * mode.
4946- */
4947-enum iui_fm_gnss_state {
4948- IUI_FM_GNSS_STATE_OFF = 0,
4949- IUI_FM_GNSS_STATE_GPS_ACTIVE = 1,
4950- IUI_FM_GNSS_STATE_GLONASS_ACTIVE = 2,
4951- IUI_FM_GNSS_STATE_GPS_GLONASS_ACTIVE = 3
4952-};
4953-
4954-/**
4955- * @brief GNSS Frequency Information structure passed from GNSS macro to the FM
4956- * module during a Frequency Indication.
4957- *
4958- * @state State of the GNSS module.
4959- * @snr Current RX signal to noise ratio for the active GNSS
4960- * technology (GPS or GLONASS), or the stronger of the two if
4961- * both GPS and GLONASS are active. Valid range: 0..55 dB, or
4962- * -1 if not available.
4963- * @bus_frequency Bus Frequency used by the GNSS module in KHz, or 0 if GNSS
4964- * is inactive/off. Available frequencies:
4965- * 78000 KHz (currently not supported)
4966- * 83200 KHz
4967- * 96000 KHz
4968- * @pll_frequency Current operating frequency of the GNSS PLL in KHz, or 0
4969- * if the GNSS PLL is disabled. Available frequencies:
4970- * 124800 KHz
4971- * 104000 KHz
4972- * 96000 KHz
4973- * 89000 KHz(currently not supported)
4974- * @adc_frequency Current operating frequency of the GNSS ADC output clock
4975- * in KHz, or 0 if the GNSS ADC is disabled. Available
4976- * frequencies:
4977- * 44131 KHz
4978- * 52957 KHz
4979- * 66196 KHz
4980- */
4981-struct iui_fm_gnss_info {
4982- enum iui_fm_gnss_state state;
4983- int32_t snr;
4984- uint32_t bus_frequency;
4985- uint32_t pll_frequency;
4986- uint32_t adc_frequency;
4987-};
4988-
4989-/**
4990- * @brief Mitigation information structure for the GNSS macro.
4991- *
4992- * @priority Indicates whether the ongoing processing of a previous
4993- * mitigation request should be interrupted to fulfil this new
4994- * request. Based on whether the phone is currently in an
4995- * emergency call or other situation.
4996- * @bus_frequency Requested GNSS bus clock frequency in KHz, or 0 if the
4997- * GNSS bus is disabled. Available frequencies:
4998- * 78000 KHz (currently not supported)
4999- * 83200 KHz
5000- * 96000 KHz
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches