“5c112ac9b5a8b8456518b256674714721b10b81e”上不存在“sig/sig_devboard/sig_devboard.md”
fw-api-power.h 20.4 KB
Newer Older
J
Johannes Berg 已提交
1 2 3 4 5 6 7
/******************************************************************************
 *
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
 *
 * GPL LICENSE SUMMARY
 *
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
J
Johannes Berg 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
 * USA
 *
 * The full GNU General Public License is included in this distribution
27
 * in the file called COPYING.
J
Johannes Berg 已提交
28 29
 *
 * Contact Information:
30
 *  Intel Linux Wireless <linuxwifi@intel.com>
J
Johannes Berg 已提交
31 32 33 34
 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 *
 * BSD LICENSE
 *
35
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36
 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
37
 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
J
Johannes Berg 已提交
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name Intel Corporation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

#ifndef __fw_api_power_h__
#define __fw_api_power_h__

/* Power Management Commands, Responses, Notifications */

E
Emmanuel Grumbach 已提交
73 74 75 76 77 78 79 80 81 82 83 84
/**
 * enum iwl_ltr_config_flags - masks for LTR config command flags
 * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
 * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
 *	memory access
 * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
 *	reg change
 * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
 *	D0 to D3
 * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
 * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
 * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
85 86
 * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
 *	idle timeout
E
Emmanuel Grumbach 已提交
87 88 89 90 91 92 93 94 95
 */
enum iwl_ltr_config_flags {
	LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
	LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
	LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
	LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
	LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
	LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
	LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
96
	LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
E
Emmanuel Grumbach 已提交
97 98
};

99 100
/**
 * struct iwl_ltr_config_cmd_v1 - configures the LTR
101
 * @flags: See &enum iwl_ltr_config_flags
102 103
 * @static_long: static LTR Long register value.
 * @static_short: static LTR Short register value.
104 105 106 107 108 109 110 111 112
 */
struct iwl_ltr_config_cmd_v1 {
	__le32 flags;
	__le32 static_long;
	__le32 static_short;
} __packed; /* LTR_CAPABLE_API_S_VER_1 */

#define LTR_VALID_STATES_NUM 4

E
Emmanuel Grumbach 已提交
113 114
/**
 * struct iwl_ltr_config_cmd - configures the LTR
115
 * @flags: See &enum iwl_ltr_config_flags
116 117 118 119 120 121 122
 * @static_long: static LTR Long register value.
 * @static_short: static LTR Short register value.
 * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
 *	TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
 *	is set.
 * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
 *	%LTR_CFG_FLAG_UPDATE_VALUES is set.
E
Emmanuel Grumbach 已提交
123 124 125 126 127
 */
struct iwl_ltr_config_cmd {
	__le32 flags;
	__le32 static_long;
	__le32 static_short;
128 129 130
	__le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
	__le32 ltr_short_idle_timeout;
} __packed; /* LTR_CAPABLE_API_S_VER_2 */
E
Emmanuel Grumbach 已提交
131

132 133 134 135 136
/* Radio LP RX Energy Threshold measured in dBm */
#define POWER_LPRX_RSSI_THRESHOLD	75
#define POWER_LPRX_RSSI_THRESHOLD_MAX	94
#define POWER_LPRX_RSSI_THRESHOLD_MIN	30

J
Johannes Berg 已提交
137
/**
E
Emmanuel Grumbach 已提交
138
 * enum iwl_power_flags - masks for power table command flags
139 140
 * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
 *		receiver and transmitter. '0' - does not allow.
J
Johannes Berg 已提交
141 142
 * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
 *		'1' Driver enables PM (use rest of parameters)
143
 * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
J
Johannes Berg 已提交
144
 *		'1' PM could sleep over DTIM till listen Interval.
145 146 147 148
 * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
 *		access categories are both delivery and trigger enabled.
 * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
 *		PBW Snoozing enabled
J
Johannes Berg 已提交
149
 * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
150
 * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
151
 * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
152
 *		detection enablement
J
Johannes Berg 已提交
153 154
*/
enum iwl_power_flags {
155 156
	POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
	POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK	= BIT(1),
157
	POWER_FLAGS_SKIP_OVER_DTIM_MSK		= BIT(2),
158 159
	POWER_FLAGS_SNOOZE_ENA_MSK		= BIT(5),
	POWER_FLAGS_BT_SCO_ENA			= BIT(8),
160 161
	POWER_FLAGS_ADVANCE_PM_ENA_MSK		= BIT(9),
	POWER_FLAGS_LPRX_ENA_MSK		= BIT(11),
162
	POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK	= BIT(12),
J
Johannes Berg 已提交
163 164
};

