Debian Codegraph @

drivers/net/wireless/intel/iwlwifi/fw/api/power.h

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