1 /******************************************************************************
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  *
8  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11  * Copyright (C) 2018 Intel Corporation
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of version 2 of the GNU General Public License as
15  * published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * General Public License for more details.
21  *
22  * The full GNU General Public License is included in this distribution
23  * in the file called COPYING.
24  *
25  * Contact Information:
26  *  Intel Linux Wireless <linuxwifi@intel.com>
27  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28  *
29  * BSD LICENSE
30  *
31  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34  * Copyright (C) 2018 Intel Corporation
35  * All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  *
41  *  * Redistributions of source code must retain the above copyright
42  *    notice, this list of conditions and the following disclaimer.
43  *  * Redistributions in binary form must reproduce the above copyright
44  *    notice, this list of conditions and the following disclaimer in
45  *    the documentation and/or other materials provided with the
46  *    distribution.
47  *  * Neither the name Intel Corporation nor the names of its
48  *    contributors may be used to endorse or promote products derived
49  *    from this software without specific prior written permission.
50  *
51  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62  *
63  *****************************************************************************/
64 
65 #ifndef __iwl_fw_api_power_h__
66 #define __iwl_fw_api_power_h__
67 
68 /* Power Management Commands, Responses, Notifications */
69 
70 /**
71  * enum iwl_ltr_config_flags - masks for LTR config command flags
72  * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
73  * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
74  *	memory access
75  * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
76  *	reg change
77  * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
78  *	D0 to D3
79  * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
80  * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
81  * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
82  * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
83  *	idle timeout
84  */
85 enum iwl_ltr_config_flags {
86 	LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
87 	LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
88 	LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
89 	LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
90 	LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
91 	LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
92 	LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
93 	LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
94 };
95 
96 /**
97  * struct iwl_ltr_config_cmd_v1 - configures the LTR
98  * @flags: See &enum iwl_ltr_config_flags
99  * @static_long: static LTR Long register value.
100  * @static_short: static LTR Short register value.
101  */
102 struct iwl_ltr_config_cmd_v1 {
103 	__le32 flags;
104 	__le32 static_long;
105 	__le32 static_short;
106 } __packed; /* LTR_CAPABLE_API_S_VER_1 */
107 
108 #define LTR_VALID_STATES_NUM 4
109 
110 /**
111  * struct iwl_ltr_config_cmd - configures the LTR
112  * @flags: See &enum iwl_ltr_config_flags
113  * @static_long: static LTR Long register value.
114  * @static_short: static LTR Short register value.
115  * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
116  *	TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
117  *	is set.
118  * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
119  *	%LTR_CFG_FLAG_UPDATE_VALUES is set.
120  */
121 struct iwl_ltr_config_cmd {
122 	__le32 flags;
123 	__le32 static_long;
124 	__le32 static_short;
125 	__le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
126 	__le32 ltr_short_idle_timeout;
127 } __packed; /* LTR_CAPABLE_API_S_VER_2 */
128 
129 /* Radio LP RX Energy Threshold measured in dBm */
130 #define POWER_LPRX_RSSI_THRESHOLD	75
131 #define POWER_LPRX_RSSI_THRESHOLD_MAX	94
132 #define POWER_LPRX_RSSI_THRESHOLD_MIN	30
133 
134 /**
135  * enum iwl_power_flags - masks for power table command flags
136  * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
137  *		receiver and transmitter. '0' - does not allow.
138  * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
139  *		'1' Driver enables PM (use rest of parameters)
140  * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
141  *		'1' PM could sleep over DTIM till listen Interval.
142  * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
143  *		access categories are both delivery and trigger enabled.
144  * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
145  *		PBW Snoozing enabled
146  * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
147  * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
148  * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
149  *		detection enablement
150 */
151 enum iwl_power_flags {
152 	POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
153 	POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK	= BIT(1),
154 	POWER_FLAGS_SKIP_OVER_DTIM_MSK		= BIT(2),
155 	POWER_FLAGS_SNOOZE_ENA_MSK		= BIT(5),
156 	POWER_FLAGS_BT_SCO_ENA			= BIT(8),
157 	POWER_FLAGS_ADVANCE_PM_ENA_MSK		= BIT(9),
158 	POWER_FLAGS_LPRX_ENA_MSK		= BIT(11),
159 	POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK	= BIT(12),
160 };
161 
162 #define IWL_POWER_VEC_SIZE 5
163 
164 /**
165  * struct iwl_powertable_cmd - legacy power command. Beside old API support this
166  *	is used also with a new	power API for device wide power settings.
167  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
168  *
169  * @flags:		Power table command flags from POWER_FLAGS_*
170  * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
171  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
172  *			set regardless of power scheme or current power state.
173  *			FW use this value also when PM is disabled.
174  * @debug_flags:	debug flags
175  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
176  *			PSM transition - legacy PM
177  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
178  *			PSM transition - legacy PM
179  * @sleep_interval:	not in use
180  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
181  *			is set. For example, if it is required to skip over
182  *			one DTIM, this value need to be set to 2 (DTIM periods).
183  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
184  *			Default: 80dbm
185  */
186 struct iwl_powertable_cmd {
187 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
188 	__le16 flags;
189 	u8 keep_alive_seconds;
190 	u8 debug_flags;
191 	__le32 rx_data_timeout;
192 	__le32 tx_data_timeout;
193 	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
194 	__le32 skip_dtim_periods;
195 	__le32 lprx_rssi_threshold;
196 } __packed;
197 
198 /**
199  * enum iwl_device_power_flags - masks for device power command flags
200  * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
201  *	'1' Allow to save power by turning off
202  *	receiver and transmitter. '0' - does not allow.
203 */
204 enum iwl_device_power_flags {
205 	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK	= BIT(0),
206 };
207 
208 /**
209  * struct iwl_device_power_cmd - device wide power command.
210  * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
211  *
212  * @flags:	Power table command flags from &enum iwl_device_power_flags
213  * @reserved: reserved (padding)
214  */
215 struct iwl_device_power_cmd {
216 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
217 	__le16 flags;
218 	__le16 reserved;
219 } __packed;
220 
221 /**
222  * struct iwl_mac_power_cmd - New power command containing uAPSD support
223  * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
224  * @id_and_color:	MAC contex identifier, &enum iwl_ctxt_id_and_color
225  * @flags:		Power table command flags from POWER_FLAGS_*
226  * @keep_alive_seconds:	Keep alive period in seconds. Default - 25 sec.
227  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
228  *			set regardless of power scheme or current power state.
229  *			FW use this value also when PM is disabled.
230  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
231  *			PSM transition - legacy PM
232  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
233  *			PSM transition - legacy PM
234  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
235  *			is set. For example, if it is required to skip over
236  *			one DTIM, this value need to be set to 2 (DTIM periods).
237  * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
238  *			PSM transition - uAPSD
239  * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
240  *			PSM transition - uAPSD
241  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
242  *			Default: 80dbm
243  * @snooze_interval:	Maximum time between attempts to retrieve buffered data
244  *			from the AP [msec]
245  * @snooze_window:	A window of time in which PBW snoozing insures that all
246  *			packets received. It is also the minimum time from last
247  *			received unicast RX packet, before client stops snoozing
248  *			for data. [msec]
249  * @snooze_step:	TBD
250  * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
251  * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
252  *			each corresponding AC.
253  *			Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
254  * @uapsd_max_sp:	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
255  *			values.
256  * @heavy_tx_thld_packets:	TX threshold measured in number of packets
257  * @heavy_rx_thld_packets:	RX threshold measured in number of packets
258  * @heavy_tx_thld_percentage:	TX threshold measured in load's percentage
259  * @heavy_rx_thld_percentage:	RX threshold measured in load's percentage
260  * @limited_ps_threshold: (unused)
261  * @reserved: reserved (padding)
262  */
263 struct iwl_mac_power_cmd {
264 	/* CONTEXT_DESC_API_T_VER_1 */
265 	__le32 id_and_color;
266 
267 	/* CLIENT_PM_POWER_TABLE_S_VER_1 */
268 	__le16 flags;
269 	__le16 keep_alive_seconds;
270 	__le32 rx_data_timeout;
271 	__le32 tx_data_timeout;
272 	__le32 rx_data_timeout_uapsd;
273 	__le32 tx_data_timeout_uapsd;
274 	u8 lprx_rssi_threshold;
275 	u8 skip_dtim_periods;
276 	__le16 snooze_interval;
277 	__le16 snooze_window;
278 	u8 snooze_step;
279 	u8 qndp_tid;
280 	u8 uapsd_ac_flags;
281 	u8 uapsd_max_sp;
282 	u8 heavy_tx_thld_packets;
283 	u8 heavy_rx_thld_packets;
284 	u8 heavy_tx_thld_percentage;
285 	u8 heavy_rx_thld_percentage;
286 	u8 limited_ps_threshold;
287 	u8 reserved;
288 } __packed;
289 
290 /*
291  * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
292  * associated AP is identified as improperly implementing uAPSD protocol.
293  * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
294  * @sta_id: index of station in uCode's station table - associated AP ID in
295  *	    this context.
296  */
297 struct iwl_uapsd_misbehaving_ap_notif {
298 	__le32 sta_id;
299 	u8 mac_id;
300 	u8 reserved[3];
301 } __packed;
302 
303 /**
304  * struct iwl_reduce_tx_power_cmd - TX power reduction command
305  * REDUCE_TX_POWER_CMD = 0x9f
306  * @flags: (reserved for future implementation)
307  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
308  * @pwr_restriction: TX power restriction in dBms.
309  */
310 struct iwl_reduce_tx_power_cmd {
311 	u8 flags;
312 	u8 mac_context_id;
313 	__le16 pwr_restriction;
314 } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
315 
316 enum iwl_dev_tx_power_cmd_mode {
317 	IWL_TX_POWER_MODE_SET_MAC = 0,
318 	IWL_TX_POWER_MODE_SET_DEVICE = 1,
319 	IWL_TX_POWER_MODE_SET_CHAINS = 2,
320 	IWL_TX_POWER_MODE_SET_ACK = 3,
321 	IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
322 	IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
323 }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
324 
325 #define IWL_NUM_CHAIN_LIMITS	2
326 #define IWL_NUM_SUB_BANDS	5
327 
328 /**
329  * struct iwl_dev_tx_power_cmd - TX power reduction command
330  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
331  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
332  * @pwr_restriction: TX power restriction in 1/8 dBms.
333  * @dev_24: device TX power restriction in 1/8 dBms
334  * @dev_52_low: device TX power restriction upper band - low
335  * @dev_52_high: device TX power restriction upper band - high
336  * @per_chain_restriction: per chain restrictions
337  */
338 struct iwl_dev_tx_power_cmd_v3 {
339 	__le32 set_mode;
340 	__le32 mac_context_id;
341 	__le16 pwr_restriction;
342 	__le16 dev_24;
343 	__le16 dev_52_low;
344 	__le16 dev_52_high;
345 	__le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
346 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
347 
348 #define IWL_DEV_MAX_TX_POWER 0x7FFF
349 
350 /**
351  * struct iwl_dev_tx_power_cmd - TX power reduction command
352  * @v3: version 3 of the command, embedded here for easier software handling
353  * @enable_ack_reduction: enable or disable close range ack TX power
354  *	reduction.
355  * @reserved: reserved (padding)
356  */
357 struct iwl_dev_tx_power_cmd_v4 {
358 	/* v4 is just an extension of v3 - keep this here */
359 	struct iwl_dev_tx_power_cmd_v3 v3;
360 	u8 enable_ack_reduction;
361 	u8 reserved[3];
362 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
363 
364 /**
365  * struct iwl_dev_tx_power_cmd - TX power reduction command
366  * @v3: version 3 of the command, embedded here for easier software handling
367  * @enable_ack_reduction: enable or disable close range ack TX power
368  *	reduction.
369  * @per_chain_restriction_changed: is per_chain_restriction has changed
370  *	from last command. used if set_mode is
371  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
372  *	note: if not changed, the command is used for keep alive only.
373  * @reserved: reserved (padding)
374  * @timer_period: timer in milliseconds. if expires FW will change to default
375  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
376  */
377 struct iwl_dev_tx_power_cmd {
378 	/* v5 is just an extension of v3 - keep this here */
379 	struct iwl_dev_tx_power_cmd_v3 v3;
380 	u8 enable_ack_reduction;
381 	u8 per_chain_restriction_changed;
382 	u8 reserved[2];
383 	__le32 timer_period;
384 } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
385 
386 #define IWL_NUM_GEO_PROFILES   3
387 
388 /**
389  * enum iwl_geo_per_chain_offset_operation - type of operation
390  * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
391  * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
392  */
393 enum iwl_geo_per_chain_offset_operation {
394 	IWL_PER_CHAIN_OFFSET_SET_TABLES,
395 	IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
396 };  /* GEO_TX_POWER_LIMIT FLAGS TYPE */
397 
398 /**
399  * struct iwl_per_chain_offset - embedded struct for GEO_TX_POWER_LIMIT.
400  * @max_tx_power: maximum allowed tx power.
401  * @chain_a: tx power offset for chain a.
402  * @chain_b: tx power offset for chain b.
403  */
404 struct iwl_per_chain_offset {
405 	__le16 max_tx_power;
406 	u8 chain_a;
407 	u8 chain_b;
408 } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
409 
410 struct iwl_per_chain_offset_group {
411 	struct iwl_per_chain_offset lb;
412 	struct iwl_per_chain_offset hb;
413 } __packed; /* PER_CHAIN_LIMIT_OFFSET_GROUP_S_VER_1 */
414 
415 /**
416  * struct iwl_geo_tx_power_profile_cmd - struct for GEO_TX_POWER_LIMIT cmd.
417  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
418  * @table: offset profile per band.
419  */
420 struct iwl_geo_tx_power_profiles_cmd {
421 	__le32 ops;
422 	struct iwl_per_chain_offset_group table[IWL_NUM_GEO_PROFILES];
423 } __packed; /* GEO_TX_POWER_LIMIT */
424 
425 /**
426  * struct iwl_geo_tx_power_profiles_resp -  response to GEO_TX_POWER_LIMIT cmd
427  * @profile_idx: current geo profile in use
428  */
429 struct iwl_geo_tx_power_profiles_resp {
430 	__le32 profile_idx;
431 } __packed; /* GEO_TX_POWER_LIMIT_RESP */
432 
433 /**
434  * struct iwl_beacon_filter_cmd
435  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
436  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
437  *      to driver if delta in Energy values calculated for this and last
438  *      passed beacon is greater than this threshold. Zero value means that
439  *      the Energy change is ignored for beacon filtering, and beacon will
440  *      not be forced to be sent to driver regardless of this delta. Typical
441  *      energy delta 5dB.
442  * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
443  *      Send beacon to driver if delta in Energy values calculated for this
444  *      and last passed beacon is greater than this threshold. Zero value
445  *      means that the Energy change is ignored for beacon filtering while in
446  *      Roaming state, typical energy delta 1dB.
447  * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
448  *      calculated for current beacon is less than the threshold, use
449  *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
450  *      Threshold. Typical energy threshold is -72dBm.
451  * @bf_temp_threshold: This threshold determines the type of temperature
452  *	filtering (Slow or Fast) that is selected (Units are in Celsuis):
453  *	If the current temperature is above this threshold - Fast filter
454  *	will be used, If the current temperature is below this threshold -
455  *	Slow filter will be used.
456  * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
457  *      calculated for this and the last passed beacon is greater than this
458  *      threshold. Zero value means that the temperature change is ignored for
459  *      beacon filtering; beacons will not be  forced to be sent to driver
460  *      regardless of whether its temerature has been changed.
461  * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
462  *      calculated for this and the last passed beacon is greater than this
463  *      threshold. Zero value means that the temperature change is ignored for
464  *      beacon filtering; beacons will not be forced to be sent to driver
465  *      regardless of whether its temerature has been changed.
466  * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
467  * @bf_debug_flag: beacon filtering debug configuration
468  * @bf_escape_timer: Send beacons to to driver if no beacons were passed
469  *      for a specific period of time. Units: Beacons.
470  * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
471  *      for a longer period of time then this escape-timeout. Units: Beacons.
472  * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
473  */
474 struct iwl_beacon_filter_cmd {
475 	__le32 bf_energy_delta;
476 	__le32 bf_roaming_energy_delta;
477 	__le32 bf_roaming_state;
478 	__le32 bf_temp_threshold;
479 	__le32 bf_temp_fast_filter;
480 	__le32 bf_temp_slow_filter;
481 	__le32 bf_enable_beacon_filter;
482 	__le32 bf_debug_flag;
483 	__le32 bf_escape_timer;
484 	__le32 ba_escape_timer;
485 	__le32 ba_enable_beacon_abort;
486 } __packed;
487 
488 /* Beacon filtering and beacon abort */
489 #define IWL_BF_ENERGY_DELTA_DEFAULT 5
490 #define IWL_BF_ENERGY_DELTA_D0I3 20
491 #define IWL_BF_ENERGY_DELTA_MAX 255
492 #define IWL_BF_ENERGY_DELTA_MIN 0
493 
494 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
495 #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
496 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
497 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
498 
499 #define IWL_BF_ROAMING_STATE_DEFAULT 72
500 #define IWL_BF_ROAMING_STATE_D0I3 72
501 #define IWL_BF_ROAMING_STATE_MAX 255
502 #define IWL_BF_ROAMING_STATE_MIN 0
503 
504 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
505 #define IWL_BF_TEMP_THRESHOLD_D0I3 112
506 #define IWL_BF_TEMP_THRESHOLD_MAX 255
507 #define IWL_BF_TEMP_THRESHOLD_MIN 0
508 
509 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
510 #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
511 #define IWL_BF_TEMP_FAST_FILTER_MAX 255
512 #define IWL_BF_TEMP_FAST_FILTER_MIN 0
513 
514 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
515 #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
516 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
517 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
518 
519 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
520 
521 #define IWL_BF_DEBUG_FLAG_DEFAULT 0
522 #define IWL_BF_DEBUG_FLAG_D0I3 0
523 
524 #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
525 #define IWL_BF_ESCAPE_TIMER_D0I3 0
526 #define IWL_BF_ESCAPE_TIMER_MAX 1024
527 #define IWL_BF_ESCAPE_TIMER_MIN 0
528 
529 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
530 #define IWL_BA_ESCAPE_TIMER_D0I3 6
531 #define IWL_BA_ESCAPE_TIMER_D3 9
532 #define IWL_BA_ESCAPE_TIMER_MAX 1024
533 #define IWL_BA_ESCAPE_TIMER_MIN 0
534 
535 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
536 
537 #define IWL_BF_CMD_CONFIG(mode)					     \
538 	.bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),	      \
539 	.bf_roaming_energy_delta =					      \
540 		cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),	      \
541 	.bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),	      \
542 	.bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
543 	.bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
544 	.bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
545 	.bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),	      \
546 	.bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),	      \
547 	.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
548 
549 #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
550 #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
551 #endif /* __iwl_fw_api_power_h__ */
552