165 166
#define IWL_POWER_VEC_SIZE 5

J
Johannes Berg 已提交
167
/**
168 169
 * struct iwl_powertable_cmd - legacy power command. Beside old API support this
 *	is used also with a new	power API for device wide power settings.
J
Johannes Berg 已提交
170 171 172 173
 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
 *
 * @flags:		Power table command flags from POWER_FLAGS_*
 * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
174 175 176
 *			Minimum allowed:- 3 * DTIM. Keep alive period must be
 *			set regardless of power scheme or current power state.
 *			FW use this value also when PM is disabled.
177
 * @debug_flags:	debug flags
J
Johannes Berg 已提交
178 179 180 181
 * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
 *			PSM transition - legacy PM
 * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
 *			PSM transition - legacy PM
182
 * @sleep_interval:	not in use
183 184 185
 * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
 *			is set. For example, if it is required to skip over
 *			one DTIM, this value need to be set to 2 (DTIM periods).
J
Johannes Berg 已提交
186 187 188 189
 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
 *			Default: 80dbm
 */
struct iwl_powertable_cmd {
190
	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
J
Johannes Berg 已提交
191
	__le16 flags;
192 193
	u8 keep_alive_seconds;
	u8 debug_flags;
J
Johannes Berg 已提交
194 195
	__le32 rx_data_timeout;
	__le32 tx_data_timeout;
196
	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
197
	__le32 skip_dtim_periods;
198
	__le32 lprx_rssi_threshold;
J
Johannes Berg 已提交
199 200
} __packed;

201 202
/**
 * enum iwl_device_power_flags - masks for device power command flags
203 204
 * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
 *	'1' Allow to save power by turning off
205
 *	receiver and transmitter. '0' - does not allow.
206 207 208 209 210 211 212 213 214
*/
enum iwl_device_power_flags {
	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK	= BIT(0),
};

/**
 * struct iwl_device_power_cmd - device wide power command.
 * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
 *
215
 * @flags:	Power table command flags from &enum iwl_device_power_flags
216
 * @reserved: reserved (padding)
217 218 219 220 221 222 223
 */
struct iwl_device_power_cmd {
	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
	__le16 flags;
	__le16 reserved;
} __packed;

224 225 226
/**
 * struct iwl_mac_power_cmd - New power command containing uAPSD support
 * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
227
 * @id_and_color:	MAC contex identifier, &enum iwl_mvm_id_and_color
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
 * @flags:		Power table command flags from POWER_FLAGS_*
 * @keep_alive_seconds:	Keep alive period in seconds. Default - 25 sec.
 *			Minimum allowed:- 3 * DTIM. Keep alive period must be
 *			set regardless of power scheme or current power state.
 *			FW use this value also when PM is disabled.
 * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
 *			PSM transition - legacy PM
 * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
 *			PSM transition - legacy PM
 * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
 *			is set. For example, if it is required to skip over
 *			one DTIM, this value need to be set to 2 (DTIM periods).
 * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
 *			PSM transition - uAPSD
 * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
 *			PSM transition - uAPSD
 * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
 *			Default: 80dbm
246 247 248 249 250 251
 * @snooze_interval:	Maximum time between attempts to retrieve buffered data
 *			from the AP [msec]
 * @snooze_window:	A window of time in which PBW snoozing insures that all
 *			packets received. It is also the minimum time from last
 *			received unicast RX packet, before client stops snoozing
 *			for data. [msec]
252 253 254 255 256 257 258
 * @snooze_step:	TBD
 * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
 * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
 *			each corresponding AC.
 *			Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
 * @uapsd_max_sp:	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
 *			values.
259 260 261 262
 * @heavy_tx_thld_packets:	TX threshold measured in number of packets
 * @heavy_rx_thld_packets:	RX threshold measured in number of packets
 * @heavy_tx_thld_percentage:	TX threshold measured in load's percentage
 * @heavy_rx_thld_percentage:	RX threshold measured in load's percentage
263 264 265
 * @limited_ps_threshold: (unused)
 * @reserved: reserved (padding)
 */
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
struct iwl_mac_power_cmd {
	/* CONTEXT_DESC_API_T_VER_1 */
	__le32 id_and_color;

