xref: /openbmc/linux/drivers/net/wireless/intel/iwlwifi/fw/api/power.h (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
18e99ea8dSJohannes Berg /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
28e99ea8dSJohannes Berg /*
3b0aa02b3SAyala Barazani  * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
48e99ea8dSJohannes Berg  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
58e99ea8dSJohannes Berg  * Copyright (C) 2015-2017 Intel Deutschland GmbH
68e99ea8dSJohannes Berg  */
7d172a5efSJohannes Berg #ifndef __iwl_fw_api_power_h__
8d172a5efSJohannes Berg #define __iwl_fw_api_power_h__
9d172a5efSJohannes Berg 
10d172a5efSJohannes Berg /* Power Management Commands, Responses, Notifications */
11d172a5efSJohannes Berg 
12d172a5efSJohannes Berg /**
13d172a5efSJohannes Berg  * enum iwl_ltr_config_flags - masks for LTR config command flags
14d172a5efSJohannes Berg  * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
15d172a5efSJohannes Berg  * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
16d172a5efSJohannes Berg  *	memory access
17d172a5efSJohannes Berg  * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
18d172a5efSJohannes Berg  *	reg change
19d172a5efSJohannes Berg  * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
20d172a5efSJohannes Berg  *	D0 to D3
21d172a5efSJohannes Berg  * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
22d172a5efSJohannes Berg  * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
23d172a5efSJohannes Berg  * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
24d172a5efSJohannes Berg  * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
25d172a5efSJohannes Berg  *	idle timeout
26d172a5efSJohannes Berg  */
27d172a5efSJohannes Berg enum iwl_ltr_config_flags {
28d172a5efSJohannes Berg 	LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
29d172a5efSJohannes Berg 	LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
30d172a5efSJohannes Berg 	LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
31d172a5efSJohannes Berg 	LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
32d172a5efSJohannes Berg 	LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
33d172a5efSJohannes Berg 	LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
34d172a5efSJohannes Berg 	LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
35d172a5efSJohannes Berg 	LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
36d172a5efSJohannes Berg };
37d172a5efSJohannes Berg 
38d172a5efSJohannes Berg /**
39d172a5efSJohannes Berg  * struct iwl_ltr_config_cmd_v1 - configures the LTR
40d172a5efSJohannes Berg  * @flags: See &enum iwl_ltr_config_flags
41d172a5efSJohannes Berg  * @static_long: static LTR Long register value.
42d172a5efSJohannes Berg  * @static_short: static LTR Short register value.
43d172a5efSJohannes Berg  */
44d172a5efSJohannes Berg struct iwl_ltr_config_cmd_v1 {
45d172a5efSJohannes Berg 	__le32 flags;
46d172a5efSJohannes Berg 	__le32 static_long;
47d172a5efSJohannes Berg 	__le32 static_short;
48d172a5efSJohannes Berg } __packed; /* LTR_CAPABLE_API_S_VER_1 */
49d172a5efSJohannes Berg 
50d172a5efSJohannes Berg #define LTR_VALID_STATES_NUM 4
51d172a5efSJohannes Berg 
52d172a5efSJohannes Berg /**
53d172a5efSJohannes Berg  * struct iwl_ltr_config_cmd - configures the LTR
54d172a5efSJohannes Berg  * @flags: See &enum iwl_ltr_config_flags
55d172a5efSJohannes Berg  * @static_long: static LTR Long register value.
56d172a5efSJohannes Berg  * @static_short: static LTR Short register value.
57d172a5efSJohannes Berg  * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
58d172a5efSJohannes Berg  *	TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
59d172a5efSJohannes Berg  *	is set.
60d172a5efSJohannes Berg  * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
61d172a5efSJohannes Berg  *	%LTR_CFG_FLAG_UPDATE_VALUES is set.
62d172a5efSJohannes Berg  */
63d172a5efSJohannes Berg struct iwl_ltr_config_cmd {
64d172a5efSJohannes Berg 	__le32 flags;
65d172a5efSJohannes Berg 	__le32 static_long;
66d172a5efSJohannes Berg 	__le32 static_short;
67d172a5efSJohannes Berg 	__le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
68d172a5efSJohannes Berg 	__le32 ltr_short_idle_timeout;
69d172a5efSJohannes Berg } __packed; /* LTR_CAPABLE_API_S_VER_2 */
70d172a5efSJohannes Berg 
71d172a5efSJohannes Berg /* Radio LP RX Energy Threshold measured in dBm */
72d172a5efSJohannes Berg #define POWER_LPRX_RSSI_THRESHOLD	75
73d172a5efSJohannes Berg #define POWER_LPRX_RSSI_THRESHOLD_MAX	94
74d172a5efSJohannes Berg #define POWER_LPRX_RSSI_THRESHOLD_MIN	30
75d172a5efSJohannes Berg 
76d172a5efSJohannes Berg /**
77d172a5efSJohannes Berg  * enum iwl_power_flags - masks for power table command flags
78d172a5efSJohannes Berg  * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
79d172a5efSJohannes Berg  *		receiver and transmitter. '0' - does not allow.
80d172a5efSJohannes Berg  * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
81d172a5efSJohannes Berg  *		'1' Driver enables PM (use rest of parameters)
82d172a5efSJohannes Berg  * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
83d172a5efSJohannes Berg  *		'1' PM could sleep over DTIM till listen Interval.
84d172a5efSJohannes Berg  * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
85d172a5efSJohannes Berg  *		access categories are both delivery and trigger enabled.
86d172a5efSJohannes Berg  * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
87d172a5efSJohannes Berg  *		PBW Snoozing enabled
88d172a5efSJohannes Berg  * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
89d172a5efSJohannes Berg  * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
90d172a5efSJohannes Berg  * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
91d172a5efSJohannes Berg  *		detection enablement
92d172a5efSJohannes Berg */
93d172a5efSJohannes Berg enum iwl_power_flags {
94d172a5efSJohannes Berg 	POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
95d172a5efSJohannes Berg 	POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK	= BIT(1),
96d172a5efSJohannes Berg 	POWER_FLAGS_SKIP_OVER_DTIM_MSK		= BIT(2),
97d172a5efSJohannes Berg 	POWER_FLAGS_SNOOZE_ENA_MSK		= BIT(5),
98d172a5efSJohannes Berg 	POWER_FLAGS_BT_SCO_ENA			= BIT(8),
99d172a5efSJohannes Berg 	POWER_FLAGS_ADVANCE_PM_ENA_MSK		= BIT(9),
100d172a5efSJohannes Berg 	POWER_FLAGS_LPRX_ENA_MSK		= BIT(11),
101d172a5efSJohannes Berg 	POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK	= BIT(12),
102d172a5efSJohannes Berg };
103d172a5efSJohannes Berg 
104d172a5efSJohannes Berg #define IWL_POWER_VEC_SIZE 5
105d172a5efSJohannes Berg 
106d172a5efSJohannes Berg /**
107d172a5efSJohannes Berg  * struct iwl_powertable_cmd - legacy power command. Beside old API support this
108d172a5efSJohannes Berg  *	is used also with a new	power API for device wide power settings.
109d172a5efSJohannes Berg  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
110d172a5efSJohannes Berg  *
111d172a5efSJohannes Berg  * @flags:		Power table command flags from POWER_FLAGS_*
112d172a5efSJohannes Berg  * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
113d172a5efSJohannes Berg  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
114d172a5efSJohannes Berg  *			set regardless of power scheme or current power state.
115d172a5efSJohannes Berg  *			FW use this value also when PM is disabled.
116d172a5efSJohannes Berg  * @debug_flags:	debug flags
117d172a5efSJohannes Berg  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
118d172a5efSJohannes Berg  *			PSM transition - legacy PM
119d172a5efSJohannes Berg  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
120d172a5efSJohannes Berg  *			PSM transition - legacy PM
121d172a5efSJohannes Berg  * @sleep_interval:	not in use
122d172a5efSJohannes Berg  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
123d172a5efSJohannes Berg  *			is set. For example, if it is required to skip over
124d172a5efSJohannes Berg  *			one DTIM, this value need to be set to 2 (DTIM periods).
125d172a5efSJohannes Berg  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
126d172a5efSJohannes Berg  *			Default: 80dbm
127d172a5efSJohannes Berg  */
128d172a5efSJohannes Berg struct iwl_powertable_cmd {
129d172a5efSJohannes Berg 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
130d172a5efSJohannes Berg 	__le16 flags;
131d172a5efSJohannes Berg 	u8 keep_alive_seconds;
132d172a5efSJohannes Berg 	u8 debug_flags;
133d172a5efSJohannes Berg 	__le32 rx_data_timeout;
134d172a5efSJohannes Berg 	__le32 tx_data_timeout;
135d172a5efSJohannes Berg 	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
136d172a5efSJohannes Berg 	__le32 skip_dtim_periods;
137d172a5efSJohannes Berg 	__le32 lprx_rssi_threshold;
138d172a5efSJohannes Berg } __packed;
139d172a5efSJohannes Berg 
140d172a5efSJohannes Berg /**
141d172a5efSJohannes Berg  * enum iwl_device_power_flags - masks for device power command flags
142d172a5efSJohannes Berg  * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
143d172a5efSJohannes Berg  *	'1' Allow to save power by turning off
144d172a5efSJohannes Berg  *	receiver and transmitter. '0' - does not allow.
14548e775e6SHaim Dreyfuss  * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
14648e775e6SHaim Dreyfuss  *	Device Retention indication, '1' indicate retention is enabled.
14748e775e6SHaim Dreyfuss  * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
14848e775e6SHaim Dreyfuss  *	32Khz external slow clock valid indication, '1' indicate cloack is
14948e775e6SHaim Dreyfuss  *	valid.
150d172a5efSJohannes Berg */
151d172a5efSJohannes Berg enum iwl_device_power_flags {
152d172a5efSJohannes Berg 	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
15348e775e6SHaim Dreyfuss 	DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK	= BIT(1),
15448e775e6SHaim Dreyfuss 	DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK		= BIT(12),
155d172a5efSJohannes Berg };
156d172a5efSJohannes Berg 
157d172a5efSJohannes Berg /**
158d172a5efSJohannes Berg  * struct iwl_device_power_cmd - device wide power command.
159d172a5efSJohannes Berg  * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
160d172a5efSJohannes Berg  *
161d172a5efSJohannes Berg  * @flags:	Power table command flags from &enum iwl_device_power_flags
162d172a5efSJohannes Berg  * @reserved: reserved (padding)
163d172a5efSJohannes Berg  */
164d172a5efSJohannes Berg struct iwl_device_power_cmd {
165d172a5efSJohannes Berg 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
166d172a5efSJohannes Berg 	__le16 flags;
167d172a5efSJohannes Berg 	__le16 reserved;
168d172a5efSJohannes Berg } __packed;
169d172a5efSJohannes Berg 
170d172a5efSJohannes Berg /**
171d172a5efSJohannes Berg  * struct iwl_mac_power_cmd - New power command containing uAPSD support
172d172a5efSJohannes Berg  * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
173d172a5efSJohannes Berg  * @id_and_color:	MAC contex identifier, &enum iwl_ctxt_id_and_color
174d172a5efSJohannes Berg  * @flags:		Power table command flags from POWER_FLAGS_*
175d172a5efSJohannes Berg  * @keep_alive_seconds:	Keep alive period in seconds. Default - 25 sec.
176d172a5efSJohannes Berg  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
177d172a5efSJohannes Berg  *			set regardless of power scheme or current power state.
178d172a5efSJohannes Berg  *			FW use this value also when PM is disabled.
179d172a5efSJohannes Berg  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
180d172a5efSJohannes Berg  *			PSM transition - legacy PM
181d172a5efSJohannes Berg  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
182d172a5efSJohannes Berg  *			PSM transition - legacy PM
183d172a5efSJohannes Berg  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
184d172a5efSJohannes Berg  *			is set. For example, if it is required to skip over
185d172a5efSJohannes Berg  *			one DTIM, this value need to be set to 2 (DTIM periods).
186d172a5efSJohannes Berg  * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
187d172a5efSJohannes Berg  *			PSM transition - uAPSD
188d172a5efSJohannes Berg  * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
189d172a5efSJohannes Berg  *			PSM transition - uAPSD
190d172a5efSJohannes Berg  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
191d172a5efSJohannes Berg  *			Default: 80dbm
192d172a5efSJohannes Berg  * @snooze_interval:	Maximum time between attempts to retrieve buffered data
193d172a5efSJohannes Berg  *			from the AP [msec]
194d172a5efSJohannes Berg  * @snooze_window:	A window of time in which PBW snoozing insures that all
195d172a5efSJohannes Berg  *			packets received. It is also the minimum time from last
196d172a5efSJohannes Berg  *			received unicast RX packet, before client stops snoozing
197d172a5efSJohannes Berg  *			for data. [msec]
198d172a5efSJohannes Berg  * @snooze_step:	TBD
199d172a5efSJohannes Berg  * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
200d172a5efSJohannes Berg  * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
201d172a5efSJohannes Berg  *			each corresponding AC.
202d172a5efSJohannes Berg  *			Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
203d172a5efSJohannes Berg  * @uapsd_max_sp:	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
204d172a5efSJohannes Berg  *			values.
205d172a5efSJohannes Berg  * @heavy_tx_thld_packets:	TX threshold measured in number of packets
206d172a5efSJohannes Berg  * @heavy_rx_thld_packets:	RX threshold measured in number of packets
207d172a5efSJohannes Berg  * @heavy_tx_thld_percentage:	TX threshold measured in load's percentage
208d172a5efSJohannes Berg  * @heavy_rx_thld_percentage:	RX threshold measured in load's percentage
209d172a5efSJohannes Berg  * @limited_ps_threshold: (unused)
210d172a5efSJohannes Berg  * @reserved: reserved (padding)
211d172a5efSJohannes Berg  */
212d172a5efSJohannes Berg struct iwl_mac_power_cmd {
213d172a5efSJohannes Berg 	/* CONTEXT_DESC_API_T_VER_1 */
214d172a5efSJohannes Berg 	__le32 id_and_color;
215d172a5efSJohannes Berg 
216d172a5efSJohannes Berg 	/* CLIENT_PM_POWER_TABLE_S_VER_1 */
217d172a5efSJohannes Berg 	__le16 flags;
218d172a5efSJohannes Berg 	__le16 keep_alive_seconds;
219d172a5efSJohannes Berg 	__le32 rx_data_timeout;
220d172a5efSJohannes Berg 	__le32 tx_data_timeout;
221d172a5efSJohannes Berg 	__le32 rx_data_timeout_uapsd;
222d172a5efSJohannes Berg 	__le32 tx_data_timeout_uapsd;
223d172a5efSJohannes Berg 	u8 lprx_rssi_threshold;
224d172a5efSJohannes Berg 	u8 skip_dtim_periods;
225d172a5efSJohannes Berg 	__le16 snooze_interval;
226d172a5efSJohannes Berg 	__le16 snooze_window;
227d172a5efSJohannes Berg 	u8 snooze_step;
228d172a5efSJohannes Berg 	u8 qndp_tid;
229d172a5efSJohannes Berg 	u8 uapsd_ac_flags;
230d172a5efSJohannes Berg 	u8 uapsd_max_sp;
231d172a5efSJohannes Berg 	u8 heavy_tx_thld_packets;
232d172a5efSJohannes Berg 	u8 heavy_rx_thld_packets;
233d172a5efSJohannes Berg 	u8 heavy_tx_thld_percentage;
234d172a5efSJohannes Berg 	u8 heavy_rx_thld_percentage;
235d172a5efSJohannes Berg 	u8 limited_ps_threshold;
236d172a5efSJohannes Berg 	u8 reserved;
237d172a5efSJohannes Berg } __packed;
238d172a5efSJohannes Berg 
239d172a5efSJohannes Berg /*
240d172a5efSJohannes Berg  * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
241d172a5efSJohannes Berg  * associated AP is identified as improperly implementing uAPSD protocol.
242d172a5efSJohannes Berg  * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
243d172a5efSJohannes Berg  * @sta_id: index of station in uCode's station table - associated AP ID in
244d172a5efSJohannes Berg  *	    this context.
245d172a5efSJohannes Berg  */
246d172a5efSJohannes Berg struct iwl_uapsd_misbehaving_ap_notif {
247d172a5efSJohannes Berg 	__le32 sta_id;
248d172a5efSJohannes Berg 	u8 mac_id;
249d172a5efSJohannes Berg 	u8 reserved[3];
250d172a5efSJohannes Berg } __packed;
251d172a5efSJohannes Berg 
252d172a5efSJohannes Berg /**
253d172a5efSJohannes Berg  * struct iwl_reduce_tx_power_cmd - TX power reduction command
254d172a5efSJohannes Berg  * REDUCE_TX_POWER_CMD = 0x9f
255d172a5efSJohannes Berg  * @flags: (reserved for future implementation)
256d172a5efSJohannes Berg  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
257d172a5efSJohannes Berg  * @pwr_restriction: TX power restriction in dBms.
258d172a5efSJohannes Berg  */
259d172a5efSJohannes Berg struct iwl_reduce_tx_power_cmd {
260d172a5efSJohannes Berg 	u8 flags;
261d172a5efSJohannes Berg 	u8 mac_context_id;
262d172a5efSJohannes Berg 	__le16 pwr_restriction;
263d172a5efSJohannes Berg } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
264d172a5efSJohannes Berg 
265d172a5efSJohannes Berg enum iwl_dev_tx_power_cmd_mode {
266d172a5efSJohannes Berg 	IWL_TX_POWER_MODE_SET_MAC = 0,
267d172a5efSJohannes Berg 	IWL_TX_POWER_MODE_SET_DEVICE = 1,
268d172a5efSJohannes Berg 	IWL_TX_POWER_MODE_SET_CHAINS = 2,
269d172a5efSJohannes Berg 	IWL_TX_POWER_MODE_SET_ACK = 3,
2700791c2fcSHaim Dreyfuss 	IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
2710791c2fcSHaim Dreyfuss 	IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
2720791c2fcSHaim Dreyfuss }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
273d172a5efSJohannes Berg 
2749c08cef8SLuca Coelho #define IWL_NUM_CHAIN_TABLES	1
275fbb7957dSLuca Coelho #define IWL_NUM_CHAIN_TABLES_V2	2
276d172a5efSJohannes Berg #define IWL_NUM_CHAIN_LIMITS	2
277e12cfc7bSMiri Korenblit #define IWL_NUM_SUB_BANDS_V1	5
278f2134f66SGil Adam #define IWL_NUM_SUB_BANDS_V2	11
279d172a5efSJohannes Berg 
280d172a5efSJohannes Berg /**
281216cdfb5SLuca Coelho  * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd
282d172a5efSJohannes Berg  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
283d172a5efSJohannes Berg  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
284d172a5efSJohannes Berg  * @pwr_restriction: TX power restriction in 1/8 dBms.
285d172a5efSJohannes Berg  * @dev_24: device TX power restriction in 1/8 dBms
286d172a5efSJohannes Berg  * @dev_52_low: device TX power restriction upper band - low
287d172a5efSJohannes Berg  * @dev_52_high: device TX power restriction upper band - high
288d172a5efSJohannes Berg  */
289216cdfb5SLuca Coelho struct iwl_dev_tx_power_common {
290d172a5efSJohannes Berg 	__le32 set_mode;
291d172a5efSJohannes Berg 	__le32 mac_context_id;
292d172a5efSJohannes Berg 	__le16 pwr_restriction;
293d172a5efSJohannes Berg 	__le16 dev_24;
294d172a5efSJohannes Berg 	__le16 dev_52_low;
295d172a5efSJohannes Berg 	__le16 dev_52_high;
296216cdfb5SLuca Coelho };
297216cdfb5SLuca Coelho 
298216cdfb5SLuca Coelho /**
299216cdfb5SLuca Coelho  * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
300216cdfb5SLuca Coelho  * @per_chain: per chain restrictions
301216cdfb5SLuca Coelho  */
302216cdfb5SLuca Coelho struct iwl_dev_tx_power_cmd_v3 {
303e12cfc7bSMiri Korenblit 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
304d172a5efSJohannes Berg } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
305d172a5efSJohannes Berg 
306d172a5efSJohannes Berg #define IWL_DEV_MAX_TX_POWER 0x7FFF
307d172a5efSJohannes Berg 
308d172a5efSJohannes Berg /**
309216cdfb5SLuca Coelho  * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4
310216cdfb5SLuca Coelho  * @per_chain: per chain restrictions
311d172a5efSJohannes Berg  * @enable_ack_reduction: enable or disable close range ack TX power
312d172a5efSJohannes Berg  *	reduction.
313d172a5efSJohannes Berg  * @reserved: reserved (padding)
314d172a5efSJohannes Berg  */
3150791c2fcSHaim Dreyfuss struct iwl_dev_tx_power_cmd_v4 {
316e12cfc7bSMiri Korenblit 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
317d172a5efSJohannes Berg 	u8 enable_ack_reduction;
318d172a5efSJohannes Berg 	u8 reserved[3];
319d172a5efSJohannes Berg } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
320d172a5efSJohannes Berg 
3210791c2fcSHaim Dreyfuss /**
322216cdfb5SLuca Coelho  * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
323216cdfb5SLuca Coelho  * @per_chain: per chain restrictions
3240791c2fcSHaim Dreyfuss  * @enable_ack_reduction: enable or disable close range ack TX power
3250791c2fcSHaim Dreyfuss  *	reduction.
3260791c2fcSHaim Dreyfuss  * @per_chain_restriction_changed: is per_chain_restriction has changed
3270791c2fcSHaim Dreyfuss  *	from last command. used if set_mode is
3280791c2fcSHaim Dreyfuss  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
3290791c2fcSHaim Dreyfuss  *	note: if not changed, the command is used for keep alive only.
3300791c2fcSHaim Dreyfuss  * @reserved: reserved (padding)
3310791c2fcSHaim Dreyfuss  * @timer_period: timer in milliseconds. if expires FW will change to default
3320791c2fcSHaim Dreyfuss  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
3330791c2fcSHaim Dreyfuss  */
334216cdfb5SLuca Coelho struct iwl_dev_tx_power_cmd_v5 {
335e12cfc7bSMiri Korenblit 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
3360791c2fcSHaim Dreyfuss 	u8 enable_ack_reduction;
3370791c2fcSHaim Dreyfuss 	u8 per_chain_restriction_changed;
3380791c2fcSHaim Dreyfuss 	u8 reserved[2];
3390791c2fcSHaim Dreyfuss 	__le32 timer_period;
3400791c2fcSHaim Dreyfuss } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
3410791c2fcSHaim Dreyfuss 
342216cdfb5SLuca Coelho /**
343b0aa02b3SAyala Barazani  * struct iwl_dev_tx_power_cmd_v6 - TX power reduction command version 6
344fbb7957dSLuca Coelho  * @per_chain: per chain restrictions
345fbb7957dSLuca Coelho  * @enable_ack_reduction: enable or disable close range ack TX power
346fbb7957dSLuca Coelho  *	reduction.
347fbb7957dSLuca Coelho  * @per_chain_restriction_changed: is per_chain_restriction has changed
348fbb7957dSLuca Coelho  *	from last command. used if set_mode is
349fbb7957dSLuca Coelho  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
350fbb7957dSLuca Coelho  *	note: if not changed, the command is used for keep alive only.
351fbb7957dSLuca Coelho  * @reserved: reserved (padding)
352fbb7957dSLuca Coelho  * @timer_period: timer in milliseconds. if expires FW will change to default
353fbb7957dSLuca Coelho  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
354fbb7957dSLuca Coelho  */
355fbb7957dSLuca Coelho struct iwl_dev_tx_power_cmd_v6 {
356fbb7957dSLuca Coelho 	__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
357fbb7957dSLuca Coelho 	u8 enable_ack_reduction;
358fbb7957dSLuca Coelho 	u8 per_chain_restriction_changed;
359fbb7957dSLuca Coelho 	u8 reserved[2];
360fbb7957dSLuca Coelho 	__le32 timer_period;
361fbb7957dSLuca Coelho } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
362fbb7957dSLuca Coelho 
363fbb7957dSLuca Coelho /**
364b0aa02b3SAyala Barazani  * struct iwl_dev_tx_power_cmd_v7 - TX power reduction command version 7
365b0aa02b3SAyala Barazani  * @per_chain: per chain restrictions
366b0aa02b3SAyala Barazani  * @enable_ack_reduction: enable or disable close range ack TX power
367b0aa02b3SAyala Barazani  *	reduction.
368b0aa02b3SAyala Barazani  * @per_chain_restriction_changed: is per_chain_restriction has changed
369b0aa02b3SAyala Barazani  *	from last command. used if set_mode is
370b0aa02b3SAyala Barazani  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
371b0aa02b3SAyala Barazani  *	note: if not changed, the command is used for keep alive only.
372b0aa02b3SAyala Barazani  * @reserved: reserved (padding)
373b0aa02b3SAyala Barazani  * @timer_period: timer in milliseconds. if expires FW will change to default
374b0aa02b3SAyala Barazani  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
375b0aa02b3SAyala Barazani  * @flags: reduce power flags.
376b0aa02b3SAyala Barazani  */
377b0aa02b3SAyala Barazani struct iwl_dev_tx_power_cmd_v7 {
378b0aa02b3SAyala Barazani 	__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
379b0aa02b3SAyala Barazani 	u8 enable_ack_reduction;
380b0aa02b3SAyala Barazani 	u8 per_chain_restriction_changed;
381b0aa02b3SAyala Barazani 	u8 reserved[2];
382b0aa02b3SAyala Barazani 	__le32 timer_period;
383b0aa02b3SAyala Barazani 	__le32 flags;
384b0aa02b3SAyala Barazani } __packed; /* TX_REDUCED_POWER_API_S_VER_7 */
385b0aa02b3SAyala Barazani /**
386216cdfb5SLuca Coelho  * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
387216cdfb5SLuca Coelho  * @common: common part of the command
388216cdfb5SLuca Coelho  * @v3: version 3 part of the command
389216cdfb5SLuca Coelho  * @v4: version 4 part of the command
390216cdfb5SLuca Coelho  * @v5: version 5 part of the command
391fbb7957dSLuca Coelho  * @v6: version 6 part of the command
392216cdfb5SLuca Coelho  */
393216cdfb5SLuca Coelho struct iwl_dev_tx_power_cmd {
394216cdfb5SLuca Coelho 	struct iwl_dev_tx_power_common common;
395216cdfb5SLuca Coelho 	union {
396216cdfb5SLuca Coelho 		struct iwl_dev_tx_power_cmd_v3 v3;
397216cdfb5SLuca Coelho 		struct iwl_dev_tx_power_cmd_v4 v4;
398216cdfb5SLuca Coelho 		struct iwl_dev_tx_power_cmd_v5 v5;
399fbb7957dSLuca Coelho 		struct iwl_dev_tx_power_cmd_v6 v6;
400b0aa02b3SAyala Barazani 		struct iwl_dev_tx_power_cmd_v7 v7;
401216cdfb5SLuca Coelho 	};
402216cdfb5SLuca Coelho };
403216cdfb5SLuca Coelho 
404d172a5efSJohannes Berg #define IWL_NUM_GEO_PROFILES		3
40597f8a3d1SAyala Barazani #define IWL_NUM_GEO_PROFILES_V3		8
4060ea788edSLuca Coelho #define IWL_NUM_BANDS_PER_CHAIN_V1	2
4070ea788edSLuca Coelho #define IWL_NUM_BANDS_PER_CHAIN_V2	3
408d172a5efSJohannes Berg 
409d172a5efSJohannes Berg /**
410d172a5efSJohannes Berg  * enum iwl_geo_per_chain_offset_operation - type of operation
411d172a5efSJohannes Berg  * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
412d172a5efSJohannes Berg  * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
413d172a5efSJohannes Berg  */
414d172a5efSJohannes Berg enum iwl_geo_per_chain_offset_operation {
415d172a5efSJohannes Berg 	IWL_PER_CHAIN_OFFSET_SET_TABLES,
416d172a5efSJohannes Berg 	IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
417523de6c8SLuca Coelho };  /* PER_CHAIN_OFFSET_OPERATION_E */
418d172a5efSJohannes Berg 
419d172a5efSJohannes Berg /**
420523de6c8SLuca Coelho  * struct iwl_per_chain_offset - embedded struct for PER_CHAIN_LIMIT_OFFSET_CMD.
421d172a5efSJohannes Berg  * @max_tx_power: maximum allowed tx power.
422d172a5efSJohannes Berg  * @chain_a: tx power offset for chain a.
423d172a5efSJohannes Berg  * @chain_b: tx power offset for chain b.
424d172a5efSJohannes Berg  */
425d172a5efSJohannes Berg struct iwl_per_chain_offset {
426d172a5efSJohannes Berg 	__le16 max_tx_power;
427d172a5efSJohannes Berg 	u8 chain_a;
428d172a5efSJohannes Berg 	u8 chain_b;
429d172a5efSJohannes Berg } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
430d172a5efSJohannes Berg 
431d172a5efSJohannes Berg /**
432523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profile_cmd_v1 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
4330c3d7282SHaim Dreyfuss  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
4340c3d7282SHaim Dreyfuss  * @table: offset profile per band.
4350c3d7282SHaim Dreyfuss  */
4360c3d7282SHaim Dreyfuss struct iwl_geo_tx_power_profiles_cmd_v1 {
4370c3d7282SHaim Dreyfuss 	__le32 ops;
4380ea788edSLuca Coelho 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
439523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_1 */
4400c3d7282SHaim Dreyfuss 
4410c3d7282SHaim Dreyfuss /**
442523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profile_cmd_v2 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
443d172a5efSJohannes Berg  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
444d172a5efSJohannes Berg  * @table: offset profile per band.
445ac9952f6SLuca Coelho  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
446d172a5efSJohannes Berg  */
447dd2a1256SLuca Coelho struct iwl_geo_tx_power_profiles_cmd_v2 {
448d172a5efSJohannes Berg 	__le32 ops;
4490ea788edSLuca Coelho 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
4500c3d7282SHaim Dreyfuss 	__le32 table_revision;
451523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_2 */
452dd2a1256SLuca Coelho 
4530ea788edSLuca Coelho /**
454523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profile_cmd_v3 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
4550ea788edSLuca Coelho  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
4560ea788edSLuca Coelho  * @table: offset profile per band.
457ac9952f6SLuca Coelho  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
4580ea788edSLuca Coelho  */
4590ea788edSLuca Coelho struct iwl_geo_tx_power_profiles_cmd_v3 {
4600ea788edSLuca Coelho 	__le32 ops;
4610ea788edSLuca Coelho 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2];
4620ea788edSLuca Coelho 	__le32 table_revision;
463523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_3 */
4640ea788edSLuca Coelho 
46597f8a3d1SAyala Barazani /**
466523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profile_cmd_v4 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
46797f8a3d1SAyala Barazani  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
46897f8a3d1SAyala Barazani  * @table: offset profile per band.
469ac9952f6SLuca Coelho  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
47097f8a3d1SAyala Barazani  */
47197f8a3d1SAyala Barazani struct iwl_geo_tx_power_profiles_cmd_v4 {
47297f8a3d1SAyala Barazani 	__le32 ops;
47397f8a3d1SAyala Barazani 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V1];
47497f8a3d1SAyala Barazani 	__le32 table_revision;
475523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_4 */
47697f8a3d1SAyala Barazani 
47797f8a3d1SAyala Barazani /**
478523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profile_cmd_v5 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
47997f8a3d1SAyala Barazani  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
48097f8a3d1SAyala Barazani  * @table: offset profile per band.
481ac9952f6SLuca Coelho  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
48297f8a3d1SAyala Barazani  */
48397f8a3d1SAyala Barazani struct iwl_geo_tx_power_profiles_cmd_v5 {
48497f8a3d1SAyala Barazani 	__le32 ops;
48597f8a3d1SAyala Barazani 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V2];
48697f8a3d1SAyala Barazani 	__le32 table_revision;
487523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_5 */
48897f8a3d1SAyala Barazani 
489dd2a1256SLuca Coelho union iwl_geo_tx_power_profiles_cmd {
490dd2a1256SLuca Coelho 	struct iwl_geo_tx_power_profiles_cmd_v1 v1;
491dd2a1256SLuca Coelho 	struct iwl_geo_tx_power_profiles_cmd_v2 v2;
4920ea788edSLuca Coelho 	struct iwl_geo_tx_power_profiles_cmd_v3 v3;
49397f8a3d1SAyala Barazani 	struct iwl_geo_tx_power_profiles_cmd_v4 v4;
49497f8a3d1SAyala Barazani 	struct iwl_geo_tx_power_profiles_cmd_v5 v5;
495dd2a1256SLuca Coelho };
496d172a5efSJohannes Berg 
497d172a5efSJohannes Berg /**
498523de6c8SLuca Coelho  * struct iwl_geo_tx_power_profiles_resp -  response to PER_CHAIN_LIMIT_OFFSET_CMD cmd
499d172a5efSJohannes Berg  * @profile_idx: current geo profile in use
500d172a5efSJohannes Berg  */
501d172a5efSJohannes Berg struct iwl_geo_tx_power_profiles_resp {
502d172a5efSJohannes Berg 	__le32 profile_idx;
503523de6c8SLuca Coelho } __packed; /* PER_CHAIN_LIMIT_OFFSET_RSP */
504d172a5efSJohannes Berg 
505d172a5efSJohannes Berg /**
506f2134f66SGil Adam  * union iwl_ppag_table_cmd - union for all versions of PPAG command
507e12cfc7bSMiri Korenblit  * @v1: version 1
508e12cfc7bSMiri Korenblit  * @v2: version 2
509f2134f66SGil Adam  *
510e12cfc7bSMiri Korenblit  * @flags: bit 0 - indicates enablement of PPAG for ETSI
511e12cfc7bSMiri Korenblit  *         bit 1 - indicates enablement of PPAG for CHINA BIOS
512e12cfc7bSMiri Korenblit  *         bit 1 can be used only in v3 (identical to v2)
5136ce1e5c0SGil Adam  * @gain: table of antenna gain values per chain and sub-band
5146ce1e5c0SGil Adam  * @reserved: reserved
5156ce1e5c0SGil Adam  */
516f2134f66SGil Adam union iwl_ppag_table_cmd {
517f2134f66SGil Adam 	struct {
518e12cfc7bSMiri Korenblit 		__le32 flags;
519e12cfc7bSMiri Korenblit 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
5206ce1e5c0SGil Adam 		s8 reserved[2];
521f2134f66SGil Adam 	} v1;
522f2134f66SGil Adam 	struct {
523e12cfc7bSMiri Korenblit 		__le32 flags;
524f2134f66SGil Adam 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
525f2134f66SGil Adam 		s8 reserved[2];
526f2134f66SGil Adam 	} v2;
527f2134f66SGil Adam } __packed;
5286ce1e5c0SGil Adam 
529c593d2faSAyala Barazani #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE	26
530c593d2faSAyala Barazani #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE	13
531c593d2faSAyala Barazani 
532c593d2faSAyala Barazani /**
533c593d2faSAyala Barazani  * struct iwl_sar_offset_mapping_cmd - struct for SAR_OFFSET_MAPPING_TABLE_CMD
534c593d2faSAyala Barazani  * @offset_map: mapping a mcc to a geo sar group
535c593d2faSAyala Barazani  * @reserved: reserved
536c593d2faSAyala Barazani  */
537c593d2faSAyala Barazani struct iwl_sar_offset_mapping_cmd {
538c593d2faSAyala Barazani 	u8 offset_map[MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE]
539c593d2faSAyala Barazani 		[MCC_TO_SAR_OFFSET_TABLE_COL_SIZE];
540*11b60071SJohannes Berg 	__le16 reserved;
541c593d2faSAyala Barazani } __packed; /*SAR_OFFSET_MAPPING_TABLE_CMD_API_S*/
542c593d2faSAyala Barazani 
5436ce1e5c0SGil Adam /**
544d172a5efSJohannes Berg  * struct iwl_beacon_filter_cmd
545d172a5efSJohannes Berg  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
546d172a5efSJohannes Berg  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
547d172a5efSJohannes Berg  *      to driver if delta in Energy values calculated for this and last
548d172a5efSJohannes Berg  *      passed beacon is greater than this threshold. Zero value means that
549d172a5efSJohannes Berg  *      the Energy change is ignored for beacon filtering, and beacon will
550d172a5efSJohannes Berg  *      not be forced to be sent to driver regardless of this delta. Typical
551d172a5efSJohannes Berg  *      energy delta 5dB.
552d172a5efSJohannes Berg  * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
553d172a5efSJohannes Berg  *      Send beacon to driver if delta in Energy values calculated for this
554d172a5efSJohannes Berg  *      and last passed beacon is greater than this threshold. Zero value
555d172a5efSJohannes Berg  *      means that the Energy change is ignored for beacon filtering while in
556d172a5efSJohannes Berg  *      Roaming state, typical energy delta 1dB.
557d172a5efSJohannes Berg  * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
558d172a5efSJohannes Berg  *      calculated for current beacon is less than the threshold, use
559d172a5efSJohannes Berg  *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
560d172a5efSJohannes Berg  *      Threshold. Typical energy threshold is -72dBm.
561d172a5efSJohannes Berg  * @bf_temp_threshold: This threshold determines the type of temperature
562d172a5efSJohannes Berg  *	filtering (Slow or Fast) that is selected (Units are in Celsuis):
563d172a5efSJohannes Berg  *	If the current temperature is above this threshold - Fast filter
564d172a5efSJohannes Berg  *	will be used, If the current temperature is below this threshold -
565d172a5efSJohannes Berg  *	Slow filter will be used.
566d172a5efSJohannes Berg  * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
567d172a5efSJohannes Berg  *      calculated for this and the last passed beacon is greater than this
568d172a5efSJohannes Berg  *      threshold. Zero value means that the temperature change is ignored for
569d172a5efSJohannes Berg  *      beacon filtering; beacons will not be  forced to be sent to driver
570d172a5efSJohannes Berg  *      regardless of whether its temerature has been changed.
571d172a5efSJohannes Berg  * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
572d172a5efSJohannes Berg  *      calculated for this and the last passed beacon is greater than this
573d172a5efSJohannes Berg  *      threshold. Zero value means that the temperature change is ignored for
574d172a5efSJohannes Berg  *      beacon filtering; beacons will not be forced to be sent to driver
575d172a5efSJohannes Berg  *      regardless of whether its temerature has been changed.
576d172a5efSJohannes Berg  * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
577d172a5efSJohannes Berg  * @bf_debug_flag: beacon filtering debug configuration
578d172a5efSJohannes Berg  * @bf_escape_timer: Send beacons to to driver if no beacons were passed
579d172a5efSJohannes Berg  *      for a specific period of time. Units: Beacons.
580d172a5efSJohannes Berg  * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
581d172a5efSJohannes Berg  *      for a longer period of time then this escape-timeout. Units: Beacons.
582d172a5efSJohannes Berg  * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
583537ea3bbSAvigail Grinstein  * @bf_threshold_absolute_low: See below.
584537ea3bbSAvigail Grinstein  * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
585537ea3bbSAvigail Grinstein  *      for this beacon crossed this absolute threshold. For the 'Increase'
586537ea3bbSAvigail Grinstein  *      direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
587537ea3bbSAvigail Grinstein  *      direction the bf_energy_absolute_high[i] is used. Zero value means
588537ea3bbSAvigail Grinstein  *      that this specific threshold is ignored for beacon filtering, and
589537ea3bbSAvigail Grinstein  *      beacon will not be forced to be sent to driver due to this setting.
590d172a5efSJohannes Berg  */
591d172a5efSJohannes Berg struct iwl_beacon_filter_cmd {
592d172a5efSJohannes Berg 	__le32 bf_energy_delta;
593d172a5efSJohannes Berg 	__le32 bf_roaming_energy_delta;
594d172a5efSJohannes Berg 	__le32 bf_roaming_state;
595d172a5efSJohannes Berg 	__le32 bf_temp_threshold;
596d172a5efSJohannes Berg 	__le32 bf_temp_fast_filter;
597d172a5efSJohannes Berg 	__le32 bf_temp_slow_filter;
598d172a5efSJohannes Berg 	__le32 bf_enable_beacon_filter;
599d172a5efSJohannes Berg 	__le32 bf_debug_flag;
600d172a5efSJohannes Berg 	__le32 bf_escape_timer;
601d172a5efSJohannes Berg 	__le32 ba_escape_timer;
602d172a5efSJohannes Berg 	__le32 ba_enable_beacon_abort;
603537ea3bbSAvigail Grinstein 	__le32 bf_threshold_absolute_low[2];
604537ea3bbSAvigail Grinstein 	__le32 bf_threshold_absolute_high[2];
605537ea3bbSAvigail Grinstein } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
606d172a5efSJohannes Berg 
607d172a5efSJohannes Berg /* Beacon filtering and beacon abort */
608d172a5efSJohannes Berg #define IWL_BF_ENERGY_DELTA_DEFAULT 5
609d172a5efSJohannes Berg #define IWL_BF_ENERGY_DELTA_D0I3 20
610d172a5efSJohannes Berg #define IWL_BF_ENERGY_DELTA_MAX 255
611d172a5efSJohannes Berg #define IWL_BF_ENERGY_DELTA_MIN 0
612d172a5efSJohannes Berg 
613d172a5efSJohannes Berg #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
614d172a5efSJohannes Berg #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
615d172a5efSJohannes Berg #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
616d172a5efSJohannes Berg #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
617d172a5efSJohannes Berg 
618d172a5efSJohannes Berg #define IWL_BF_ROAMING_STATE_DEFAULT 72
619d172a5efSJohannes Berg #define IWL_BF_ROAMING_STATE_D0I3 72
620d172a5efSJohannes Berg #define IWL_BF_ROAMING_STATE_MAX 255
621d172a5efSJohannes Berg #define IWL_BF_ROAMING_STATE_MIN 0
622d172a5efSJohannes Berg 
623d172a5efSJohannes Berg #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
624d172a5efSJohannes Berg #define IWL_BF_TEMP_THRESHOLD_D0I3 112
625d172a5efSJohannes Berg #define IWL_BF_TEMP_THRESHOLD_MAX 255
626d172a5efSJohannes Berg #define IWL_BF_TEMP_THRESHOLD_MIN 0
627d172a5efSJohannes Berg 
628d172a5efSJohannes Berg #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
629d172a5efSJohannes Berg #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
630d172a5efSJohannes Berg #define IWL_BF_TEMP_FAST_FILTER_MAX 255
631d172a5efSJohannes Berg #define IWL_BF_TEMP_FAST_FILTER_MIN 0
632d172a5efSJohannes Berg 
633d172a5efSJohannes Berg #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
634d172a5efSJohannes Berg #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
635d172a5efSJohannes Berg #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
636d172a5efSJohannes Berg #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
637d172a5efSJohannes Berg 
638d172a5efSJohannes Berg #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
639d172a5efSJohannes Berg 
640d172a5efSJohannes Berg #define IWL_BF_DEBUG_FLAG_DEFAULT 0
641d172a5efSJohannes Berg #define IWL_BF_DEBUG_FLAG_D0I3 0
642d172a5efSJohannes Berg 
643d172a5efSJohannes Berg #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
644d172a5efSJohannes Berg #define IWL_BF_ESCAPE_TIMER_D0I3 0
645d172a5efSJohannes Berg #define IWL_BF_ESCAPE_TIMER_MAX 1024
646d172a5efSJohannes Berg #define IWL_BF_ESCAPE_TIMER_MIN 0
647d172a5efSJohannes Berg 
648d172a5efSJohannes Berg #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
649d172a5efSJohannes Berg #define IWL_BA_ESCAPE_TIMER_D0I3 6
650d172a5efSJohannes Berg #define IWL_BA_ESCAPE_TIMER_D3 9
651d172a5efSJohannes Berg #define IWL_BA_ESCAPE_TIMER_MAX 1024
652d172a5efSJohannes Berg #define IWL_BA_ESCAPE_TIMER_MIN 0
653d172a5efSJohannes Berg 
654d172a5efSJohannes Berg #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
655d172a5efSJohannes Berg 
656d172a5efSJohannes Berg #define IWL_BF_CMD_CONFIG(mode)					     \
657d172a5efSJohannes Berg 	.bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),	      \
658d172a5efSJohannes Berg 	.bf_roaming_energy_delta =					      \
659d172a5efSJohannes Berg 		cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),	      \
660d172a5efSJohannes Berg 	.bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),	      \
661d172a5efSJohannes Berg 	.bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
662d172a5efSJohannes Berg 	.bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
663d172a5efSJohannes Berg 	.bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
664d172a5efSJohannes Berg 	.bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),	      \
665d172a5efSJohannes Berg 	.bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),	      \
666d172a5efSJohannes Berg 	.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
667d172a5efSJohannes Berg 
668d172a5efSJohannes Berg #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
669d172a5efSJohannes Berg #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
670d172a5efSJohannes Berg #endif /* __iwl_fw_api_power_h__ */
671