blob: 9d87fddd29b6d8d72254e76783ac45b17d358e79 [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +02008 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8b4139d2014-07-24 14:05:26 +02009 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +020010 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010011 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020027 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010028 *
29 * Contact Information:
Emmanuel Grumbachd01c5362015-11-17 15:39:56 +020030 * Intel Linux Wireless <linuxwifi@intel.com>
Johannes Berg8ca151b2013-01-24 14:25:36 +010031 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020035 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8b4139d2014-07-24 14:05:26 +020036 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +020037 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
Johannes Berg8ca151b2013-01-24 14:25:36 +010038 * All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 *****************************************************************************/
67
68#ifndef __fw_api_power_h__
69#define __fw_api_power_h__
70
71/* Power Management Commands, Responses, Notifications */
72
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +030073/**
74 * enum iwl_ltr_config_flags - masks for LTR config command flags
75 * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
76 * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
77 * memory access
78 * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
79 * reg change
80 * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
81 * D0 to D3
82 * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
83 * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
84 * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
Johannes Berg3a07d362017-03-15 10:18:20 +010085 * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
86 * idle timeout
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +030087 */
88enum iwl_ltr_config_flags {
89 LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
90 LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
91 LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
92 LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
93 LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
94 LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
95 LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
Johannes Berg3a07d362017-03-15 10:18:20 +010096 LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +030097};
98
99/**
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +0200100 * struct iwl_ltr_config_cmd_v1 - configures the LTR
Johannes Berg69d22e72017-03-15 10:02:23 +0100101 * @flags: See &enum iwl_ltr_config_flags
Johannes Berg3a07d362017-03-15 10:18:20 +0100102 * @static_long: static LTR Long register value.
103 * @static_short: static LTR Short register value.
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +0200104 */
105struct iwl_ltr_config_cmd_v1 {
106 __le32 flags;
107 __le32 static_long;
108 __le32 static_short;
109} __packed; /* LTR_CAPABLE_API_S_VER_1 */
110
111#define LTR_VALID_STATES_NUM 4
112
113/**
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +0300114 * struct iwl_ltr_config_cmd - configures the LTR
Johannes Berg69d22e72017-03-15 10:02:23 +0100115 * @flags: See &enum iwl_ltr_config_flags
Johannes Berg3a07d362017-03-15 10:18:20 +0100116 * @static_long: static LTR Long register value.
117 * @static_short: static LTR Short register value.
118 * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
119 * TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
120 * is set.
121 * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
122 * %LTR_CFG_FLAG_UPDATE_VALUES is set.
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +0300123 */
124struct iwl_ltr_config_cmd {
125 __le32 flags;
126 __le32 static_long;
127 __le32 static_short;
Emmanuel Grumbach84bfffa2015-01-13 10:16:30 +0200128 __le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
129 __le32 ltr_short_idle_timeout;
130} __packed; /* LTR_CAPABLE_API_S_VER_2 */
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +0300131
Alexander Bondarbd4ace22013-03-21 17:14:14 +0200132/* Radio LP RX Energy Threshold measured in dBm */
133#define POWER_LPRX_RSSI_THRESHOLD 75
134#define POWER_LPRX_RSSI_THRESHOLD_MAX 94
135#define POWER_LPRX_RSSI_THRESHOLD_MIN 30
136
Johannes Berg8ca151b2013-01-24 14:25:36 +0100137/**
Emmanuel Grumbach9180ac52014-09-23 23:02:41 +0300138 * enum iwl_power_flags - masks for power table command flags
Alexander Bondar83bdad52013-02-03 21:26:44 +0200139 * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
140 * receiver and transmitter. '0' - does not allow.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100141 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
142 * '1' Driver enables PM (use rest of parameters)
Alexander Bondarf4a3e2f2013-03-05 13:47:04 +0200143 * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100144 * '1' PM could sleep over DTIM till listen Interval.
Alexander Bondare811ada2013-03-10 15:29:44 +0200145 * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
146 * access categories are both delivery and trigger enabled.
147 * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
148 * PBW Snoozing enabled
Johannes Berg8ca151b2013-01-24 14:25:36 +0100149 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
Alexander Bondar83bdad52013-02-03 21:26:44 +0200150 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
Johannes Berg3a07d362017-03-15 10:18:20 +0100151 * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
Alexander Bondar175a70b2013-04-14 20:59:37 +0300152 * detection enablement
Johannes Berg8ca151b2013-01-24 14:25:36 +0100153*/
154enum iwl_power_flags {
Alexander Bondar83bdad52013-02-03 21:26:44 +0200155 POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
156 POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1),
Alexander Bondarf4a3e2f2013-03-05 13:47:04 +0200157 POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2),
Alexander Bondare811ada2013-03-10 15:29:44 +0200158 POWER_FLAGS_SNOOZE_ENA_MSK = BIT(5),
159 POWER_FLAGS_BT_SCO_ENA = BIT(8),
Alexander Bondar83bdad52013-02-03 21:26:44 +0200160 POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9),
161 POWER_FLAGS_LPRX_ENA_MSK = BIT(11),
Alexander Bondar175a70b2013-04-14 20:59:37 +0300162 POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK = BIT(12),
Johannes Berg8ca151b2013-01-24 14:25:36 +0100163};
164
Alexander Bondar83bdad52013-02-03 21:26:44 +0200165#define IWL_POWER_VEC_SIZE 5
166
Johannes Berg8ca151b2013-01-24 14:25:36 +0100167/**
Alexander Bondare811ada2013-03-10 15:29:44 +0200168 * struct iwl_powertable_cmd - legacy power command. Beside old API support this
169 * is used also with a new power API for device wide power settings.
Johannes Berg8ca151b2013-01-24 14:25:36 +0100170 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
171 *
Johannes Berg8ca151b2013-01-24 14:25:36 +0100172 * @flags: Power table command flags from POWER_FLAGS_*
173 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
Alexander Bondare16cf7e2013-03-05 14:01:27 +0200174 * Minimum allowed:- 3 * DTIM. Keep alive period must be
175 * set regardless of power scheme or current power state.
176 * FW use this value also when PM is disabled.
Johannes Berg3a07d362017-03-15 10:18:20 +0100177 * @debug_flags: debug flags
Johannes Berg8ca151b2013-01-24 14:25:36 +0100178 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
179 * PSM transition - legacy PM
180 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
181 * PSM transition - legacy PM
Alexander Bondar83bdad52013-02-03 21:26:44 +0200182 * @sleep_interval: not in use
Alexander Bondar1bd2d172013-05-21 14:49:09 +0300183 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
184 * is set. For example, if it is required to skip over
185 * one DTIM, this value need to be set to 2 (DTIM periods).
Johannes Berg8ca151b2013-01-24 14:25:36 +0100186 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
187 * Default: 80dbm
Johannes Berg8ca151b2013-01-24 14:25:36 +0100188 */
189struct iwl_powertable_cmd {
Alexander Bondar5b1dbfc2013-04-23 13:32:35 +0300190 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100191 __le16 flags;
Alexander Bondar83bdad52013-02-03 21:26:44 +0200192 u8 keep_alive_seconds;
193 u8 debug_flags;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100194 __le32 rx_data_timeout;
195 __le32 tx_data_timeout;
Alexander Bondar83bdad52013-02-03 21:26:44 +0200196 __le32 sleep_interval[IWL_POWER_VEC_SIZE];
Alexander Bondar1bd2d172013-05-21 14:49:09 +0300197 __le32 skip_dtim_periods;
Alexander Bondar83bdad52013-02-03 21:26:44 +0200198 __le32 lprx_rssi_threshold;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100199} __packed;
200
Hila Gonen7df15b12012-12-12 11:16:19 +0200201/**
Alexander Bondar64b928c2013-09-03 14:18:03 +0300202 * enum iwl_device_power_flags - masks for device power command flags
Johannes Berg3a07d362017-03-15 10:18:20 +0100203 * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
204 * '1' Allow to save power by turning off
Johannes Bergceef91c2015-09-04 11:27:25 +0200205 * receiver and transmitter. '0' - does not allow.
Alexander Bondar64b928c2013-09-03 14:18:03 +0300206*/
207enum iwl_device_power_flags {
208 DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0),
Alexander Bondar64b928c2013-09-03 14:18:03 +0300209};
210
211/**
212 * struct iwl_device_power_cmd - device wide power command.
213 * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
214 *
Johannes Berg67625862017-03-14 11:01:27 +0100215 * @flags: Power table command flags from &enum iwl_device_power_flags
Johannes Berg3a07d362017-03-15 10:18:20 +0100216 * @reserved: reserved (padding)
Alexander Bondar64b928c2013-09-03 14:18:03 +0300217 */
218struct iwl_device_power_cmd {
219 /* PM_POWER_TABLE_CMD_API_S_VER_6 */
220 __le16 flags;
221 __le16 reserved;
222} __packed;
223
224/**
Alexander Bondare811ada2013-03-10 15:29:44 +0200225 * struct iwl_mac_power_cmd - New power command containing uAPSD support
226 * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
Johannes Berg67625862017-03-14 11:01:27 +0100227 * @id_and_color: MAC contex identifier, &enum iwl_mvm_id_and_color
Alexander Bondare811ada2013-03-10 15:29:44 +0200228 * @flags: Power table command flags from POWER_FLAGS_*
229 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
230 * Minimum allowed:- 3 * DTIM. Keep alive period must be
231 * set regardless of power scheme or current power state.
232 * FW use this value also when PM is disabled.
233 * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to
234 * PSM transition - legacy PM
235 * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to
236 * PSM transition - legacy PM
Alexander Bondare811ada2013-03-10 15:29:44 +0200237 * @skip_dtim_periods: Number of DTIM periods to skip if Skip over DTIM flag
238 * is set. For example, if it is required to skip over
239 * one DTIM, this value need to be set to 2 (DTIM periods).
240 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
241 * PSM transition - uAPSD
242 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
243 * PSM transition - uAPSD
244 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
245 * Default: 80dbm
Alexander Bondar89716342013-08-04 17:52:23 +0300246 * @snooze_interval: Maximum time between attempts to retrieve buffered data
247 * from the AP [msec]
248 * @snooze_window: A window of time in which PBW snoozing insures that all
249 * packets received. It is also the minimum time from last
250 * received unicast RX packet, before client stops snoozing
251 * for data. [msec]
Alexander Bondare811ada2013-03-10 15:29:44 +0200252 * @snooze_step: TBD
253 * @qndp_tid: TID client shall use for uAPSD QNDP triggers
254 * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
255 * each corresponding AC.
256 * Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
257 * @uapsd_max_sp: Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
258 * values.
Alexander Bondare3c588e2013-04-07 14:08:59 +0300259 * @heavy_tx_thld_packets: TX threshold measured in number of packets
260 * @heavy_rx_thld_packets: RX threshold measured in number of packets
261 * @heavy_tx_thld_percentage: TX threshold measured in load's percentage
262 * @heavy_rx_thld_percentage: RX threshold measured in load's percentage
Johannes Berg3a07d362017-03-15 10:18:20 +0100263 * @limited_ps_threshold: (unused)
264 * @reserved: reserved (padding)
265 */
Alexander Bondare811ada2013-03-10 15:29:44 +0200266struct iwl_mac_power_cmd {
267 /* CONTEXT_DESC_API_T_VER_1 */
268 __le32 id_and_color;
269
270 /* CLIENT_PM_POWER_TABLE_S_VER_1 */
271 __le16 flags;
272 __le16 keep_alive_seconds;
273 __le32 rx_data_timeout;
274 __le32 tx_data_timeout;
275 __le32 rx_data_timeout_uapsd;
276 __le32 tx_data_timeout_uapsd;
277 u8 lprx_rssi_threshold;
278 u8 skip_dtim_periods;
279 __le16 snooze_interval;
280 __le16 snooze_window;
281 u8 snooze_step;
282 u8 qndp_tid;
283 u8 uapsd_ac_flags;
284 u8 uapsd_max_sp;
Alexander Bondare3c588e2013-04-07 14:08:59 +0300285 u8 heavy_tx_thld_packets;
286 u8 heavy_rx_thld_packets;
287 u8 heavy_tx_thld_percentage;
288 u8 heavy_rx_thld_percentage;
Alexander Bondare811ada2013-03-10 15:29:44 +0200289 u8 limited_ps_threshold;
290 u8 reserved;
291} __packed;
292
Alexander Bondar175a70b2013-04-14 20:59:37 +0300293/*
294 * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
295 * associated AP is identified as improperly implementing uAPSD protocol.
296 * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
297 * @sta_id: index of station in uCode's station table - associated AP ID in
298 * this context.
299 */
300struct iwl_uapsd_misbehaving_ap_notif {
301 __le32 sta_id;
302 u8 mac_id;
303 u8 reserved[3];
304} __packed;
305
Alexander Bondare811ada2013-03-10 15:29:44 +0200306/**
Avri Altmand44c3fe2015-04-18 22:16:42 +0300307 * struct iwl_reduce_tx_power_cmd - TX power reduction command
308 * REDUCE_TX_POWER_CMD = 0x9f
309 * @flags: (reserved for future implementation)
310 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
311 * @pwr_restriction: TX power restriction in dBms.
312 */
313struct iwl_reduce_tx_power_cmd {
314 u8 flags;
315 u8 mac_context_id;
316 __le16 pwr_restriction;
317} __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
318
Johannes Bergda03f022015-08-18 15:15:36 +0200319enum iwl_dev_tx_power_cmd_mode {
320 IWL_TX_POWER_MODE_SET_MAC = 0,
321 IWL_TX_POWER_MODE_SET_DEVICE = 1,
322 IWL_TX_POWER_MODE_SET_CHAINS = 2,
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300323 IWL_TX_POWER_MODE_SET_ACK = 3,
324}; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */;
Johannes Bergda03f022015-08-18 15:15:36 +0200325
Luca Coelho4b87e5a2016-09-12 16:03:30 +0300326#define IWL_NUM_CHAIN_LIMITS 2
327#define IWL_NUM_SUB_BANDS 5
328
Avri Altmand44c3fe2015-04-18 22:16:42 +0300329/**
Luca Coelho4b87e5a2016-09-12 16:03:30 +0300330 * struct iwl_dev_tx_power_cmd - TX power reduction command
Johannes Bergda03f022015-08-18 15:15:36 +0200331 * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
Avri Altmand44c3fe2015-04-18 22:16:42 +0300332 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
333 * @pwr_restriction: TX power restriction in 1/8 dBms.
334 * @dev_24: device TX power restriction in 1/8 dBms
335 * @dev_52_low: device TX power restriction upper band - low
336 * @dev_52_high: device TX power restriction upper band - high
Luca Coelho4b87e5a2016-09-12 16:03:30 +0300337 * @per_chain_restriction: per chain restrictions
Avri Altmand44c3fe2015-04-18 22:16:42 +0300338 */
Luca Coelho4b87e5a2016-09-12 16:03:30 +0300339struct iwl_dev_tx_power_cmd_v3 {
Avri Altmand44c3fe2015-04-18 22:16:42 +0300340 __le32 set_mode;
341 __le32 mac_context_id;
342 __le16 pwr_restriction;
343 __le16 dev_24;
344 __le16 dev_52_low;
345 __le16 dev_52_high;
Johannes Bergda03f022015-08-18 15:15:36 +0200346 __le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
347} __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
348
Avri Altmand44c3fe2015-04-18 22:16:42 +0300349#define IWL_DEV_MAX_TX_POWER 0x7FFF
350
351/**
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300352 * struct iwl_dev_tx_power_cmd - TX power reduction command
353 * @v3: version 3 of the command, embedded here for easier software handling
354 * @enable_ack_reduction: enable or disable close range ack TX power
355 * reduction.
Johannes Berg3a07d362017-03-15 10:18:20 +0100356 * @reserved: reserved (padding)
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300357 */
358struct iwl_dev_tx_power_cmd {
359 /* v4 is just an extension of v3 - keep this here */
360 struct iwl_dev_tx_power_cmd_v3 v3;
361 u8 enable_ack_reduction;
362 u8 reserved[3];
363} __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
364
Haim Dreyfussa6bff3c2017-01-19 12:00:46 +0200365#define IWL_NUM_GEO_PROFILES 3
366
367/**
368 * enum iwl_geo_per_chain_offset_operation - type of operation
369 * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
370 * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
371 */
372enum iwl_geo_per_chain_offset_operation {
373 IWL_PER_CHAIN_OFFSET_SET_TABLES,
374 IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
375}; /* GEO_TX_POWER_LIMIT FLAGS TYPE */
376
377/**
378 * struct iwl_per_chain_offset - embedded struct for GEO_TX_POWER_LIMIT.
379 * @max_tx_power: maximum allowed tx power.
380 * @chain_a: tx power offset for chain a.
381 * @chain_b: tx power offset for chain b.
382 */
383struct iwl_per_chain_offset {
384 __le16 max_tx_power;
385 u8 chain_a;
386 u8 chain_b;
387} __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
388
389struct iwl_per_chain_offset_group {
390 struct iwl_per_chain_offset lb;
391 struct iwl_per_chain_offset hb;
392} __packed; /* PER_CHAIN_LIMIT_OFFSET_GROUP_S_VER_1 */
393
394/**
395 * struct iwl_geo_tx_power_profile_cmd - struct for GEO_TX_POWER_LIMIT cmd.
396 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
397 * @table: offset profile per band.
398 */
399struct iwl_geo_tx_power_profiles_cmd {
400 __le32 ops;
401 struct iwl_per_chain_offset_group table[IWL_NUM_GEO_PROFILES];
402} __packed; /* GEO_TX_POWER_LIMIT */
403
Luca Coelho55bfa4b2016-06-29 00:38:40 +0300404/**
Hila Gonen7df15b12012-12-12 11:16:19 +0200405 * struct iwl_beacon_filter_cmd
406 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
Hila Gonen7df15b12012-12-12 11:16:19 +0200407 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
408 * to driver if delta in Energy values calculated for this and last
409 * passed beacon is greater than this threshold. Zero value means that
410 * the Energy change is ignored for beacon filtering, and beacon will
411 * not be forced to be sent to driver regardless of this delta. Typical
412 * energy delta 5dB.
413 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
414 * Send beacon to driver if delta in Energy values calculated for this
415 * and last passed beacon is greater than this threshold. Zero value
416 * means that the Energy change is ignored for beacon filtering while in
417 * Roaming state, typical energy delta 1dB.
418 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
419 * calculated for current beacon is less than the threshold, use
420 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta
421 * Threshold. Typical energy threshold is -72dBm.
Hila Gonen5dca7c22013-07-16 11:15:35 +0300422 * @bf_temp_threshold: This threshold determines the type of temperature
423 * filtering (Slow or Fast) that is selected (Units are in Celsuis):
Johannes Berg31a658b2017-03-09 15:56:57 +0100424 * If the current temperature is above this threshold - Fast filter
Hila Gonen5dca7c22013-07-16 11:15:35 +0300425 * will be used, If the current temperature is below this threshold -
426 * Slow filter will be used.
427 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
428 * calculated for this and the last passed beacon is greater than this
429 * threshold. Zero value means that the temperature change is ignored for
Hila Gonen7df15b12012-12-12 11:16:19 +0200430 * beacon filtering; beacons will not be forced to be sent to driver
431 * regardless of whether its temerature has been changed.
Hila Gonen5dca7c22013-07-16 11:15:35 +0300432 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
433 * calculated for this and the last passed beacon is greater than this
434 * threshold. Zero value means that the temperature change is ignored for
435 * beacon filtering; beacons will not be forced to be sent to driver
436 * regardless of whether its temerature has been changed.
Hila Gonen7df15b12012-12-12 11:16:19 +0200437 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
Johannes Berg3a07d362017-03-15 10:18:20 +0100438 * @bf_debug_flag: beacon filtering debug configuration
439 * @bf_escape_timer: Send beacons to to driver if no beacons were passed
Hila Gonen7df15b12012-12-12 11:16:19 +0200440 * for a specific period of time. Units: Beacons.
441 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
442 * for a longer period of time then this escape-timeout. Units: Beacons.
443 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
444 */
445struct iwl_beacon_filter_cmd {
Hila Gonen5dca7c22013-07-16 11:15:35 +0300446 __le32 bf_energy_delta;
447 __le32 bf_roaming_energy_delta;
448 __le32 bf_roaming_state;
449 __le32 bf_temp_threshold;
450 __le32 bf_temp_fast_filter;
451 __le32 bf_temp_slow_filter;
452 __le32 bf_enable_beacon_filter;
453 __le32 bf_debug_flag;
Hila Gonen7df15b12012-12-12 11:16:19 +0200454 __le32 bf_escape_timer;
455 __le32 ba_escape_timer;
Hila Gonen5dca7c22013-07-16 11:15:35 +0300456 __le32 ba_enable_beacon_abort;
Hila Gonen7df15b12012-12-12 11:16:19 +0200457} __packed;
458
459/* Beacon filtering and beacon abort */
460#define IWL_BF_ENERGY_DELTA_DEFAULT 5
Eliad Peller3dd37d02014-01-07 14:00:24 +0200461#define IWL_BF_ENERGY_DELTA_D0I3 20
Hila Gonen7df15b12012-12-12 11:16:19 +0200462#define IWL_BF_ENERGY_DELTA_MAX 255
463#define IWL_BF_ENERGY_DELTA_MIN 0
464
465#define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
Eliad Peller3dd37d02014-01-07 14:00:24 +0200466#define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
Hila Gonen7df15b12012-12-12 11:16:19 +0200467#define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
468#define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
469
470#define IWL_BF_ROAMING_STATE_DEFAULT 72
Eliad Peller3dd37d02014-01-07 14:00:24 +0200471#define IWL_BF_ROAMING_STATE_D0I3 72
Hila Gonen7df15b12012-12-12 11:16:19 +0200472#define IWL_BF_ROAMING_STATE_MAX 255
473#define IWL_BF_ROAMING_STATE_MIN 0
474
Hila Gonen5dca7c22013-07-16 11:15:35 +0300475#define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
Eliad Peller3dd37d02014-01-07 14:00:24 +0200476#define IWL_BF_TEMP_THRESHOLD_D0I3 112
Hila Gonen5dca7c22013-07-16 11:15:35 +0300477#define IWL_BF_TEMP_THRESHOLD_MAX 255
478#define IWL_BF_TEMP_THRESHOLD_MIN 0
479
480#define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
Eliad Peller3dd37d02014-01-07 14:00:24 +0200481#define IWL_BF_TEMP_FAST_FILTER_D0I3 1
Hila Gonen5dca7c22013-07-16 11:15:35 +0300482#define IWL_BF_TEMP_FAST_FILTER_MAX 255
483#define IWL_BF_TEMP_FAST_FILTER_MIN 0
484
485#define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
Gregory Greenmanf739c392015-07-22 15:46:37 +0300486#define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
Hila Gonen5dca7c22013-07-16 11:15:35 +0300487#define IWL_BF_TEMP_SLOW_FILTER_MAX 255
488#define IWL_BF_TEMP_SLOW_FILTER_MIN 0
Hila Gonen7df15b12012-12-12 11:16:19 +0200489
490#define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
491
492#define IWL_BF_DEBUG_FLAG_DEFAULT 0
Eliad Peller3dd37d02014-01-07 14:00:24 +0200493#define IWL_BF_DEBUG_FLAG_D0I3 0
Hila Gonen7df15b12012-12-12 11:16:19 +0200494
Eliad Pellerfb68e1a2014-11-19 13:57:52 +0200495#define IWL_BF_ESCAPE_TIMER_DEFAULT 0
Eliad Peller50675362014-06-15 11:12:38 +0300496#define IWL_BF_ESCAPE_TIMER_D0I3 0
Hila Gonen7df15b12012-12-12 11:16:19 +0200497#define IWL_BF_ESCAPE_TIMER_MAX 1024
498#define IWL_BF_ESCAPE_TIMER_MIN 0
499
Alexander Bondar84349252013-07-22 15:39:26 +0300500#define IWL_BA_ESCAPE_TIMER_DEFAULT 6
Eliad Peller3dd37d02014-01-07 14:00:24 +0200501#define IWL_BA_ESCAPE_TIMER_D0I3 6
Alexander Bondarb34b9122013-08-18 16:22:52 +0300502#define IWL_BA_ESCAPE_TIMER_D3 9
Hila Gonen7df15b12012-12-12 11:16:19 +0200503#define IWL_BA_ESCAPE_TIMER_MAX 1024
504#define IWL_BA_ESCAPE_TIMER_MIN 0
505
506#define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
507
Eliad Peller3dd37d02014-01-07 14:00:24 +0200508#define IWL_BF_CMD_CONFIG(mode) \
509 .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode), \
510 .bf_roaming_energy_delta = \
511 cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode), \
512 .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode), \
513 .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode), \
514 .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode), \
515 .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode), \
516 .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode), \
517 .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode), \
518 .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
Alexander Bondar071d49902013-05-06 13:03:59 +0300519
Eliad Peller3dd37d02014-01-07 14:00:24 +0200520#define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
521#define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100522#endif