	/* CLIENT_PM_POWER_TABLE_S_VER_1 */
	__le16 flags;
	__le16 keep_alive_seconds;
	__le32 rx_data_timeout;
	__le32 tx_data_timeout;
	__le32 rx_data_timeout_uapsd;
	__le32 tx_data_timeout_uapsd;
	u8 lprx_rssi_threshold;
	u8 skip_dtim_periods;
	__le16 snooze_interval;
	__le16 snooze_window;
	u8 snooze_step;
	u8 qndp_tid;
	u8 uapsd_ac_flags;
	u8 uapsd_max_sp;
285 286 287 288
	u8 heavy_tx_thld_packets;
	u8 heavy_rx_thld_packets;
	u8 heavy_tx_thld_percentage;
	u8 heavy_rx_thld_percentage;
289 290 291 292
	u8 limited_ps_threshold;
	u8 reserved;
} __packed;

293 294 295 296 297 298 299 300 301 302 303 304 305
/*
 * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
 * associated AP is identified as improperly implementing uAPSD protocol.
 * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
 * @sta_id: index of station in uCode's station table - associated AP ID in
 *	    this context.
 */
struct iwl_uapsd_misbehaving_ap_notif {
	__le32 sta_id;
	u8 mac_id;
	u8 reserved[3];
} __packed;

306 307 308 309 310 311 312 313 314 315 316 317 318
/**
 * struct iwl_reduce_tx_power_cmd - TX power reduction command
 * REDUCE_TX_POWER_CMD = 0x9f
 * @flags: (reserved for future implementation)
 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
 * @pwr_restriction: TX power restriction in dBms.
 */
struct iwl_reduce_tx_power_cmd {
	u8 flags;
	u8 mac_context_id;
	__le16 pwr_restriction;
} __packed; /* TX_REDUCED_POWER_API_S_VER_1 */

319 320 321 322
enum iwl_dev_tx_power_cmd_mode {
	IWL_TX_POWER_MODE_SET_MAC = 0,
	IWL_TX_POWER_MODE_SET_DEVICE = 1,
	IWL_TX_POWER_MODE_SET_CHAINS = 2,
323 324
	IWL_TX_POWER_MODE_SET_ACK = 3,
}; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_4 */;
325

326 327 328
#define IWL_NUM_CHAIN_LIMITS	2
#define IWL_NUM_SUB_BANDS	5

329
/**
330
 * struct iwl_dev_tx_power_cmd - TX power reduction command
331
 * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
332 333 334 335 336
 * @mac_context_id: id of the mac ctx for which we are reducing TX power.
 * @pwr_restriction: TX power restriction in 1/8 dBms.
 * @dev_24: device TX power restriction in 1/8 dBms
 * @dev_52_low: device TX power restriction upper band - low
 * @dev_52_high: device TX power restriction upper band - high
337
 * @per_chain_restriction: per chain restrictions
338
 */
