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 /** 259 * struct iwl_reduce_tx_power_cmd - TX power reduction command 260 * REDUCE_TX_POWER_CMD = 0x9f 261 * @flags: (reserved for future implementation) 262 * @mac_context_id: id of the mac ctx for which we are reducing TX power. 263 * @pwr_restriction: TX power restriction in dBms. 264 */ 265 struct iwl_reduce_tx_power_cmd { 266 u8 flags; 267 u8 mac_context_id; 268 __le16 pwr_restriction; 269 } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */ 270 271 enum iwl_dev_tx_power_cmd_mode { 272 IWL_TX_POWER_MODE_SET_LINK = 0, 273 IWL_TX_POWER_MODE_SET_DEVICE = 1, 274 IWL_TX_POWER_MODE_SET_CHAINS = 2, 275 IWL_TX_POWER_MODE_SET_ACK = 3, 276 IWL_TX_POWER_MODE_SET_SAR_TIMER = 4, 277 IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5, 278 }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */; 279 280 #define IWL_NUM_CHAIN_TABLES 1 281 #define IWL_NUM_CHAIN_TABLES_V2 2 282 #define IWL_NUM_CHAIN_LIMITS 2 283 #define IWL_NUM_SUB_BANDS_V1 5 284 #define IWL_NUM_SUB_BANDS_V2 11 285 286 /** 287 * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd 288 * @set_mode: see &enum iwl_dev_tx_power_cmd_mode 289 * @link_id: id of the link ctx for which we are reducing TX power. 290 * For version 9 / 10, this is the link id. For earlier versions, it is 291 * the mac id. 292 * @pwr_restriction: TX power restriction in 1/8 dBms. 293 */ 294 struct iwl_dev_tx_power_common { 295 __le32 set_mode; 296 __le32 link_id; 297 __le16 pwr_restriction; 298 } __packed; 299 300 /** 301 * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3 302 * @per_chain: per chain restrictions 303 */ 304 struct iwl_dev_tx_power_cmd_v3 { 305 __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 306 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */ 307 308 #define IWL_DEV_MAX_TX_POWER 0x7FFF 309 310 /** 311 * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4 312 * @per_chain: per chain restrictions 313 * @enable_ack_reduction: enable or disable close range ack TX power 314 * reduction. 315 * @reserved: reserved (padding) 316 */ 317 struct iwl_dev_tx_power_cmd_v4 { 318 __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 319 u8 enable_ack_reduction; 320 u8 reserved[3]; 321 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */ 322 323 /** 324 * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5 325 * @per_chain: per chain restrictions 326 * @enable_ack_reduction: enable or disable close range ack TX power 327 * reduction. 328 * @per_chain_restriction_changed: is per_chain_restriction has changed 329 * from last command. used if set_mode is 330 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 331 * note: if not changed, the command is used for keep alive only. 332 * @reserved: reserved (padding) 333 * @timer_period: timer in milliseconds. if expires FW will change to default 334 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 335 */ 336 struct iwl_dev_tx_power_cmd_v5 { 337 __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 338 u8 enable_ack_reduction; 339 u8 per_chain_restriction_changed; 340 u8 reserved[2]; 341 __le32 timer_period; 342 } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */ 343 344 /** 345 * struct iwl_dev_tx_power_cmd_v6 - TX power reduction command version 6 346 * @per_chain: per chain restrictions 347 * @enable_ack_reduction: enable or disable close range ack TX power 348 * reduction. 349 * @per_chain_restriction_changed: is per_chain_restriction has changed 350 * from last command. used if set_mode is 351 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 352 * note: if not changed, the command is used for keep alive only. 353 * @reserved: reserved (padding) 354 * @timer_period: timer in milliseconds. if expires FW will change to default 355 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 356 */ 357 struct iwl_dev_tx_power_cmd_v6 { 358 __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 359 u8 enable_ack_reduction; 360 u8 per_chain_restriction_changed; 361 u8 reserved[2]; 362 __le32 timer_period; 363 } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */ 364 365 /** 366 * struct iwl_dev_tx_power_cmd_v7 - TX power reduction command version 7 367 * @per_chain: per chain restrictions 368 * @enable_ack_reduction: enable or disable close range ack TX power 369 * reduction. 370 * @per_chain_restriction_changed: is per_chain_restriction has changed 371 * from last command. used if set_mode is 372 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 373 * note: if not changed, the command is used for keep alive only. 374 * @reserved: reserved (padding) 375 * @timer_period: timer in milliseconds. if expires FW will change to default 376 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 377 * @flags: reduce power flags. 378 */ 379 struct iwl_dev_tx_power_cmd_v7 { 380 __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 381 u8 enable_ack_reduction; 382 u8 per_chain_restriction_changed; 383 u8 reserved[2]; 384 __le32 timer_period; 385 __le32 flags; 386 } __packed; /* TX_REDUCED_POWER_API_S_VER_7 */ 387 388 /** 389 * struct iwl_dev_tx_power_cmd_v8 - TX power reduction command version 8 390 * @per_chain: per chain restrictions 391 * @enable_ack_reduction: enable or disable close range ack TX power 392 * reduction. 393 * @per_chain_restriction_changed: is per_chain_restriction has changed 394 * from last command. used if set_mode is 395 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 396 * note: if not changed, the command is used for keep alive only. 397 * @reserved: reserved (padding) 398 * @timer_period: timer in milliseconds. if expires FW will change to default 399 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 400 * @flags: reduce power flags. 401 * @tpc_vlp_backoff_level: user backoff of UNII5,7 VLP channels in USA. 402 * Not in use. 403 */ 404 struct iwl_dev_tx_power_cmd_v8 { 405 __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 406 u8 enable_ack_reduction; 407 u8 per_chain_restriction_changed; 408 u8 reserved[2]; 409 __le32 timer_period; 410 __le32 flags; 411 __le32 tpc_vlp_backoff_level; 412 } __packed; /* TX_REDUCED_POWER_API_S_VER_8 */ 413 414 /* 415 * @dev_24: device TX power restriction in 1/8 dBms 416 * @dev_52_low: device TX power restriction upper band - low 417 * @dev_52_high: device TX power restriction upper band - high 418 */ 419 struct iwl_dev_tx_power_cmd_per_band { 420 __le16 dev_24; 421 __le16 dev_52_low; 422 __le16 dev_52_high; 423 } __packed; 424 425 /** 426 * struct iwl_dev_tx_power_cmd_v3_v8 - TX power reduction command (multiversion) 427 * @per_band: per band restrictions 428 * @common: common part of the command 429 * @v3: version 3 part of the command 430 * @v4: version 4 part of the command 431 * @v5: version 5 part of the command 432 * @v6: version 6 part of the command 433 * @v7: version 7 part of the command 434 * @v8: version 8 part of the command 435 */ 436 struct iwl_dev_tx_power_cmd_v3_v8 { 437 struct iwl_dev_tx_power_common common; 438 struct iwl_dev_tx_power_cmd_per_band per_band; 439 union { 440 struct iwl_dev_tx_power_cmd_v3 v3; 441 struct iwl_dev_tx_power_cmd_v4 v4; 442 struct iwl_dev_tx_power_cmd_v5 v5; 443 struct iwl_dev_tx_power_cmd_v6 v6; 444 struct iwl_dev_tx_power_cmd_v7 v7; 445 struct iwl_dev_tx_power_cmd_v8 v8; 446 }; 447 }; 448 449 /** 450 * struct iwl_dev_tx_power_cmd_v9 - TX power reduction cmd 451 * @reserved: reserved (padding) 452 * @per_chain: per chain restrictions 453 * @per_chain_restriction_changed: is per_chain_restriction has changed 454 * from last command. used if set_mode is 455 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 456 * note: if not changed, the command is used for keep alive only. 457 * @reserved1: reserved (padding) 458 * @timer_period: timer in milliseconds. if expires FW will change to default 459 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 460 */ 461 struct iwl_dev_tx_power_cmd_v9 { 462 __le16 reserved; 463 __le16 per_chain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 464 u8 per_chain_restriction_changed; 465 u8 reserved1[3]; 466 __le32 timer_period; 467 } __packed; /* TX_REDUCED_POWER_API_S_VER_9 */ 468 469 /** 470 * struct iwl_dev_tx_power_cmd_v10 - TX power reduction cmd 471 * @per_chain: per chain restrictions 472 * @per_chain_restriction_changed: is per_chain_restriction has changed 473 * from last command. used if set_mode is 474 * IWL_TX_POWER_MODE_SET_SAR_TIMER. 475 * note: if not changed, the command is used for keep alive only. 476 * @reserved: reserved (padding) 477 * @timer_period: timer in milliseconds. if expires FW will change to default 478 * BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER 479 * @flags: reduce power flags. 480 */ 481 struct iwl_dev_tx_power_cmd_v10 { 482 __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 483 u8 per_chain_restriction_changed; 484 u8 reserved; 485 __le32 timer_period; 486 __le32 flags; 487 } __packed; /* TX_REDUCED_POWER_API_S_VER_10 */ 488 489 /* 490 * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion) 491 * @common: common part of the command 492 * @v9: version 9 part of the command 493 * @v10: version 10 part of the command 494 */ 495 struct iwl_dev_tx_power_cmd { 496 struct iwl_dev_tx_power_common common; 497 union { 498 struct iwl_dev_tx_power_cmd_v9 v9; 499 struct iwl_dev_tx_power_cmd_v10 v10; 500 }; 501 } __packed; /* TX_REDUCED_POWER_API_S_VER_9_VER10 */ 502 503 #define IWL_NUM_GEO_PROFILES 3 504 #define IWL_NUM_GEO_PROFILES_V3 8 505 #define IWL_NUM_BANDS_PER_CHAIN_V1 2 506 #define IWL_NUM_BANDS_PER_CHAIN_V2 3 507 508 /** 509 * enum iwl_geo_per_chain_offset_operation - type of operation 510 * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW. 511 * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table. 512 */ 513 enum iwl_geo_per_chain_offset_operation { 514 IWL_PER_CHAIN_OFFSET_SET_TABLES, 515 IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE, 516 }; /* PER_CHAIN_OFFSET_OPERATION_E */ 517 518 /** 519 * struct iwl_per_chain_offset - embedded struct for PER_CHAIN_LIMIT_OFFSET_CMD. 520 * @max_tx_power: maximum allowed tx power. 521 * @chain_a: tx power offset for chain a. 522 * @chain_b: tx power offset for chain b. 523 */ 524 struct iwl_per_chain_offset { 525 __le16 max_tx_power; 526 u8 chain_a; 527 u8 chain_b; 528 } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */ 529 530 /** 531 * struct iwl_geo_tx_power_profiles_cmd_v1 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd. 532 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation 533 * @table: offset profile per band. 534 */ 535 struct iwl_geo_tx_power_profiles_cmd_v1 { 536 __le32 ops; 537 struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1]; 538 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_1 */ 539 540 /** 541 * struct iwl_geo_tx_power_profiles_cmd_v2 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd. 542 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation 543 * @table: offset profile per band. 544 * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading) 545 */ 546 struct iwl_geo_tx_power_profiles_cmd_v2 { 547 __le32 ops; 548 struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1]; 549 __le32 table_revision; 550 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_2 */ 551 552 /** 553 * struct iwl_geo_tx_power_profiles_cmd_v3 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd. 554 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation 555 * @table: offset profile per band. 556 * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading) 557 */ 558 struct iwl_geo_tx_power_profiles_cmd_v3 { 559 __le32 ops; 560 struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2]; 561 __le32 table_revision; 562 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_3 */ 563 564 /** 565 * struct iwl_geo_tx_power_profiles_cmd_v4 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd. 566 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation 567 * @table: offset profile per band. 568 * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading) 569 */ 570 struct iwl_geo_tx_power_profiles_cmd_v4 { 571 __le32 ops; 572 struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V1]; 573 __le32 table_revision; 574 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_4 */ 575 576 /** 577 * struct iwl_geo_tx_power_profiles_cmd_v5 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd. 578 * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation 579 * @table: offset profile per band. 580 * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading) 581 */ 582 struct iwl_geo_tx_power_profiles_cmd_v5 { 583 __le32 ops; 584 struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V2]; 585 __le32 table_revision; 586 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_5 */ 587 588 union iwl_geo_tx_power_profiles_cmd { 589 struct iwl_geo_tx_power_profiles_cmd_v1 v1; 590 struct iwl_geo_tx_power_profiles_cmd_v2 v2; 591 struct iwl_geo_tx_power_profiles_cmd_v3 v3; 592 struct iwl_geo_tx_power_profiles_cmd_v4 v4; 593 struct iwl_geo_tx_power_profiles_cmd_v5 v5; 594 }; 595 596 /** 597 * struct iwl_geo_tx_power_profiles_resp - response to PER_CHAIN_LIMIT_OFFSET_CMD cmd 598 * @profile_idx: current geo profile in use 599 */ 600 struct iwl_geo_tx_power_profiles_resp { 601 __le32 profile_idx; 602 } __packed; /* PER_CHAIN_LIMIT_OFFSET_RSP */ 603 604 /** 605 * enum iwl_ppag_flags - PPAG enable masks 606 * @IWL_PPAG_ETSI_MASK: enable PPAG in ETSI 607 * @IWL_PPAG_CHINA_MASK: enable PPAG in China 608 * @IWL_PPAG_ETSI_LPI_UHB_MASK: enable LPI in ETSI for UHB 609 * @IWL_PPAG_ETSI_VLP_UHB_MASK: enable VLP in ETSI for UHB 610 * @IWL_PPAG_ETSI_SP_UHB_MASK: enable SP in ETSI for UHB 611 * @IWL_PPAG_USA_LPI_UHB_MASK: enable LPI in USA for UHB 612 * @IWL_PPAG_USA_VLP_UHB_MASK: enable VLP in USA for UHB 613 * @IWL_PPAG_USA_SP_UHB_MASK: enable SP in USA for UHB 614 * @IWL_PPAG_CANADA_LPI_UHB_MASK: enable LPI in CANADA for UHB 615 * @IWL_PPAG_CANADA_VLP_UHB_MASK: enable VLP in CANADA for UHB 616 * @IWL_PPAG_CANADA_SP_UHB_MASK: enable SP in CANADA for UHB 617 */ 618 enum iwl_ppag_flags { 619 IWL_PPAG_ETSI_MASK = BIT(0), 620 IWL_PPAG_CHINA_MASK = BIT(1), 621 IWL_PPAG_ETSI_LPI_UHB_MASK = BIT(2), 622 IWL_PPAG_ETSI_VLP_UHB_MASK = BIT(3), 623 IWL_PPAG_ETSI_SP_UHB_MASK = BIT(4), 624 IWL_PPAG_USA_LPI_UHB_MASK = BIT(5), 625 IWL_PPAG_USA_VLP_UHB_MASK = BIT(6), 626 IWL_PPAG_USA_SP_UHB_MASK = BIT(7), 627 IWL_PPAG_CANADA_LPI_UHB_MASK = BIT(8), 628 IWL_PPAG_CANADA_VLP_UHB_MASK = BIT(9), 629 IWL_PPAG_CANADA_SP_UHB_MASK = BIT(10), 630 }; 631 632 /** 633 * union iwl_ppag_table_cmd - union for all versions of PPAG command 634 * @v1: command version 1 structure. 635 * @v2: command version from 2 to 6 are same structure as v2. 636 * but has a different format of the flags bitmap 637 * @v3: command version 7 structure. 638 * @v1.flags: values from &enum iwl_ppag_flags 639 * @v1.gain: table of antenna gain values per chain and sub-band 640 * @v1.reserved: reserved 641 * @v2.flags: values from &enum iwl_ppag_flags 642 * @v2.gain: table of antenna gain values per chain and sub-band 643 * @v3.ppag_config_info: see @struct bios_value_u32 644 * @v3.gain: table of antenna gain values per chain and sub-band 645 * @v3.reserved: reserved 646 */ 647 union iwl_ppag_table_cmd { 648 struct { 649 __le32 flags; 650 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 651 s8 reserved[2]; 652 } __packed v1; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_1 */ 653 struct { 654 __le32 flags; 655 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 656 s8 reserved[2]; 657 } __packed v2; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_2, VER3, VER4, 658 * VER5, VER6 659 */ 660 struct { 661 struct bios_value_u32 ppag_config_info; 662 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 663 s8 reserved[2]; 664 } __packed v3; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */ 665 } __packed; 666 667 #define IWL_PPAG_CMD_V4_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK) 668 #define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V4_MASK | \ 669 IWL_PPAG_ETSI_LPI_UHB_MASK | \ 670 IWL_PPAG_USA_LPI_UHB_MASK) 671 672 #define IWL_PPAG_CMD_V6_MASK (IWL_PPAG_CMD_V5_MASK | \ 673 IWL_PPAG_ETSI_VLP_UHB_MASK | \ 674 IWL_PPAG_ETSI_SP_UHB_MASK | \ 675 IWL_PPAG_USA_VLP_UHB_MASK | \ 676 IWL_PPAG_USA_SP_UHB_MASK | \ 677 IWL_PPAG_CANADA_LPI_UHB_MASK | \ 678 IWL_PPAG_CANADA_VLP_UHB_MASK | \ 679 IWL_PPAG_CANADA_SP_UHB_MASK) 680 681 #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE 26 682 #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE 13 683 684 /** 685 * struct iwl_sar_offset_mapping_cmd - struct for SAR_OFFSET_MAPPING_TABLE_CMD 686 * @offset_map: mapping a mcc to a geo sar group 687 * @reserved: reserved 688 */ 689 struct iwl_sar_offset_mapping_cmd { 690 u8 offset_map[MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE] 691 [MCC_TO_SAR_OFFSET_TABLE_COL_SIZE]; 692 __le16 reserved; 693 } __packed; /*SAR_OFFSET_MAPPING_TABLE_CMD_API_S*/ 694 695 /** 696 * struct iwl_beacon_filter_cmd 697 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command) 698 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon 699 * to driver if delta in Energy values calculated for this and last 700 * passed beacon is greater than this threshold. Zero value means that 701 * the Energy change is ignored for beacon filtering, and beacon will 702 * not be forced to be sent to driver regardless of this delta. Typical 703 * energy delta 5dB. 704 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state. 705 * Send beacon to driver if delta in Energy values calculated for this 706 * and last passed beacon is greater than this threshold. Zero value 707 * means that the Energy change is ignored for beacon filtering while in 708 * Roaming state, typical energy delta 1dB. 709 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values 710 * calculated for current beacon is less than the threshold, use 711 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta 712 * Threshold. Typical energy threshold is -72dBm. 713 * @bf_temp_threshold: This threshold determines the type of temperature 714 * filtering (Slow or Fast) that is selected (Units are in Celsius): 715 * If the current temperature is above this threshold - Fast filter 716 * will be used, If the current temperature is below this threshold - 717 * Slow filter will be used. 718 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values 719 * calculated for this and the last passed beacon is greater than this 720 * threshold. Zero value means that the temperature change is ignored for 721 * beacon filtering; beacons will not be forced to be sent to driver 722 * regardless of whether its temperature has been changed. 723 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values 724 * calculated for this and the last passed beacon is greater than this 725 * threshold. Zero value means that the temperature change is ignored for 726 * beacon filtering; beacons will not be forced to be sent to driver 727 * regardless of whether its temperature has been changed. 728 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled. 729 * @bf_debug_flag: beacon filtering debug configuration 730 * @bf_escape_timer: Send beacons to to driver if no beacons were passed 731 * for a specific period of time. Units: Beacons. 732 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed 733 * for a longer period of time then this escape-timeout. Units: Beacons. 734 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled. 735 * @bf_threshold_absolute_low: See below. 736 * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated 737 * for this beacon crossed this absolute threshold. For the 'Increase' 738 * direction the bf_energy_absolute_low[i] is used. For the 'Decrease' 739 * direction the bf_energy_absolute_high[i] is used. Zero value means 740 * that this specific threshold is ignored for beacon filtering, and 741 * beacon will not be forced to be sent to driver due to this setting. 742 */ 743 struct iwl_beacon_filter_cmd { 744 __le32 bf_energy_delta; 745 __le32 bf_roaming_energy_delta; 746 __le32 bf_roaming_state; 747 __le32 bf_temp_threshold; 748 __le32 bf_temp_fast_filter; 749 __le32 bf_temp_slow_filter; 750 __le32 bf_enable_beacon_filter; 751 __le32 bf_debug_flag; 752 __le32 bf_escape_timer; 753 __le32 ba_escape_timer; 754 __le32 ba_enable_beacon_abort; 755 __le32 bf_threshold_absolute_low[2]; 756 __le32 bf_threshold_absolute_high[2]; 757 } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */ 758 759 /* Beacon filtering and beacon abort */ 760 #define IWL_BF_ENERGY_DELTA_DEFAULT 5 761 #define IWL_BF_ENERGY_DELTA_D0I3 20 762 #define IWL_BF_ENERGY_DELTA_MAX 255 763 #define IWL_BF_ENERGY_DELTA_MIN 0 764 765 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1 766 #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20 767 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255 768 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0 769 770 #define IWL_BF_ROAMING_STATE_DEFAULT 72 771 #define IWL_BF_ROAMING_STATE_D0I3 72 772 #define IWL_BF_ROAMING_STATE_MAX 255 773 #define IWL_BF_ROAMING_STATE_MIN 0 774 775 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112 776 #define IWL_BF_TEMP_THRESHOLD_D0I3 112 777 #define IWL_BF_TEMP_THRESHOLD_MAX 255 778 #define IWL_BF_TEMP_THRESHOLD_MIN 0 779 780 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1 781 #define IWL_BF_TEMP_FAST_FILTER_D0I3 1 782 #define IWL_BF_TEMP_FAST_FILTER_MAX 255 783 #define IWL_BF_TEMP_FAST_FILTER_MIN 0 784 785 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5 786 #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20 787 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255 788 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0 789 790 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1 791 792 #define IWL_BF_DEBUG_FLAG_DEFAULT 0 793 #define IWL_BF_DEBUG_FLAG_D0I3 0 794 795 #define IWL_BF_ESCAPE_TIMER_DEFAULT 0 796 #define IWL_BF_ESCAPE_TIMER_D0I3 0 797 #define IWL_BF_ESCAPE_TIMER_MAX 1024 798 #define IWL_BF_ESCAPE_TIMER_MIN 0 799 800 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6 801 #define IWL_BA_ESCAPE_TIMER_D0I3 6 802 #define IWL_BA_ESCAPE_TIMER_D3 9 803 #define IWL_BA_ESCAPE_TIMER_MAX 1024 804 #define IWL_BA_ESCAPE_TIMER_MIN 0 805 806 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1 807 808 #define IWL_BF_CMD_CONFIG(mode) \ 809 .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode), \ 810 .bf_roaming_energy_delta = \ 811 cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode), \ 812 .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode), \ 813 .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode), \ 814 .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode), \ 815 .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode), \ 816 .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode), \ 817 .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode), \ 818 .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode) 819 820 #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT) 821 #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3) 822 823 #define DEFAULT_TPE_TX_POWER 0x7F 824 825 /* 826 * Bandwidth: 20/40/80/(160/80+80)/320 827 */ 828 #define IWL_MAX_TX_EIRP_PWR_MAX_SIZE 5 829 #define IWL_MAX_TX_EIRP_PSD_PWR_MAX_SIZE 16 830 831 enum iwl_6ghz_ap_type { 832 IWL_6GHZ_AP_TYPE_LPI, 833 IWL_6GHZ_AP_TYPE_SP, 834 IWL_6GHZ_AP_TYPE_VLP, 835 }; /* PHY_AP_TYPE_API_E_VER_1 */ 836 837 /** 838 * struct iwl_txpower_constraints_cmd 839 * AP_TX_POWER_CONSTRAINTS_CMD 840 * Used for VLP/LPI/AFC Access Point power constraints for 6GHz channels 841 * @link_id: linkId 842 * @ap_type: see &enum iwl_ap_type 843 * @eirp_pwr: 8-bit 2s complement signed integer in the range 844 * -64 dBm to 63 dBm with a 0.5 dB step 845 * default &DEFAULT_TPE_TX_POWER (no maximum limit) 846 * @psd_pwr: 8-bit 2s complement signed integer in the range 847 * -63.5 to +63 dBm/MHz with a 0.5 step 848 * value - 128 indicates that the corresponding 20 849 * MHz channel cannot be used for transmission. 850 * value +127 indicates that no maximum PSD limit 851 * is specified for the corresponding 20 MHz channel 852 * default &DEFAULT_TPE_TX_POWER (no maximum limit) 853 * @reserved: reserved (padding) 854 */ 855 struct iwl_txpower_constraints_cmd { 856 __le16 link_id; 857 __le16 ap_type; 858 __s8 eirp_pwr[IWL_MAX_TX_EIRP_PWR_MAX_SIZE]; 859 __s8 psd_pwr[IWL_MAX_TX_EIRP_PSD_PWR_MAX_SIZE]; 860 u8 reserved[3]; 861 } __packed; /* PHY_AP_TX_POWER_CONSTRAINTS_CMD_API_S_VER_1 */ 862 #endif /* __iwl_fw_api_power_h__ */ 863