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