• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 - 2020 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 - 2020 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  * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
204  *	Device Retention indication, '1' indicate retention is enabled.
205  * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
206  *	32Khz external slow clock valid indication, '1' indicate cloack is
207  *	valid.
208 */
209 enum iwl_device_power_flags {
210 	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
211 	DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK	= BIT(1),
212 	DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK		= BIT(12),
213 };
214 
215 /**
216  * struct iwl_device_power_cmd - device wide power command.
217  * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
218  *
219  * @flags:	Power table command flags from &enum iwl_device_power_flags
220  * @reserved: reserved (padding)
221  */
222 struct iwl_device_power_cmd {
223 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
224 	__le16 flags;
225 	__le16 reserved;
226 } __packed;
227 
228 /**
229  * struct iwl_mac_power_cmd - New power command containing uAPSD support
230  * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
231  * @id_and_color:	MAC contex identifier, &enum iwl_ctxt_id_and_color
232  * @flags:		Power table command flags from POWER_FLAGS_*
233  * @keep_alive_seconds:	Keep alive period in seconds. Default - 25 sec.
234  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
235  *			set regardless of power scheme or current power state.
236  *			FW use this value also when PM is disabled.
237  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
238  *			PSM transition - legacy PM
239  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
240  *			PSM transition - legacy PM
241  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
242  *			is set. For example, if it is required to skip over
243  *			one DTIM, this value need to be set to 2 (DTIM periods).
244  * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
245  *			PSM transition - uAPSD
246  * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
247  *			PSM transition - uAPSD
248  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
249  *			Default: 80dbm
250  * @snooze_interval:	Maximum time between attempts to retrieve buffered data
251  *			from the AP [msec]
252  * @snooze_window:	A window of time in which PBW snoozing insures that all
253  *			packets received. It is also the minimum time from last
254  *			received unicast RX packet, before client stops snoozing
255  *			for data. [msec]
256  * @snooze_step:	TBD
257  * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
258  * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
259  *			each corresponding AC.
260  *			Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
261  * @uapsd_max_sp:	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
262  *			values.
263  * @heavy_tx_thld_packets:	TX threshold measured in number of packets
264  * @heavy_rx_thld_packets:	RX threshold measured in number of packets
265  * @heavy_tx_thld_percentage:	TX threshold measured in load's percentage
266  * @heavy_rx_thld_percentage:	RX threshold measured in load's percentage
267  * @limited_ps_threshold: (unused)
268  * @reserved: reserved (padding)
269  */
270 struct iwl_mac_power_cmd {
271 	/* CONTEXT_DESC_API_T_VER_1 */
272 	__le32 id_and_color;
273 
274 	/* CLIENT_PM_POWER_TABLE_S_VER_1 */
275 	__le16 flags;
276 	__le16 keep_alive_seconds;
277 	__le32 rx_data_timeout;
278 	__le32 tx_data_timeout;
279 	__le32 rx_data_timeout_uapsd;
280 	__le32 tx_data_timeout_uapsd;
281 	u8 lprx_rssi_threshold;
282 	u8 skip_dtim_periods;
283 	__le16 snooze_interval;
284 	__le16 snooze_window;
285 	u8 snooze_step;
286 	u8 qndp_tid;
287 	u8 uapsd_ac_flags;
288 	u8 uapsd_max_sp;
289 	u8 heavy_tx_thld_packets;
290 	u8 heavy_rx_thld_packets;
291 	u8 heavy_tx_thld_percentage;
292 	u8 heavy_rx_thld_percentage;
293 	u8 limited_ps_threshold;
294 	u8 reserved;
295 } __packed;
296 
297 /*
298  * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
299  * associated AP is identified as improperly implementing uAPSD protocol.
300  * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
301  * @sta_id: index of station in uCode's station table - associated AP ID in
302  *	    this context.
303  */
304 struct iwl_uapsd_misbehaving_ap_notif {
305 	__le32 sta_id;
306 	u8 mac_id;
307 	u8 reserved[3];
308 } __packed;
309 
310 /**
311  * struct iwl_reduce_tx_power_cmd - TX power reduction command
312  * REDUCE_TX_POWER_CMD = 0x9f
313  * @flags: (reserved for future implementation)
314  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
315  * @pwr_restriction: TX power restriction in dBms.
316  */
317 struct iwl_reduce_tx_power_cmd {
318 	u8 flags;
319 	u8 mac_context_id;
320 	__le16 pwr_restriction;
321 } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
322 
323 enum iwl_dev_tx_power_cmd_mode {
324 	IWL_TX_POWER_MODE_SET_MAC = 0,
325 	IWL_TX_POWER_MODE_SET_DEVICE = 1,
326 	IWL_TX_POWER_MODE_SET_CHAINS = 2,
327 	IWL_TX_POWER_MODE_SET_ACK = 3,
328 	IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
329 	IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
330 }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
331 
332 #define IWL_NUM_CHAIN_TABLES	1
333 #define IWL_NUM_CHAIN_TABLES_V2	2
334 #define IWL_NUM_CHAIN_LIMITS	2
335 #define IWL_NUM_SUB_BANDS	5
336 #define IWL_NUM_SUB_BANDS_V2	11
337 
338 /**
339  * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd
340  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
341  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
342  * @pwr_restriction: TX power restriction in 1/8 dBms.
343  * @dev_24: device TX power restriction in 1/8 dBms
344  * @dev_52_low: device TX power restriction upper band - low
345  * @dev_52_high: device TX power restriction upper band - high
346  */
347 struct iwl_dev_tx_power_common {
348 	__le32 set_mode;
349 	__le32 mac_context_id;
350 	__le16 pwr_restriction;
351 	__le16 dev_24;
352 	__le16 dev_52_low;
353 	__le16 dev_52_high;
354 };
355 
356 /**
357  * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
358  * @per_chain: per chain restrictions
359  */
360 struct iwl_dev_tx_power_cmd_v3 {
361 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
362 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
363 
364 #define IWL_DEV_MAX_TX_POWER 0x7FFF
365 
366 /**
367  * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4
368  * @per_chain: per chain restrictions
369  * @enable_ack_reduction: enable or disable close range ack TX power
370  *	reduction.
371  * @reserved: reserved (padding)
372  */
373 struct iwl_dev_tx_power_cmd_v4 {
374 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
375 	u8 enable_ack_reduction;
376 	u8 reserved[3];
377 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
378 
379 /**
380  * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
381  * @per_chain: per chain restrictions
382  * @enable_ack_reduction: enable or disable close range ack TX power
383  *	reduction.
384  * @per_chain_restriction_changed: is per_chain_restriction has changed
385  *	from last command. used if set_mode is
386  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
387  *	note: if not changed, the command is used for keep alive only.
388  * @reserved: reserved (padding)
389  * @timer_period: timer in milliseconds. if expires FW will change to default
390  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
391  */
392 struct iwl_dev_tx_power_cmd_v5 {
393 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
394 	u8 enable_ack_reduction;
395 	u8 per_chain_restriction_changed;
396 	u8 reserved[2];
397 	__le32 timer_period;
398 } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
399 
400 /**
401  * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
402  * @per_chain: per chain restrictions
403  * @enable_ack_reduction: enable or disable close range ack TX power
404  *	reduction.
405  * @per_chain_restriction_changed: is per_chain_restriction has changed
406  *	from last command. used if set_mode is
407  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
408  *	note: if not changed, the command is used for keep alive only.
409  * @reserved: reserved (padding)
410  * @timer_period: timer in milliseconds. if expires FW will change to default
411  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
412  */
413 struct iwl_dev_tx_power_cmd_v6 {
414 	__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
415 	u8 enable_ack_reduction;
416 	u8 per_chain_restriction_changed;
417 	u8 reserved[2];
418 	__le32 timer_period;
419 } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
420 
421 /**
422  * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
423  * @common: common part of the command
424  * @v3: version 3 part of the command
425  * @v4: version 4 part of the command
426  * @v5: version 5 part of the command
427  * @v6: version 6 part of the command
428  */
429 struct iwl_dev_tx_power_cmd {
430 	struct iwl_dev_tx_power_common common;
431 	union {
432 		struct iwl_dev_tx_power_cmd_v3 v3;
433 		struct iwl_dev_tx_power_cmd_v4 v4;
434 		struct iwl_dev_tx_power_cmd_v5 v5;
435 		struct iwl_dev_tx_power_cmd_v6 v6;
436 	};
437 };
438 
439 #define IWL_NUM_GEO_PROFILES   3
440 #define IWL_NUM_BANDS_PER_CHAIN_V1 2
441 #define IWL_NUM_BANDS_PER_CHAIN_V2 3
442 
443 /**
444  * enum iwl_geo_per_chain_offset_operation - type of operation
445  * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
446  * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
447  */
448 enum iwl_geo_per_chain_offset_operation {
449 	IWL_PER_CHAIN_OFFSET_SET_TABLES,
450 	IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
451 };  /* GEO_TX_POWER_LIMIT FLAGS TYPE */
452 
453 /**
454  * struct iwl_per_chain_offset - embedded struct for GEO_TX_POWER_LIMIT.
455  * @max_tx_power: maximum allowed tx power.
456  * @chain_a: tx power offset for chain a.
457  * @chain_b: tx power offset for chain b.
458  */
459 struct iwl_per_chain_offset {
460 	__le16 max_tx_power;
461 	u8 chain_a;
462 	u8 chain_b;
463 } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
464 
465 /**
466  * struct iwl_geo_tx_power_profile_cmd_v1 - struct for GEO_TX_POWER_LIMIT cmd.
467  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
468  * @table: offset profile per band.
469  */
470 struct iwl_geo_tx_power_profiles_cmd_v1 {
471 	__le32 ops;
472 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
473 } __packed; /* GEO_TX_POWER_LIMIT_VER_1 */
474 
475 /**
476  * struct iwl_geo_tx_power_profile_cmd_v2 - struct for GEO_TX_POWER_LIMIT cmd.
477  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
478  * @table: offset profile per band.
479  * @table_revision: BIOS table revision.
480  */
481 struct iwl_geo_tx_power_profiles_cmd_v2 {
482 	__le32 ops;
483 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
484 	__le32 table_revision;
485 } __packed; /* GEO_TX_POWER_LIMIT_VER_2 */
486 
487 /**
488  * struct iwl_geo_tx_power_profile_cmd_v3 - struct for GEO_TX_POWER_LIMIT cmd.
489  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
490  * @table: offset profile per band.
491  * @table_revision: BIOS table revision.
492  */
493 struct iwl_geo_tx_power_profiles_cmd_v3 {
494 	__le32 ops;
495 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2];
496 	__le32 table_revision;
497 } __packed; /* GEO_TX_POWER_LIMIT_VER_3 */
498 
499 union iwl_geo_tx_power_profiles_cmd {
500 	struct iwl_geo_tx_power_profiles_cmd_v1 v1;
501 	struct iwl_geo_tx_power_profiles_cmd_v2 v2;
502 	struct iwl_geo_tx_power_profiles_cmd_v3 v3;
503 };
504 
505 /**
506  * struct iwl_geo_tx_power_profiles_resp -  response to GEO_TX_POWER_LIMIT cmd
507  * @profile_idx: current geo profile in use
508  */
509 struct iwl_geo_tx_power_profiles_resp {
510 	__le32 profile_idx;
511 } __packed; /* GEO_TX_POWER_LIMIT_RESP */
512 
513 /**
514  * union iwl_ppag_table_cmd - union for all versions of PPAG command
515  * @v1: version 1, table revision = 0
516  * @v2: version 2, table revision = 1
517  *
518  * @enabled: 1 if PPAG is enabled, 0 otherwise
519  * @gain: table of antenna gain values per chain and sub-band
520  * @reserved: reserved
521  */
522 union iwl_ppag_table_cmd {
523 	struct {
524 		__le32 enabled;
525 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
526 		s8 reserved[2];
527 	} v1;
528 	struct {
529 		__le32 enabled;
530 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
531 		s8 reserved[2];
532 	} v2;
533 } __packed;
534 
535 /**
536  * struct iwl_beacon_filter_cmd
537  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
538  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
539  *      to driver if delta in Energy values calculated for this and last
540  *      passed beacon is greater than this threshold. Zero value means that
541  *      the Energy change is ignored for beacon filtering, and beacon will
542  *      not be forced to be sent to driver regardless of this delta. Typical
543  *      energy delta 5dB.
544  * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
545  *      Send beacon to driver if delta in Energy values calculated for this
546  *      and last passed beacon is greater than this threshold. Zero value
547  *      means that the Energy change is ignored for beacon filtering while in
548  *      Roaming state, typical energy delta 1dB.
549  * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
550  *      calculated for current beacon is less than the threshold, use
551  *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
552  *      Threshold. Typical energy threshold is -72dBm.
553  * @bf_temp_threshold: This threshold determines the type of temperature
554  *	filtering (Slow or Fast) that is selected (Units are in Celsuis):
555  *	If the current temperature is above this threshold - Fast filter
556  *	will be used, If the current temperature is below this threshold -
557  *	Slow filter will be used.
558  * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
559  *      calculated for this and the last passed beacon is greater than this
560  *      threshold. Zero value means that the temperature change is ignored for
561  *      beacon filtering; beacons will not be  forced to be sent to driver
562  *      regardless of whether its temerature has been changed.
563  * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
564  *      calculated for this and the last passed beacon is greater than this
565  *      threshold. Zero value means that the temperature change is ignored for
566  *      beacon filtering; beacons will not be forced to be sent to driver
567  *      regardless of whether its temerature has been changed.
568  * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
569  * @bf_debug_flag: beacon filtering debug configuration
570  * @bf_escape_timer: Send beacons to to driver if no beacons were passed
571  *      for a specific period of time. Units: Beacons.
572  * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
573  *      for a longer period of time then this escape-timeout. Units: Beacons.
574  * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
575  * @bf_threshold_absolute_low: See below.
576  * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
577  *      for this beacon crossed this absolute threshold. For the 'Increase'
578  *      direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
579  *      direction the bf_energy_absolute_high[i] is used. Zero value means
580  *      that this specific threshold is ignored for beacon filtering, and
581  *      beacon will not be forced to be sent to driver due to this setting.
582  */
583 struct iwl_beacon_filter_cmd {
584 	__le32 bf_energy_delta;
585 	__le32 bf_roaming_energy_delta;
586 	__le32 bf_roaming_state;
587 	__le32 bf_temp_threshold;
588 	__le32 bf_temp_fast_filter;
589 	__le32 bf_temp_slow_filter;
590 	__le32 bf_enable_beacon_filter;
591 	__le32 bf_debug_flag;
592 	__le32 bf_escape_timer;
593 	__le32 ba_escape_timer;
594 	__le32 ba_enable_beacon_abort;
595 	__le32 bf_threshold_absolute_low[2];
596 	__le32 bf_threshold_absolute_high[2];
597 } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
598 
599 /* Beacon filtering and beacon abort */
600 #define IWL_BF_ENERGY_DELTA_DEFAULT 5
601 #define IWL_BF_ENERGY_DELTA_D0I3 20
602 #define IWL_BF_ENERGY_DELTA_MAX 255
603 #define IWL_BF_ENERGY_DELTA_MIN 0
604 
605 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
606 #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
607 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
608 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
609 
610 #define IWL_BF_ROAMING_STATE_DEFAULT 72
611 #define IWL_BF_ROAMING_STATE_D0I3 72
612 #define IWL_BF_ROAMING_STATE_MAX 255
613 #define IWL_BF_ROAMING_STATE_MIN 0
614 
615 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
616 #define IWL_BF_TEMP_THRESHOLD_D0I3 112
617 #define IWL_BF_TEMP_THRESHOLD_MAX 255
618 #define IWL_BF_TEMP_THRESHOLD_MIN 0
619 
620 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
621 #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
622 #define IWL_BF_TEMP_FAST_FILTER_MAX 255
623 #define IWL_BF_TEMP_FAST_FILTER_MIN 0
624 
625 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
626 #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
627 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
628 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
629 
630 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
631 
632 #define IWL_BF_DEBUG_FLAG_DEFAULT 0
633 #define IWL_BF_DEBUG_FLAG_D0I3 0
634 
635 #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
636 #define IWL_BF_ESCAPE_TIMER_D0I3 0
637 #define IWL_BF_ESCAPE_TIMER_MAX 1024
638 #define IWL_BF_ESCAPE_TIMER_MIN 0
639 
640 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
641 #define IWL_BA_ESCAPE_TIMER_D0I3 6
642 #define IWL_BA_ESCAPE_TIMER_D3 9
643 #define IWL_BA_ESCAPE_TIMER_MAX 1024
644 #define IWL_BA_ESCAPE_TIMER_MIN 0
645 
646 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
647 
648 #define IWL_BF_CMD_CONFIG(mode)					     \
649 	.bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),	      \
650 	.bf_roaming_energy_delta =					      \
651 		cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),	      \
652 	.bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),	      \
653 	.bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
654 	.bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
655 	.bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
656 	.bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),	      \
657 	.bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),	      \
658 	.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
659 
660 #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
661 #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
662 #endif /* __iwl_fw_api_power_h__ */
663