339
struct iwl_dev_tx_power_cmd_v3 {
340 341 342 343 344 345
	__le32 set_mode;
	__le32 mac_context_id;
	__le16 pwr_restriction;
	__le16 dev_24;
	__le16 dev_52_low;
	__le16 dev_52_high;
346 347 348
	__le16 per_chain_restriction[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
} __packed; /* TX_REDUCED_POWER_API_S_VER_3 */

349 350
#define IWL_DEV_MAX_TX_POWER 0x7FFF

351 352 353 354 355
/**
 * struct iwl_dev_tx_power_cmd - TX power reduction command
 * @v3: version 3 of the command, embedded here for easier software handling
 * @enable_ack_reduction: enable or disable close range ack TX power
 *	reduction.
356
 * @reserved: reserved (padding)
357 358 359 360 361 362 363 364
 */
struct iwl_dev_tx_power_cmd {
	/* v4 is just an extension of v3 - keep this here */
	struct iwl_dev_tx_power_cmd_v3 v3;
	u8 enable_ack_reduction;
	u8 reserved[3];
} __packed; /* TX_REDUCED_POWER_API_S_VER_4 */

365
#define IWL_NUM_GEO_PROFILES	3
H
Haim Dreyfuss 已提交
366
#define IWL_GEO_PER_CHAIN_SIZE	3
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404

/**
 * enum iwl_geo_per_chain_offset_operation - type of operation
 * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
 * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
 */
enum iwl_geo_per_chain_offset_operation {
	IWL_PER_CHAIN_OFFSET_SET_TABLES,
	IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
};  /* GEO_TX_POWER_LIMIT FLAGS TYPE */

/**
 * struct iwl_per_chain_offset - embedded struct for GEO_TX_POWER_LIMIT.
 * @max_tx_power: maximum allowed tx power.
 * @chain_a: tx power offset for chain a.
 * @chain_b: tx power offset for chain b.
 */
struct iwl_per_chain_offset {
	__le16 max_tx_power;
	u8 chain_a;
	u8 chain_b;
} __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */

struct iwl_per_chain_offset_group {
	struct iwl_per_chain_offset lb;
	struct iwl_per_chain_offset hb;
} __packed; /* PER_CHAIN_LIMIT_OFFSET_GROUP_S_VER_1 */

/**
 * struct iwl_geo_tx_power_profile_cmd - struct for GEO_TX_POWER_LIMIT cmd.
 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
 * @table: offset profile per band.
 */
struct iwl_geo_tx_power_profiles_cmd {
	__le32 ops;
	struct iwl_per_chain_offset_group table[IWL_NUM_GEO_PROFILES];
} __packed; /* GEO_TX_POWER_LIMIT */

H
Haim Dreyfuss 已提交
405 406 407 408 409 410 411 412
/**
 * struct iwl_geo_tx_power_profiles_resp -  response to GEO_TX_POWER_LIMIT cmd
 * @profile_idx: current geo profile in use
 */
struct iwl_geo_tx_power_profiles_resp {
	__le32 profile_idx;
} __packed; /* GEO_TX_POWER_LIMIT_RESP */

413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
/**
 * struct iwl_beacon_filter_cmd
 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
 *      to driver if delta in Energy values calculated for this and last
 *      passed beacon is greater than this threshold. Zero value means that
 *      the Energy change is ignored for beacon filtering, and beacon will
 *      not be forced to be sent to driver regardless of this delta. Typical
 *      energy delta 5dB.
 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
 *      Send beacon to driver if delta in Energy values calculated for this
 *      and last passed beacon is greater than this threshold. Zero value
 *      means that the Energy change is ignored for beacon filtering while in
 *      Roaming state, typical energy delta 1dB.
 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
 *      calculated for current beacon is less than the threshold, use
 *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
 *      Threshold. Typical energy threshold is -72dBm.
431 432
 * @bf_temp_threshold: This threshold determines the type of temperature
 *	filtering (Slow or Fast) that is selected (Units are in Celsuis):
433
 *	If the current temperature is above this threshold - Fast filter
434 435 436 437 438
 *	will be used, If the current temperature is below this threshold -
 *	Slow filter will be used.
 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
 *      calculated for this and the last passed beacon is greater than this
 *      threshold. Zero value means that the temperature change is ignored for
439 440
 *      beacon filtering; beacons will not be  forced to be sent to driver
 *      regardless of whether its temerature has been changed.
441 442 443 444 445
 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
 *      calculated for this and the last passed beacon is greater than this
 *      threshold. Zero value means that the temperature change is ignored for
 *      beacon filtering; beacons will not be forced to be sent to driver
 *      regardless of whether its temerature has been changed.
446
 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
447 448
 * @bf_debug_flag: beacon filtering debug configuration
 * @bf_escape_timer: Send beacons to to driver if no beacons were passed
449 450 451 452 453 454
 *      for a specific period of time. Units: Beacons.
 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
 *      for a longer period of time then this escape-timeout. Units: Beacons.
 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
 */
struct iwl_beacon_filter_cmd {
455 456 457 458 459 460 461 462
	__le32 bf_energy_delta;
	__le32 bf_roaming_energy_delta;
	__le32 bf_roaming_state;
	__le32 bf_temp_threshold;
	__le32 bf_temp_fast_filter;
	__le32 bf_temp_slow_filter;
	__le32 bf_enable_beacon_filter;
	__le32 bf_debug_flag;
463 464
	__le32 bf_escape_timer;
	__le32 ba_escape_timer;
465
	__le32 ba_enable_beacon_abort;
466 467 468 469
} __packed;

/* Beacon filtering and beacon abort */
#define IWL_BF_ENERGY_DELTA_DEFAULT 5
470
#define IWL_BF_ENERGY_DELTA_D0I3 20
471 472 473 474
#define IWL_BF_ENERGY_DELTA_MAX 255
#define IWL_BF_ENERGY_DELTA_MIN 0

#define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
475
#define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
476 477 478 479
#define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
#define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0

#define IWL_BF_ROAMING_STATE_DEFAULT 72
480
#define IWL_BF_ROAMING_STATE_D0I3 72
481 482 483
#define IWL_BF_ROAMING_STATE_MAX 255
#define IWL_BF_ROAMING_STATE_MIN 0

484
#define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
485
#define IWL_BF_TEMP_THRESHOLD_D0I3 112
486 487 488 489
#define IWL_BF_TEMP_THRESHOLD_MAX 255
#define IWL_BF_TEMP_THRESHOLD_MIN 0

#define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
490
#define IWL_BF_TEMP_FAST_FILTER_D0I3 1
491 492 493 494
#define IWL_BF_TEMP_FAST_FILTER_MAX 255
#define IWL_BF_TEMP_FAST_FILTER_MIN 0

#define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
495
#define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
496 497
#define IWL_BF_TEMP_SLOW_FILTER_MAX 255
#define IWL_BF_TEMP_SLOW_FILTER_MIN 0
498 499 500 501

#define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1

#define IWL_BF_DEBUG_FLAG_DEFAULT 0
502
#define IWL_BF_DEBUG_FLAG_D0I3 0
503

504
#define IWL_BF_ESCAPE_TIMER_DEFAULT 0
505
#define IWL_BF_ESCAPE_TIMER_D0I3 0
506 507 508
#define IWL_BF_ESCAPE_TIMER_MAX 1024
#define IWL_BF_ESCAPE_TIMER_MIN 0

509
#define IWL_BA_ESCAPE_TIMER_DEFAULT 6
510
#define IWL_BA_ESCAPE_TIMER_D0I3 6
511
#define IWL_BA_ESCAPE_TIMER_D3 9
512 513 514 515 516
#define IWL_BA_ESCAPE_TIMER_MAX 1024
#define IWL_BA_ESCAPE_TIMER_MIN 0

#define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1

517 518 519 520 521 522 523 524 525 526 527
#define IWL_BF_CMD_CONFIG(mode)					     \
	.bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),	      \
	.bf_roaming_energy_delta =					      \
		cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),	      \
	.bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),	      \
	.bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
	.bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
	.bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
	.bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),	      \
	.bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),	      \
	.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
528

529 530
#define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
#define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
J
Johannes Berg 已提交
531
#endif