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 * @v2: command version from 2 to 6 are same structure as v2. 575 * but has a different format of the flags bitmap 576 * @v3: command version 7 structure. 577 * @v1.flags: values from &enum iwl_ppag_flags 578 * @v1.gain: table of antenna gain values per chain and sub-band 579 * @v1.reserved: reserved 580 * @v2.flags: values from &enum iwl_ppag_flags 581 * @v2.gain: table of antenna gain values per chain and sub-band 582 * @v3.ppag_config_info: see @struct bios_value_u32 583 * @v3.gain: table of antenna gain values per chain and sub-band 584 * @v3.reserved: reserved 585 */ 586 union iwl_ppag_table_cmd { 587 struct { 588 __le32 flags; 589 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1]; 590 s8 reserved[2]; 591 } __packed v1; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_1 */ 592 struct { 593 __le32 flags; 594 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 595 s8 reserved[2]; 596 } __packed v2; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_2, VER3, VER4, 597 * VER5, VER6 598 */ 599 struct { 600 struct bios_value_u32 ppag_config_info; 601 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2]; 602 s8 reserved[2]; 603 } __packed v3; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */ 604 } __packed; 605 606 #define IWL_PPAG_CMD_V4_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK) 607 #define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V4_MASK | \ 608 IWL_PPAG_ETSI_LPI_UHB_MASK | \ 609 IWL_PPAG_USA_LPI_UHB_MASK) 610 611 #define IWL_PPAG_CMD_V6_MASK (IWL_PPAG_CMD_V5_MASK | \ 612 IWL_PPAG_ETSI_VLP_UHB_MASK | \ 613 IWL_PPAG_ETSI_SP_UHB_MASK | \ 614 IWL_PPAG_USA_VLP_UHB_MASK | \ 615 IWL_PPAG_USA_SP_UHB_MASK | \ 616 IWL_PPAG_CANADA_LPI_UHB_MASK | \ 617 IWL_PPAG_CANADA_VLP_UHB_MASK | \ 618 IWL_PPAG_CANADA_SP_UHB_MASK) 619 620 #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE 26 621 #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE 13 622 623 /** 624 * struct iwl_sar_offset_mapping_cmd - struct for SAR_OFFSET_MAPPING_TABLE_CMD 625 * @offset_map: mapping a mcc to a geo sar group 626 * @reserved: reserved 627 */ 628 struct iwl_sar_offset_mapping_cmd { 629 u8 offset_map[MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE] 630 [MCC_TO_SAR_OFFSET_TABLE_COL_SIZE]; 631 __le16 reserved; 632 } __packed; /*SAR_OFFSET_MAPPING_TABLE_CMD_API_S*/ 633 634 /** 635 * struct iwl_beacon_filter_cmd 636 * REPLY_BEACON_FILTERING_CMD = 0xd2 (command) 637 * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon 638 * to driver if delta in Energy values calculated for this and last 639 * passed beacon is greater than this threshold. Zero value means that 640 * the Energy change is ignored for beacon filtering, and beacon will 641 * not be forced to be sent to driver regardless of this delta. Typical 642 * energy delta 5dB. 643 * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state. 644 * Send beacon to driver if delta in Energy values calculated for this 645 * and last passed beacon is greater than this threshold. Zero value 646 * means that the Energy change is ignored for beacon filtering while in 647 * Roaming state, typical energy delta 1dB. 648 * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values 649 * calculated for current beacon is less than the threshold, use 650 * Roaming Energy Delta Threshold, otherwise use normal Energy Delta 651 * Threshold. Typical energy threshold is -72dBm. 652 * @bf_temp_threshold: This threshold determines the type of temperature 653 * filtering (Slow or Fast) that is selected (Units are in Celsius): 654 * If the current temperature is above this threshold - Fast filter 655 * will be used, If the current temperature is below this threshold - 656 * Slow filter will be used. 657 * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values 658 * calculated for this and the last passed beacon is greater than this 659 * threshold. Zero value means that the temperature change is ignored for 660 * beacon filtering; beacons will not be forced to be sent to driver 661 * regardless of whether its temperature has been changed. 662 * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values 663 * calculated for this and the last passed beacon is greater than this 664 * threshold. Zero value means that the temperature change is ignored for 665 * beacon filtering; beacons will not be forced to be sent to driver 666 * regardless of whether its temperature has been changed. 667 * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled. 668 * @bf_debug_flag: beacon filtering debug configuration 669 * @bf_escape_timer: Send beacons to to driver if no beacons were passed 670 * for a specific period of time. Units: Beacons. 671 * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed 672 * for a longer period of time then this escape-timeout. Units: Beacons. 673 * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled. 674 * @bf_threshold_absolute_low: See below. 675 * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated 676 * for this beacon crossed this absolute threshold. For the 'Increase' 677 * direction the bf_energy_absolute_low[i] is used. For the 'Decrease' 678 * direction the bf_energy_absolute_high[i] is used. Zero value means 679 * that this specific threshold is ignored for beacon filtering, and 680 * beacon will not be forced to be sent to driver due to this setting. 681 */ 682 struct iwl_beacon_filter_cmd { 683 __le32 bf_energy_delta; 684 __le32 bf_roaming_energy_delta; 685 __le32 bf_roaming_state; 686 __le32 bf_temp_threshold; 687 __le32 bf_temp_fast_filter; 688 __le32 bf_temp_slow_filter; 689 __le32 bf_enable_beacon_filter; 690 __le32 bf_debug_flag; 691 __le32 bf_escape_timer; 692 __le32 ba_escape_timer; 693 __le32 ba_enable_beacon_abort; 694 __le32 bf_threshold_absolute_low[2]; 695 __le32 bf_threshold_absolute_high[2]; 696 } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */ 697 698 /* Beacon filtering and beacon abort */ 699 #define IWL_BF_ENERGY_DELTA_DEFAULT 5 700 #define IWL_BF_ENERGY_DELTA_D0I3 20 701 #define IWL_BF_ENERGY_DELTA_MAX 255 702 #define IWL_BF_ENERGY_DELTA_MIN 0 703 704 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1 705 #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20 706 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255 707 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0 708 709 #define IWL_BF_ROAMING_STATE_DEFAULT 72 710 #define IWL_BF_ROAMING_STATE_D0I3 72 711 #define IWL_BF_ROAMING_STATE_MAX 255 712 #define IWL_BF_ROAMING_STATE_MIN 0 713 714 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112 715 #define IWL_BF_TEMP_THRESHOLD_D0I3 112 716 #define IWL_BF_TEMP_THRESHOLD_MAX 255 717 #define IWL_BF_TEMP_THRESHOLD_MIN 0 718 719 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1 720 #define IWL_BF_TEMP_FAST_FILTER_D0I3 1 721 #define IWL_BF_TEMP_FAST_FILTER_MAX 255 722 #define IWL_BF_TEMP_FAST_FILTER_MIN 0 723 724 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5 725 #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20 726 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255 727 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0 728 729 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1 730 731 #define IWL_BF_DEBUG_FLAG_DEFAULT 0 732 #define IWL_BF_DEBUG_FLAG_D0I3 0 733 734 #define IWL_BF_ESCAPE_TIMER_DEFAULT 0 735 #define IWL_BF_ESCAPE_TIMER_D0I3 0 736 #define IWL_BF_ESCAPE_TIMER_MAX 1024 737 #define IWL_BF_ESCAPE_TIMER_MIN 0 738 739 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6 740 #define IWL_BA_ESCAPE_TIMER_D0I3 6 741 #define IWL_BA_ESCAPE_TIMER_D3 9 742 #define IWL_BA_ESCAPE_TIMER_MAX 1024 743 #define IWL_BA_ESCAPE_TIMER_MIN 0 744 745 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1 746 747 #define IWL_BF_CMD_CONFIG(mode) \ 748 .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode), \ 749 .bf_roaming_energy_delta = \ 750 cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode), \ 751 .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode), \ 752 .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode), \ 753 .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode), \ 754 .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode), \ 755 .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode), \ 756 .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode), \ 757 .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode) 758 759 #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT) 760 #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3) 761 762 #define DEFAULT_TPE_TX_POWER 0x7F 763 764 /* 765 * Bandwidth: 20/40/80/(160/80+80)/320 766 */ 767 #define IWL_MAX_TX_EIRP_PWR_MAX_SIZE 5 768 #define IWL_MAX_TX_EIRP_PSD_PWR_MAX_SIZE 16 769 770 enum iwl_6ghz_ap_type { 771 IWL_6GHZ_AP_TYPE_LPI, 772 IWL_6GHZ_AP_TYPE_SP, 773 IWL_6GHZ_AP_TYPE_VLP, 774 }; /* PHY_AP_TYPE_API_E_VER_1 */ 775 776 /** 777 * struct iwl_txpower_constraints_cmd 778 * AP_TX_POWER_CONSTRAINTS_CMD 779 * Used for VLP/LPI/AFC Access Point power constraints for 6GHz channels 780 * @link_id: linkId 781 * @ap_type: see &enum iwl_ap_type 782 * @eirp_pwr: 8-bit 2s complement signed integer in the range 783 * -64 dBm to 63 dBm with a 0.5 dB step 784 * default &DEFAULT_TPE_TX_POWER (no maximum limit) 785 * @psd_pwr: 8-bit 2s complement signed integer in the range 786 * -63.5 to +63 dBm/MHz with a 0.5 step 787 * value - 128 indicates that the corresponding 20 788 * MHz channel cannot be used for transmission. 789 * value +127 indicates that no maximum PSD limit 790 * is specified for the corresponding 20 MHz channel 791 * default &DEFAULT_TPE_TX_POWER (no maximum limit) 792 * @reserved: reserved (padding) 793 */ 794 struct iwl_txpower_constraints_cmd { 795 __le16 link_id; 796 __le16 ap_type; 797 __s8 eirp_pwr[IWL_MAX_TX_EIRP_PWR_MAX_SIZE]; 798 __s8 psd_pwr[IWL_MAX_TX_EIRP_PSD_PWR_MAX_SIZE]; 799 u8 reserved[3]; 800 } __packed; /* PHY_AP_TX_POWER_CONSTRAINTS_CMD_API_S_VER_1 */ 801 #endif /* __iwl_fw_api_power_h__ */ 802