xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/power.h (revision fac1f59384114a3fe14076815fc4ede68d6bb1ba)
1bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2bfcc09ddSBjoern A. Zeeb /*
3*fac1f593SBjoern A. Zeeb  * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
4bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
5bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2015-2017 Intel Deutschland GmbH
6bfcc09ddSBjoern A. Zeeb  */
7bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_power_h__
8bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_power_h__
9bfcc09ddSBjoern A. Zeeb 
10bfcc09ddSBjoern A. Zeeb /* Power Management Commands, Responses, Notifications */
11bfcc09ddSBjoern A. Zeeb 
12bfcc09ddSBjoern A. Zeeb /**
13bfcc09ddSBjoern A. Zeeb  * enum iwl_ltr_config_flags - masks for LTR config command flags
14bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
15bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
16bfcc09ddSBjoern A. Zeeb  *	memory access
17bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
18bfcc09ddSBjoern A. Zeeb  *	reg change
19bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
20bfcc09ddSBjoern A. Zeeb  *	D0 to D3
21bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
22bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
23bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
24bfcc09ddSBjoern A. Zeeb  * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
25bfcc09ddSBjoern A. Zeeb  *	idle timeout
26bfcc09ddSBjoern A. Zeeb  */
27bfcc09ddSBjoern A. Zeeb enum iwl_ltr_config_flags {
28bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
29bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
30bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
31bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
32bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
33bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
34bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
35bfcc09ddSBjoern A. Zeeb 	LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
36bfcc09ddSBjoern A. Zeeb };
37bfcc09ddSBjoern A. Zeeb 
38bfcc09ddSBjoern A. Zeeb /**
39bfcc09ddSBjoern A. Zeeb  * struct iwl_ltr_config_cmd_v1 - configures the LTR
40bfcc09ddSBjoern A. Zeeb  * @flags: See &enum iwl_ltr_config_flags
41bfcc09ddSBjoern A. Zeeb  * @static_long: static LTR Long register value.
42bfcc09ddSBjoern A. Zeeb  * @static_short: static LTR Short register value.
43bfcc09ddSBjoern A. Zeeb  */
44bfcc09ddSBjoern A. Zeeb struct iwl_ltr_config_cmd_v1 {
45bfcc09ddSBjoern A. Zeeb 	__le32 flags;
46bfcc09ddSBjoern A. Zeeb 	__le32 static_long;
47bfcc09ddSBjoern A. Zeeb 	__le32 static_short;
48bfcc09ddSBjoern A. Zeeb } __packed; /* LTR_CAPABLE_API_S_VER_1 */
49bfcc09ddSBjoern A. Zeeb 
50bfcc09ddSBjoern A. Zeeb #define LTR_VALID_STATES_NUM 4
51bfcc09ddSBjoern A. Zeeb 
52bfcc09ddSBjoern A. Zeeb /**
53bfcc09ddSBjoern A. Zeeb  * struct iwl_ltr_config_cmd - configures the LTR
54bfcc09ddSBjoern A. Zeeb  * @flags: See &enum iwl_ltr_config_flags
55bfcc09ddSBjoern A. Zeeb  * @static_long: static LTR Long register value.
56bfcc09ddSBjoern A. Zeeb  * @static_short: static LTR Short register value.
57bfcc09ddSBjoern A. Zeeb  * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
58bfcc09ddSBjoern A. Zeeb  *	TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
59bfcc09ddSBjoern A. Zeeb  *	is set.
60bfcc09ddSBjoern A. Zeeb  * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
61bfcc09ddSBjoern A. Zeeb  *	%LTR_CFG_FLAG_UPDATE_VALUES is set.
62bfcc09ddSBjoern A. Zeeb  */
63bfcc09ddSBjoern A. Zeeb struct iwl_ltr_config_cmd {
64bfcc09ddSBjoern A. Zeeb 	__le32 flags;
65bfcc09ddSBjoern A. Zeeb 	__le32 static_long;
66bfcc09ddSBjoern A. Zeeb 	__le32 static_short;
67bfcc09ddSBjoern A. Zeeb 	__le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
68bfcc09ddSBjoern A. Zeeb 	__le32 ltr_short_idle_timeout;
69bfcc09ddSBjoern A. Zeeb } __packed; /* LTR_CAPABLE_API_S_VER_2 */
70bfcc09ddSBjoern A. Zeeb 
71bfcc09ddSBjoern A. Zeeb /* Radio LP RX Energy Threshold measured in dBm */
72bfcc09ddSBjoern A. Zeeb #define POWER_LPRX_RSSI_THRESHOLD	75
73bfcc09ddSBjoern A. Zeeb #define POWER_LPRX_RSSI_THRESHOLD_MAX	94
74bfcc09ddSBjoern A. Zeeb #define POWER_LPRX_RSSI_THRESHOLD_MIN	30
75bfcc09ddSBjoern A. Zeeb 
76bfcc09ddSBjoern A. Zeeb /**
77bfcc09ddSBjoern A. Zeeb  * enum iwl_power_flags - masks for power table command flags
78bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
79bfcc09ddSBjoern A. Zeeb  *		receiver and transmitter. '0' - does not allow.
80bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
81bfcc09ddSBjoern A. Zeeb  *		'1' Driver enables PM (use rest of parameters)
82bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
83bfcc09ddSBjoern A. Zeeb  *		'1' PM could sleep over DTIM till listen Interval.
84bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
85bfcc09ddSBjoern A. Zeeb  *		access categories are both delivery and trigger enabled.
86bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
87bfcc09ddSBjoern A. Zeeb  *		PBW Snoozing enabled
88bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
89bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
90bfcc09ddSBjoern A. Zeeb  * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
91bfcc09ddSBjoern A. Zeeb  *		detection enablement
92bfcc09ddSBjoern A. Zeeb */
93bfcc09ddSBjoern A. Zeeb enum iwl_power_flags {
94bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
95bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK	= BIT(1),
96bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_SKIP_OVER_DTIM_MSK		= BIT(2),
97bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_SNOOZE_ENA_MSK		= BIT(5),
98bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_BT_SCO_ENA			= BIT(8),
99bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_ADVANCE_PM_ENA_MSK		= BIT(9),
100bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_LPRX_ENA_MSK		= BIT(11),
101bfcc09ddSBjoern A. Zeeb 	POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK	= BIT(12),
102bfcc09ddSBjoern A. Zeeb };
103bfcc09ddSBjoern A. Zeeb 
104bfcc09ddSBjoern A. Zeeb #define IWL_POWER_VEC_SIZE 5
105bfcc09ddSBjoern A. Zeeb 
106bfcc09ddSBjoern A. Zeeb /**
107bfcc09ddSBjoern A. Zeeb  * struct iwl_powertable_cmd - legacy power command. Beside old API support this
108bfcc09ddSBjoern A. Zeeb  *	is used also with a new	power API for device wide power settings.
109bfcc09ddSBjoern A. Zeeb  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
110bfcc09ddSBjoern A. Zeeb  *
111bfcc09ddSBjoern A. Zeeb  * @flags:		Power table command flags from POWER_FLAGS_*
112bfcc09ddSBjoern A. Zeeb  * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
113bfcc09ddSBjoern A. Zeeb  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
114bfcc09ddSBjoern A. Zeeb  *			set regardless of power scheme or current power state.
115bfcc09ddSBjoern A. Zeeb  *			FW use this value also when PM is disabled.
116bfcc09ddSBjoern A. Zeeb  * @debug_flags:	debug flags
117bfcc09ddSBjoern A. Zeeb  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
118bfcc09ddSBjoern A. Zeeb  *			PSM transition - legacy PM
119bfcc09ddSBjoern A. Zeeb  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
120bfcc09ddSBjoern A. Zeeb  *			PSM transition - legacy PM
121bfcc09ddSBjoern A. Zeeb  * @sleep_interval:	not in use
122bfcc09ddSBjoern A. Zeeb  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
123bfcc09ddSBjoern A. Zeeb  *			is set. For example, if it is required to skip over
124bfcc09ddSBjoern A. Zeeb  *			one DTIM, this value need to be set to 2 (DTIM periods).
125bfcc09ddSBjoern A. Zeeb  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
126bfcc09ddSBjoern A. Zeeb  *			Default: 80dbm
127bfcc09ddSBjoern A. Zeeb  */
128bfcc09ddSBjoern A. Zeeb struct iwl_powertable_cmd {
129bfcc09ddSBjoern A. Zeeb 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
130bfcc09ddSBjoern A. Zeeb 	__le16 flags;
131bfcc09ddSBjoern A. Zeeb 	u8 keep_alive_seconds;
132bfcc09ddSBjoern A. Zeeb 	u8 debug_flags;
133bfcc09ddSBjoern A. Zeeb 	__le32 rx_data_timeout;
134bfcc09ddSBjoern A. Zeeb 	__le32 tx_data_timeout;
135bfcc09ddSBjoern A. Zeeb 	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
136bfcc09ddSBjoern A. Zeeb 	__le32 skip_dtim_periods;
137bfcc09ddSBjoern A. Zeeb 	__le32 lprx_rssi_threshold;
138bfcc09ddSBjoern A. Zeeb } __packed;
139bfcc09ddSBjoern A. Zeeb 
140bfcc09ddSBjoern A. Zeeb /**
141bfcc09ddSBjoern A. Zeeb  * enum iwl_device_power_flags - masks for device power command flags
142bfcc09ddSBjoern A. Zeeb  * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
143bfcc09ddSBjoern A. Zeeb  *	'1' Allow to save power by turning off
144bfcc09ddSBjoern A. Zeeb  *	receiver and transmitter. '0' - does not allow.
145bfcc09ddSBjoern A. Zeeb  * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
146bfcc09ddSBjoern A. Zeeb  *	Device Retention indication, '1' indicate retention is enabled.
147bfcc09ddSBjoern A. Zeeb  * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
148bfcc09ddSBjoern A. Zeeb  *	32Khz external slow clock valid indication, '1' indicate cloack is
149bfcc09ddSBjoern A. Zeeb  *	valid.
150bfcc09ddSBjoern A. Zeeb */
151bfcc09ddSBjoern A. Zeeb enum iwl_device_power_flags {
152bfcc09ddSBjoern A. Zeeb 	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
153bfcc09ddSBjoern A. Zeeb 	DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK	= BIT(1),
154bfcc09ddSBjoern A. Zeeb 	DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK		= BIT(12),
155bfcc09ddSBjoern A. Zeeb };
156bfcc09ddSBjoern A. Zeeb 
157bfcc09ddSBjoern A. Zeeb /**
158bfcc09ddSBjoern A. Zeeb  * struct iwl_device_power_cmd - device wide power command.
159bfcc09ddSBjoern A. Zeeb  * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
160bfcc09ddSBjoern A. Zeeb  *
161bfcc09ddSBjoern A. Zeeb  * @flags:	Power table command flags from &enum iwl_device_power_flags
162bfcc09ddSBjoern A. Zeeb  * @reserved: reserved (padding)
163bfcc09ddSBjoern A. Zeeb  */
164bfcc09ddSBjoern A. Zeeb struct iwl_device_power_cmd {
165bfcc09ddSBjoern A. Zeeb 	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
166bfcc09ddSBjoern A. Zeeb 	__le16 flags;
167bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
168bfcc09ddSBjoern A. Zeeb } __packed;
169bfcc09ddSBjoern A. Zeeb 
170bfcc09ddSBjoern A. Zeeb /**
171bfcc09ddSBjoern A. Zeeb  * struct iwl_mac_power_cmd - New power command containing uAPSD support
172bfcc09ddSBjoern A. Zeeb  * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
173bfcc09ddSBjoern A. Zeeb  * @id_and_color:	MAC contex identifier, &enum iwl_ctxt_id_and_color
174bfcc09ddSBjoern A. Zeeb  * @flags:		Power table command flags from POWER_FLAGS_*
175bfcc09ddSBjoern A. Zeeb  * @keep_alive_seconds:	Keep alive period in seconds. Default - 25 sec.
176bfcc09ddSBjoern A. Zeeb  *			Minimum allowed:- 3 * DTIM. Keep alive period must be
177bfcc09ddSBjoern A. Zeeb  *			set regardless of power scheme or current power state.
178bfcc09ddSBjoern A. Zeeb  *			FW use this value also when PM is disabled.
179bfcc09ddSBjoern A. Zeeb  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
180bfcc09ddSBjoern A. Zeeb  *			PSM transition - legacy PM
181bfcc09ddSBjoern A. Zeeb  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
182bfcc09ddSBjoern A. Zeeb  *			PSM transition - legacy PM
183bfcc09ddSBjoern A. Zeeb  * @skip_dtim_periods:	Number of DTIM periods to skip if Skip over DTIM flag
184bfcc09ddSBjoern A. Zeeb  *			is set. For example, if it is required to skip over
185bfcc09ddSBjoern A. Zeeb  *			one DTIM, this value need to be set to 2 (DTIM periods).
186bfcc09ddSBjoern A. Zeeb  * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
187bfcc09ddSBjoern A. Zeeb  *			PSM transition - uAPSD
188bfcc09ddSBjoern A. Zeeb  * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
189bfcc09ddSBjoern A. Zeeb  *			PSM transition - uAPSD
190bfcc09ddSBjoern A. Zeeb  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
191bfcc09ddSBjoern A. Zeeb  *			Default: 80dbm
192bfcc09ddSBjoern A. Zeeb  * @snooze_interval:	Maximum time between attempts to retrieve buffered data
193bfcc09ddSBjoern A. Zeeb  *			from the AP [msec]
194bfcc09ddSBjoern A. Zeeb  * @snooze_window:	A window of time in which PBW snoozing insures that all
195bfcc09ddSBjoern A. Zeeb  *			packets received. It is also the minimum time from last
196bfcc09ddSBjoern A. Zeeb  *			received unicast RX packet, before client stops snoozing
197bfcc09ddSBjoern A. Zeeb  *			for data. [msec]
198bfcc09ddSBjoern A. Zeeb  * @snooze_step:	TBD
199bfcc09ddSBjoern A. Zeeb  * @qndp_tid:		TID client shall use for uAPSD QNDP triggers
200bfcc09ddSBjoern A. Zeeb  * @uapsd_ac_flags:	Set trigger-enabled and delivery-enabled indication for
201bfcc09ddSBjoern A. Zeeb  *			each corresponding AC.
202bfcc09ddSBjoern A. Zeeb  *			Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
203bfcc09ddSBjoern A. Zeeb  * @uapsd_max_sp:	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
204bfcc09ddSBjoern A. Zeeb  *			values.
205bfcc09ddSBjoern A. Zeeb  * @heavy_tx_thld_packets:	TX threshold measured in number of packets
206bfcc09ddSBjoern A. Zeeb  * @heavy_rx_thld_packets:	RX threshold measured in number of packets
207bfcc09ddSBjoern A. Zeeb  * @heavy_tx_thld_percentage:	TX threshold measured in load's percentage
208bfcc09ddSBjoern A. Zeeb  * @heavy_rx_thld_percentage:	RX threshold measured in load's percentage
209bfcc09ddSBjoern A. Zeeb  * @limited_ps_threshold: (unused)
210bfcc09ddSBjoern A. Zeeb  * @reserved: reserved (padding)
211bfcc09ddSBjoern A. Zeeb  */
212bfcc09ddSBjoern A. Zeeb struct iwl_mac_power_cmd {
213bfcc09ddSBjoern A. Zeeb 	/* CONTEXT_DESC_API_T_VER_1 */
214bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
215bfcc09ddSBjoern A. Zeeb 
216bfcc09ddSBjoern A. Zeeb 	/* CLIENT_PM_POWER_TABLE_S_VER_1 */
217bfcc09ddSBjoern A. Zeeb 	__le16 flags;
218bfcc09ddSBjoern A. Zeeb 	__le16 keep_alive_seconds;
219bfcc09ddSBjoern A. Zeeb 	__le32 rx_data_timeout;
220bfcc09ddSBjoern A. Zeeb 	__le32 tx_data_timeout;
221bfcc09ddSBjoern A. Zeeb 	__le32 rx_data_timeout_uapsd;
222bfcc09ddSBjoern A. Zeeb 	__le32 tx_data_timeout_uapsd;
223bfcc09ddSBjoern A. Zeeb 	u8 lprx_rssi_threshold;
224bfcc09ddSBjoern A. Zeeb 	u8 skip_dtim_periods;
225bfcc09ddSBjoern A. Zeeb 	__le16 snooze_interval;
226bfcc09ddSBjoern A. Zeeb 	__le16 snooze_window;
227bfcc09ddSBjoern A. Zeeb 	u8 snooze_step;
228bfcc09ddSBjoern A. Zeeb 	u8 qndp_tid;
229bfcc09ddSBjoern A. Zeeb 	u8 uapsd_ac_flags;
230bfcc09ddSBjoern A. Zeeb 	u8 uapsd_max_sp;
231bfcc09ddSBjoern A. Zeeb 	u8 heavy_tx_thld_packets;
232bfcc09ddSBjoern A. Zeeb 	u8 heavy_rx_thld_packets;
233bfcc09ddSBjoern A. Zeeb 	u8 heavy_tx_thld_percentage;
234bfcc09ddSBjoern A. Zeeb 	u8 heavy_rx_thld_percentage;
235bfcc09ddSBjoern A. Zeeb 	u8 limited_ps_threshold;
236bfcc09ddSBjoern A. Zeeb 	u8 reserved;
237bfcc09ddSBjoern A. Zeeb } __packed;
238bfcc09ddSBjoern A. Zeeb 
239bfcc09ddSBjoern A. Zeeb /*
240bfcc09ddSBjoern A. Zeeb  * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
241bfcc09ddSBjoern A. Zeeb  * associated AP is identified as improperly implementing uAPSD protocol.
242bfcc09ddSBjoern A. Zeeb  * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
243bfcc09ddSBjoern A. Zeeb  * @sta_id: index of station in uCode's station table - associated AP ID in
244bfcc09ddSBjoern A. Zeeb  *	    this context.
245bfcc09ddSBjoern A. Zeeb  */
246bfcc09ddSBjoern A. Zeeb struct iwl_uapsd_misbehaving_ap_notif {
247bfcc09ddSBjoern A. Zeeb 	__le32 sta_id;
248bfcc09ddSBjoern A. Zeeb 	u8 mac_id;
249bfcc09ddSBjoern A. Zeeb 	u8 reserved[3];
250bfcc09ddSBjoern A. Zeeb } __packed;
251bfcc09ddSBjoern A. Zeeb 
252bfcc09ddSBjoern A. Zeeb /**
253bfcc09ddSBjoern A. Zeeb  * struct iwl_reduce_tx_power_cmd - TX power reduction command
254bfcc09ddSBjoern A. Zeeb  * REDUCE_TX_POWER_CMD = 0x9f
255bfcc09ddSBjoern A. Zeeb  * @flags: (reserved for future implementation)
256bfcc09ddSBjoern A. Zeeb  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
257bfcc09ddSBjoern A. Zeeb  * @pwr_restriction: TX power restriction in dBms.
258bfcc09ddSBjoern A. Zeeb  */
259bfcc09ddSBjoern A. Zeeb struct iwl_reduce_tx_power_cmd {
260bfcc09ddSBjoern A. Zeeb 	u8 flags;
261bfcc09ddSBjoern A. Zeeb 	u8 mac_context_id;
262bfcc09ddSBjoern A. Zeeb 	__le16 pwr_restriction;
263bfcc09ddSBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
264bfcc09ddSBjoern A. Zeeb 
265bfcc09ddSBjoern A. Zeeb enum iwl_dev_tx_power_cmd_mode {
266bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_MAC = 0,
267bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_DEVICE = 1,
268bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_CHAINS = 2,
269bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_ACK = 3,
270bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
271bfcc09ddSBjoern A. Zeeb 	IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
272bfcc09ddSBjoern A. Zeeb }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
273bfcc09ddSBjoern A. Zeeb 
274bfcc09ddSBjoern A. Zeeb #define IWL_NUM_CHAIN_TABLES	1
275bfcc09ddSBjoern A. Zeeb #define IWL_NUM_CHAIN_TABLES_V2	2
276bfcc09ddSBjoern A. Zeeb #define IWL_NUM_CHAIN_LIMITS	2
277bfcc09ddSBjoern A. Zeeb #define IWL_NUM_SUB_BANDS_V1	5
278bfcc09ddSBjoern A. Zeeb #define IWL_NUM_SUB_BANDS_V2	11
279bfcc09ddSBjoern A. Zeeb 
280bfcc09ddSBjoern A. Zeeb /**
281bfcc09ddSBjoern A. Zeeb  * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd
282bfcc09ddSBjoern A. Zeeb  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
283bfcc09ddSBjoern A. Zeeb  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
284bfcc09ddSBjoern A. Zeeb  * @pwr_restriction: TX power restriction in 1/8 dBms.
285bfcc09ddSBjoern A. Zeeb  * @dev_24: device TX power restriction in 1/8 dBms
286bfcc09ddSBjoern A. Zeeb  * @dev_52_low: device TX power restriction upper band - low
287bfcc09ddSBjoern A. Zeeb  * @dev_52_high: device TX power restriction upper band - high
288bfcc09ddSBjoern A. Zeeb  */
289bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_common {
290bfcc09ddSBjoern A. Zeeb 	__le32 set_mode;
291bfcc09ddSBjoern A. Zeeb 	__le32 mac_context_id;
292bfcc09ddSBjoern A. Zeeb 	__le16 pwr_restriction;
293bfcc09ddSBjoern A. Zeeb 	__le16 dev_24;
294bfcc09ddSBjoern A. Zeeb 	__le16 dev_52_low;
295bfcc09ddSBjoern A. Zeeb 	__le16 dev_52_high;
296bfcc09ddSBjoern A. Zeeb };
297bfcc09ddSBjoern A. Zeeb 
298bfcc09ddSBjoern A. Zeeb /**
299bfcc09ddSBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
300bfcc09ddSBjoern A. Zeeb  * @per_chain: per chain restrictions
301bfcc09ddSBjoern A. Zeeb  */
302bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_cmd_v3 {
303bfcc09ddSBjoern A. Zeeb 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
304bfcc09ddSBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
305bfcc09ddSBjoern A. Zeeb 
306bfcc09ddSBjoern A. Zeeb #define IWL_DEV_MAX_TX_POWER 0x7FFF
307bfcc09ddSBjoern A. Zeeb 
308bfcc09ddSBjoern A. Zeeb /**
309bfcc09ddSBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4
310bfcc09ddSBjoern A. Zeeb  * @per_chain: per chain restrictions
311bfcc09ddSBjoern A. Zeeb  * @enable_ack_reduction: enable or disable close range ack TX power
312bfcc09ddSBjoern A. Zeeb  *	reduction.
313bfcc09ddSBjoern A. Zeeb  * @reserved: reserved (padding)
314bfcc09ddSBjoern A. Zeeb  */
315bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_cmd_v4 {
316bfcc09ddSBjoern A. Zeeb 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
317bfcc09ddSBjoern A. Zeeb 	u8 enable_ack_reduction;
318bfcc09ddSBjoern A. Zeeb 	u8 reserved[3];
319bfcc09ddSBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
320bfcc09ddSBjoern A. Zeeb 
321bfcc09ddSBjoern A. Zeeb /**
322bfcc09ddSBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
323bfcc09ddSBjoern A. Zeeb  * @per_chain: per chain restrictions
324bfcc09ddSBjoern A. Zeeb  * @enable_ack_reduction: enable or disable close range ack TX power
325bfcc09ddSBjoern A. Zeeb  *	reduction.
326bfcc09ddSBjoern A. Zeeb  * @per_chain_restriction_changed: is per_chain_restriction has changed
327bfcc09ddSBjoern A. Zeeb  *	from last command. used if set_mode is
328bfcc09ddSBjoern A. Zeeb  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
329bfcc09ddSBjoern A. Zeeb  *	note: if not changed, the command is used for keep alive only.
330bfcc09ddSBjoern A. Zeeb  * @reserved: reserved (padding)
331bfcc09ddSBjoern A. Zeeb  * @timer_period: timer in milliseconds. if expires FW will change to default
332bfcc09ddSBjoern A. Zeeb  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
333bfcc09ddSBjoern A. Zeeb  */
334bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_cmd_v5 {
335bfcc09ddSBjoern A. Zeeb 	__le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
336bfcc09ddSBjoern A. Zeeb 	u8 enable_ack_reduction;
337bfcc09ddSBjoern A. Zeeb 	u8 per_chain_restriction_changed;
338bfcc09ddSBjoern A. Zeeb 	u8 reserved[2];
339bfcc09ddSBjoern A. Zeeb 	__le32 timer_period;
340bfcc09ddSBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
341bfcc09ddSBjoern A. Zeeb 
342bfcc09ddSBjoern A. Zeeb /**
343*fac1f593SBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd_v6 - TX power reduction command version 6
344bfcc09ddSBjoern A. Zeeb  * @per_chain: per chain restrictions
345bfcc09ddSBjoern A. Zeeb  * @enable_ack_reduction: enable or disable close range ack TX power
346bfcc09ddSBjoern A. Zeeb  *	reduction.
347bfcc09ddSBjoern A. Zeeb  * @per_chain_restriction_changed: is per_chain_restriction has changed
348bfcc09ddSBjoern A. Zeeb  *	from last command. used if set_mode is
349bfcc09ddSBjoern A. Zeeb  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
350bfcc09ddSBjoern A. Zeeb  *	note: if not changed, the command is used for keep alive only.
351bfcc09ddSBjoern A. Zeeb  * @reserved: reserved (padding)
352bfcc09ddSBjoern A. Zeeb  * @timer_period: timer in milliseconds. if expires FW will change to default
353bfcc09ddSBjoern A. Zeeb  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
354bfcc09ddSBjoern A. Zeeb  */
355bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_cmd_v6 {
356bfcc09ddSBjoern A. Zeeb 	__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
357bfcc09ddSBjoern A. Zeeb 	u8 enable_ack_reduction;
358bfcc09ddSBjoern A. Zeeb 	u8 per_chain_restriction_changed;
359bfcc09ddSBjoern A. Zeeb 	u8 reserved[2];
360bfcc09ddSBjoern A. Zeeb 	__le32 timer_period;
361bfcc09ddSBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
362bfcc09ddSBjoern A. Zeeb 
363bfcc09ddSBjoern A. Zeeb /**
364*fac1f593SBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd_v7 - TX power reduction command version 7
365*fac1f593SBjoern A. Zeeb  * @per_chain: per chain restrictions
366*fac1f593SBjoern A. Zeeb  * @enable_ack_reduction: enable or disable close range ack TX power
367*fac1f593SBjoern A. Zeeb  *	reduction.
368*fac1f593SBjoern A. Zeeb  * @per_chain_restriction_changed: is per_chain_restriction has changed
369*fac1f593SBjoern A. Zeeb  *	from last command. used if set_mode is
370*fac1f593SBjoern A. Zeeb  *	IWL_TX_POWER_MODE_SET_SAR_TIMER.
371*fac1f593SBjoern A. Zeeb  *	note: if not changed, the command is used for keep alive only.
372*fac1f593SBjoern A. Zeeb  * @reserved: reserved (padding)
373*fac1f593SBjoern A. Zeeb  * @timer_period: timer in milliseconds. if expires FW will change to default
374*fac1f593SBjoern A. Zeeb  *	BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
375*fac1f593SBjoern A. Zeeb  * @flags: reduce power flags.
376*fac1f593SBjoern A. Zeeb  */
377*fac1f593SBjoern A. Zeeb struct iwl_dev_tx_power_cmd_v7 {
378*fac1f593SBjoern A. Zeeb 	__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
379*fac1f593SBjoern A. Zeeb 	u8 enable_ack_reduction;
380*fac1f593SBjoern A. Zeeb 	u8 per_chain_restriction_changed;
381*fac1f593SBjoern A. Zeeb 	u8 reserved[2];
382*fac1f593SBjoern A. Zeeb 	__le32 timer_period;
383*fac1f593SBjoern A. Zeeb 	__le32 flags;
384*fac1f593SBjoern A. Zeeb } __packed; /* TX_REDUCED_POWER_API_S_VER_7 */
385*fac1f593SBjoern A. Zeeb /**
386bfcc09ddSBjoern A. Zeeb  * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
387bfcc09ddSBjoern A. Zeeb  * @common: common part of the command
388bfcc09ddSBjoern A. Zeeb  * @v3: version 3 part of the command
389bfcc09ddSBjoern A. Zeeb  * @v4: version 4 part of the command
390bfcc09ddSBjoern A. Zeeb  * @v5: version 5 part of the command
391bfcc09ddSBjoern A. Zeeb  * @v6: version 6 part of the command
392bfcc09ddSBjoern A. Zeeb  */
393bfcc09ddSBjoern A. Zeeb struct iwl_dev_tx_power_cmd {
394bfcc09ddSBjoern A. Zeeb 	struct iwl_dev_tx_power_common common;
395bfcc09ddSBjoern A. Zeeb 	union {
396bfcc09ddSBjoern A. Zeeb 		struct iwl_dev_tx_power_cmd_v3 v3;
397bfcc09ddSBjoern A. Zeeb 		struct iwl_dev_tx_power_cmd_v4 v4;
398bfcc09ddSBjoern A. Zeeb 		struct iwl_dev_tx_power_cmd_v5 v5;
399bfcc09ddSBjoern A. Zeeb 		struct iwl_dev_tx_power_cmd_v6 v6;
400*fac1f593SBjoern A. Zeeb 		struct iwl_dev_tx_power_cmd_v7 v7;
401bfcc09ddSBjoern A. Zeeb 	};
402bfcc09ddSBjoern A. Zeeb };
403bfcc09ddSBjoern A. Zeeb 
404bfcc09ddSBjoern A. Zeeb #define IWL_NUM_GEO_PROFILES		3
405bfcc09ddSBjoern A. Zeeb #define IWL_NUM_GEO_PROFILES_V3		8
406bfcc09ddSBjoern A. Zeeb #define IWL_NUM_BANDS_PER_CHAIN_V1	2
407bfcc09ddSBjoern A. Zeeb #define IWL_NUM_BANDS_PER_CHAIN_V2	3
408bfcc09ddSBjoern A. Zeeb 
409bfcc09ddSBjoern A. Zeeb /**
410bfcc09ddSBjoern A. Zeeb  * enum iwl_geo_per_chain_offset_operation - type of operation
411bfcc09ddSBjoern A. Zeeb  * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
412bfcc09ddSBjoern A. Zeeb  * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
413bfcc09ddSBjoern A. Zeeb  */
414bfcc09ddSBjoern A. Zeeb enum iwl_geo_per_chain_offset_operation {
415bfcc09ddSBjoern A. Zeeb 	IWL_PER_CHAIN_OFFSET_SET_TABLES,
416bfcc09ddSBjoern A. Zeeb 	IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
417bfcc09ddSBjoern A. Zeeb };  /* PER_CHAIN_OFFSET_OPERATION_E */
418bfcc09ddSBjoern A. Zeeb 
419bfcc09ddSBjoern A. Zeeb /**
420bfcc09ddSBjoern A. Zeeb  * struct iwl_per_chain_offset - embedded struct for PER_CHAIN_LIMIT_OFFSET_CMD.
421bfcc09ddSBjoern A. Zeeb  * @max_tx_power: maximum allowed tx power.
422bfcc09ddSBjoern A. Zeeb  * @chain_a: tx power offset for chain a.
423bfcc09ddSBjoern A. Zeeb  * @chain_b: tx power offset for chain b.
424bfcc09ddSBjoern A. Zeeb  */
425bfcc09ddSBjoern A. Zeeb struct iwl_per_chain_offset {
426bfcc09ddSBjoern A. Zeeb 	__le16 max_tx_power;
427bfcc09ddSBjoern A. Zeeb 	u8 chain_a;
428bfcc09ddSBjoern A. Zeeb 	u8 chain_b;
429bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
430bfcc09ddSBjoern A. Zeeb 
431bfcc09ddSBjoern A. Zeeb /**
432bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profile_cmd_v1 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
433bfcc09ddSBjoern A. Zeeb  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
434bfcc09ddSBjoern A. Zeeb  * @table: offset profile per band.
435bfcc09ddSBjoern A. Zeeb  */
436bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_cmd_v1 {
437bfcc09ddSBjoern A. Zeeb 	__le32 ops;
438bfcc09ddSBjoern A. Zeeb 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
439bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_1 */
440bfcc09ddSBjoern A. Zeeb 
441bfcc09ddSBjoern A. Zeeb /**
442bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profile_cmd_v2 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
443bfcc09ddSBjoern A. Zeeb  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
444bfcc09ddSBjoern A. Zeeb  * @table: offset profile per band.
445d9836fb4SBjoern A. Zeeb  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
446bfcc09ddSBjoern A. Zeeb  */
447bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_cmd_v2 {
448bfcc09ddSBjoern A. Zeeb 	__le32 ops;
449bfcc09ddSBjoern A. Zeeb 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
450bfcc09ddSBjoern A. Zeeb 	__le32 table_revision;
451bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_2 */
452bfcc09ddSBjoern A. Zeeb 
453bfcc09ddSBjoern A. Zeeb /**
454bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profile_cmd_v3 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
455bfcc09ddSBjoern A. Zeeb  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
456bfcc09ddSBjoern A. Zeeb  * @table: offset profile per band.
457d9836fb4SBjoern A. Zeeb  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
458bfcc09ddSBjoern A. Zeeb  */
459bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_cmd_v3 {
460bfcc09ddSBjoern A. Zeeb 	__le32 ops;
461bfcc09ddSBjoern A. Zeeb 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2];
462bfcc09ddSBjoern A. Zeeb 	__le32 table_revision;
463bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_3 */
464bfcc09ddSBjoern A. Zeeb 
465bfcc09ddSBjoern A. Zeeb /**
466bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profile_cmd_v4 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
467bfcc09ddSBjoern A. Zeeb  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
468bfcc09ddSBjoern A. Zeeb  * @table: offset profile per band.
469d9836fb4SBjoern A. Zeeb  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
470bfcc09ddSBjoern A. Zeeb  */
471bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_cmd_v4 {
472bfcc09ddSBjoern A. Zeeb 	__le32 ops;
473bfcc09ddSBjoern A. Zeeb 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V1];
474bfcc09ddSBjoern A. Zeeb 	__le32 table_revision;
475bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_4 */
476bfcc09ddSBjoern A. Zeeb 
477bfcc09ddSBjoern A. Zeeb /**
478bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profile_cmd_v5 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
479bfcc09ddSBjoern A. Zeeb  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
480bfcc09ddSBjoern A. Zeeb  * @table: offset profile per band.
481d9836fb4SBjoern A. Zeeb  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
482bfcc09ddSBjoern A. Zeeb  */
483bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_cmd_v5 {
484bfcc09ddSBjoern A. Zeeb 	__le32 ops;
485bfcc09ddSBjoern A. Zeeb 	struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V2];
486bfcc09ddSBjoern A. Zeeb 	__le32 table_revision;
487bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_5 */
488bfcc09ddSBjoern A. Zeeb 
489bfcc09ddSBjoern A. Zeeb union iwl_geo_tx_power_profiles_cmd {
490bfcc09ddSBjoern A. Zeeb 	struct iwl_geo_tx_power_profiles_cmd_v1 v1;
491bfcc09ddSBjoern A. Zeeb 	struct iwl_geo_tx_power_profiles_cmd_v2 v2;
492bfcc09ddSBjoern A. Zeeb 	struct iwl_geo_tx_power_profiles_cmd_v3 v3;
493bfcc09ddSBjoern A. Zeeb 	struct iwl_geo_tx_power_profiles_cmd_v4 v4;
494bfcc09ddSBjoern A. Zeeb 	struct iwl_geo_tx_power_profiles_cmd_v5 v5;
495bfcc09ddSBjoern A. Zeeb };
496bfcc09ddSBjoern A. Zeeb 
497bfcc09ddSBjoern A. Zeeb /**
498bfcc09ddSBjoern A. Zeeb  * struct iwl_geo_tx_power_profiles_resp -  response to PER_CHAIN_LIMIT_OFFSET_CMD cmd
499bfcc09ddSBjoern A. Zeeb  * @profile_idx: current geo profile in use
500bfcc09ddSBjoern A. Zeeb  */
501bfcc09ddSBjoern A. Zeeb struct iwl_geo_tx_power_profiles_resp {
502bfcc09ddSBjoern A. Zeeb 	__le32 profile_idx;
503bfcc09ddSBjoern A. Zeeb } __packed; /* PER_CHAIN_LIMIT_OFFSET_RSP */
504bfcc09ddSBjoern A. Zeeb 
505bfcc09ddSBjoern A. Zeeb /**
506bfcc09ddSBjoern A. Zeeb  * union iwl_ppag_table_cmd - union for all versions of PPAG command
507bfcc09ddSBjoern A. Zeeb  * @v1: version 1
508bfcc09ddSBjoern A. Zeeb  * @v2: version 2
509bfcc09ddSBjoern A. Zeeb  *
510bfcc09ddSBjoern A. Zeeb  * @flags: bit 0 - indicates enablement of PPAG for ETSI
511bfcc09ddSBjoern A. Zeeb  *         bit 1 - indicates enablement of PPAG for CHINA BIOS
512bfcc09ddSBjoern A. Zeeb  *         bit 1 can be used only in v3 (identical to v2)
513bfcc09ddSBjoern A. Zeeb  * @gain: table of antenna gain values per chain and sub-band
514bfcc09ddSBjoern A. Zeeb  * @reserved: reserved
515bfcc09ddSBjoern A. Zeeb  */
516bfcc09ddSBjoern A. Zeeb union iwl_ppag_table_cmd {
517bfcc09ddSBjoern A. Zeeb 	struct {
518bfcc09ddSBjoern A. Zeeb 		__le32 flags;
519bfcc09ddSBjoern A. Zeeb 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
520bfcc09ddSBjoern A. Zeeb 		s8 reserved[2];
521bfcc09ddSBjoern A. Zeeb 	} v1;
522bfcc09ddSBjoern A. Zeeb 	struct {
523bfcc09ddSBjoern A. Zeeb 		__le32 flags;
524bfcc09ddSBjoern A. Zeeb 		s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
525bfcc09ddSBjoern A. Zeeb 		s8 reserved[2];
526bfcc09ddSBjoern A. Zeeb 	} v2;
527bfcc09ddSBjoern A. Zeeb } __packed;
528bfcc09ddSBjoern A. Zeeb 
529d9836fb4SBjoern A. Zeeb #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE	26
530d9836fb4SBjoern A. Zeeb #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE	13
531d9836fb4SBjoern A. Zeeb 
532d9836fb4SBjoern A. Zeeb /**
533d9836fb4SBjoern A. Zeeb  * struct iwl_sar_offset_mapping_cmd - struct for SAR_OFFSET_MAPPING_TABLE_CMD
534d9836fb4SBjoern A. Zeeb  * @offset_map: mapping a mcc to a geo sar group
535d9836fb4SBjoern A. Zeeb  * @reserved: reserved
536d9836fb4SBjoern A. Zeeb  */
537d9836fb4SBjoern A. Zeeb struct iwl_sar_offset_mapping_cmd {
538d9836fb4SBjoern A. Zeeb 	u8 offset_map[MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE]
539d9836fb4SBjoern A. Zeeb 		[MCC_TO_SAR_OFFSET_TABLE_COL_SIZE];
540d9836fb4SBjoern A. Zeeb 	u16 reserved;
541d9836fb4SBjoern A. Zeeb } __packed; /*SAR_OFFSET_MAPPING_TABLE_CMD_API_S*/
542d9836fb4SBjoern A. Zeeb 
543bfcc09ddSBjoern A. Zeeb /**
544bfcc09ddSBjoern A. Zeeb  * struct iwl_beacon_filter_cmd
545bfcc09ddSBjoern A. Zeeb  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
546bfcc09ddSBjoern A. Zeeb  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
547bfcc09ddSBjoern A. Zeeb  *      to driver if delta in Energy values calculated for this and last
548bfcc09ddSBjoern A. Zeeb  *      passed beacon is greater than this threshold. Zero value means that
549bfcc09ddSBjoern A. Zeeb  *      the Energy change is ignored for beacon filtering, and beacon will
550bfcc09ddSBjoern A. Zeeb  *      not be forced to be sent to driver regardless of this delta. Typical
551bfcc09ddSBjoern A. Zeeb  *      energy delta 5dB.
552bfcc09ddSBjoern A. Zeeb  * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
553bfcc09ddSBjoern A. Zeeb  *      Send beacon to driver if delta in Energy values calculated for this
554bfcc09ddSBjoern A. Zeeb  *      and last passed beacon is greater than this threshold. Zero value
555bfcc09ddSBjoern A. Zeeb  *      means that the Energy change is ignored for beacon filtering while in
556bfcc09ddSBjoern A. Zeeb  *      Roaming state, typical energy delta 1dB.
557bfcc09ddSBjoern A. Zeeb  * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
558bfcc09ddSBjoern A. Zeeb  *      calculated for current beacon is less than the threshold, use
559bfcc09ddSBjoern A. Zeeb  *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
560bfcc09ddSBjoern A. Zeeb  *      Threshold. Typical energy threshold is -72dBm.
561bfcc09ddSBjoern A. Zeeb  * @bf_temp_threshold: This threshold determines the type of temperature
562bfcc09ddSBjoern A. Zeeb  *	filtering (Slow or Fast) that is selected (Units are in Celsuis):
563bfcc09ddSBjoern A. Zeeb  *	If the current temperature is above this threshold - Fast filter
564bfcc09ddSBjoern A. Zeeb  *	will be used, If the current temperature is below this threshold -
565bfcc09ddSBjoern A. Zeeb  *	Slow filter will be used.
566bfcc09ddSBjoern A. Zeeb  * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
567bfcc09ddSBjoern A. Zeeb  *      calculated for this and the last passed beacon is greater than this
568bfcc09ddSBjoern A. Zeeb  *      threshold. Zero value means that the temperature change is ignored for
569bfcc09ddSBjoern A. Zeeb  *      beacon filtering; beacons will not be  forced to be sent to driver
570bfcc09ddSBjoern A. Zeeb  *      regardless of whether its temerature has been changed.
571bfcc09ddSBjoern A. Zeeb  * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
572bfcc09ddSBjoern A. Zeeb  *      calculated for this and the last passed beacon is greater than this
573bfcc09ddSBjoern A. Zeeb  *      threshold. Zero value means that the temperature change is ignored for
574bfcc09ddSBjoern A. Zeeb  *      beacon filtering; beacons will not be forced to be sent to driver
575bfcc09ddSBjoern A. Zeeb  *      regardless of whether its temerature has been changed.
576bfcc09ddSBjoern A. Zeeb  * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
577bfcc09ddSBjoern A. Zeeb  * @bf_debug_flag: beacon filtering debug configuration
578bfcc09ddSBjoern A. Zeeb  * @bf_escape_timer: Send beacons to to driver if no beacons were passed
579bfcc09ddSBjoern A. Zeeb  *      for a specific period of time. Units: Beacons.
580bfcc09ddSBjoern A. Zeeb  * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
581bfcc09ddSBjoern A. Zeeb  *      for a longer period of time then this escape-timeout. Units: Beacons.
582bfcc09ddSBjoern A. Zeeb  * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
583bfcc09ddSBjoern A. Zeeb  * @bf_threshold_absolute_low: See below.
584bfcc09ddSBjoern A. Zeeb  * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
585bfcc09ddSBjoern A. Zeeb  *      for this beacon crossed this absolute threshold. For the 'Increase'
586bfcc09ddSBjoern A. Zeeb  *      direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
587bfcc09ddSBjoern A. Zeeb  *      direction the bf_energy_absolute_high[i] is used. Zero value means
588bfcc09ddSBjoern A. Zeeb  *      that this specific threshold is ignored for beacon filtering, and
589bfcc09ddSBjoern A. Zeeb  *      beacon will not be forced to be sent to driver due to this setting.
590bfcc09ddSBjoern A. Zeeb  */
591bfcc09ddSBjoern A. Zeeb struct iwl_beacon_filter_cmd {
592bfcc09ddSBjoern A. Zeeb 	__le32 bf_energy_delta;
593bfcc09ddSBjoern A. Zeeb 	__le32 bf_roaming_energy_delta;
594bfcc09ddSBjoern A. Zeeb 	__le32 bf_roaming_state;
595bfcc09ddSBjoern A. Zeeb 	__le32 bf_temp_threshold;
596bfcc09ddSBjoern A. Zeeb 	__le32 bf_temp_fast_filter;
597bfcc09ddSBjoern A. Zeeb 	__le32 bf_temp_slow_filter;
598bfcc09ddSBjoern A. Zeeb 	__le32 bf_enable_beacon_filter;
599bfcc09ddSBjoern A. Zeeb 	__le32 bf_debug_flag;
600bfcc09ddSBjoern A. Zeeb 	__le32 bf_escape_timer;
601bfcc09ddSBjoern A. Zeeb 	__le32 ba_escape_timer;
602bfcc09ddSBjoern A. Zeeb 	__le32 ba_enable_beacon_abort;
603bfcc09ddSBjoern A. Zeeb 	__le32 bf_threshold_absolute_low[2];
604bfcc09ddSBjoern A. Zeeb 	__le32 bf_threshold_absolute_high[2];
605bfcc09ddSBjoern A. Zeeb } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
606bfcc09ddSBjoern A. Zeeb 
607bfcc09ddSBjoern A. Zeeb /* Beacon filtering and beacon abort */
608bfcc09ddSBjoern A. Zeeb #define IWL_BF_ENERGY_DELTA_DEFAULT 5
609bfcc09ddSBjoern A. Zeeb #define IWL_BF_ENERGY_DELTA_D0I3 20
610bfcc09ddSBjoern A. Zeeb #define IWL_BF_ENERGY_DELTA_MAX 255
611bfcc09ddSBjoern A. Zeeb #define IWL_BF_ENERGY_DELTA_MIN 0
612bfcc09ddSBjoern A. Zeeb 
613bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
614bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
615bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
616bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
617bfcc09ddSBjoern A. Zeeb 
618bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_STATE_DEFAULT 72
619bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_STATE_D0I3 72
620bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_STATE_MAX 255
621bfcc09ddSBjoern A. Zeeb #define IWL_BF_ROAMING_STATE_MIN 0
622bfcc09ddSBjoern A. Zeeb 
623bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
624bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_THRESHOLD_D0I3 112
625bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_THRESHOLD_MAX 255
626bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_THRESHOLD_MIN 0
627bfcc09ddSBjoern A. Zeeb 
628bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
629bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
630bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_FAST_FILTER_MAX 255
631bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_FAST_FILTER_MIN 0
632bfcc09ddSBjoern A. Zeeb 
633bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
634bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
635bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
636bfcc09ddSBjoern A. Zeeb #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
637bfcc09ddSBjoern A. Zeeb 
638bfcc09ddSBjoern A. Zeeb #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
639bfcc09ddSBjoern A. Zeeb 
640bfcc09ddSBjoern A. Zeeb #define IWL_BF_DEBUG_FLAG_DEFAULT 0
641bfcc09ddSBjoern A. Zeeb #define IWL_BF_DEBUG_FLAG_D0I3 0
642bfcc09ddSBjoern A. Zeeb 
643bfcc09ddSBjoern A. Zeeb #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
644bfcc09ddSBjoern A. Zeeb #define IWL_BF_ESCAPE_TIMER_D0I3 0
645bfcc09ddSBjoern A. Zeeb #define IWL_BF_ESCAPE_TIMER_MAX 1024
646bfcc09ddSBjoern A. Zeeb #define IWL_BF_ESCAPE_TIMER_MIN 0
647bfcc09ddSBjoern A. Zeeb 
648bfcc09ddSBjoern A. Zeeb #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
649bfcc09ddSBjoern A. Zeeb #define IWL_BA_ESCAPE_TIMER_D0I3 6
650bfcc09ddSBjoern A. Zeeb #define IWL_BA_ESCAPE_TIMER_D3 9
651bfcc09ddSBjoern A. Zeeb #define IWL_BA_ESCAPE_TIMER_MAX 1024
652bfcc09ddSBjoern A. Zeeb #define IWL_BA_ESCAPE_TIMER_MIN 0
653bfcc09ddSBjoern A. Zeeb 
654bfcc09ddSBjoern A. Zeeb #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
655bfcc09ddSBjoern A. Zeeb 
656bfcc09ddSBjoern A. Zeeb #define IWL_BF_CMD_CONFIG(mode)					     \
657bfcc09ddSBjoern A. Zeeb 	.bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),	      \
658bfcc09ddSBjoern A. Zeeb 	.bf_roaming_energy_delta =					      \
659bfcc09ddSBjoern A. Zeeb 		cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),	      \
660bfcc09ddSBjoern A. Zeeb 	.bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),	      \
661bfcc09ddSBjoern A. Zeeb 	.bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
662bfcc09ddSBjoern A. Zeeb 	.bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
663bfcc09ddSBjoern A. Zeeb 	.bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
664bfcc09ddSBjoern A. Zeeb 	.bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),	      \
665bfcc09ddSBjoern A. Zeeb 	.bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),	      \
666bfcc09ddSBjoern A. Zeeb 	.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
667bfcc09ddSBjoern A. Zeeb 
668bfcc09ddSBjoern A. Zeeb #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
669bfcc09ddSBjoern A. Zeeb #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
670bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_power_h__ */
671