Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
0004  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
0005  * Copyright (C) 2015-2017 Intel Deutschland GmbH
0006  */
0007 #ifndef __iwl_fw_api_power_h__
0008 #define __iwl_fw_api_power_h__
0009 
0010 /* Power Management Commands, Responses, Notifications */
0011 
0012 /**
0013  * enum iwl_ltr_config_flags - masks for LTR config command flags
0014  * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status
0015  * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow
0016  *  memory access
0017  * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR
0018  *  reg change
0019  * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from
0020  *  D0 to D3
0021  * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register
0022  * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register
0023  * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD
0024  * @LTR_CFG_FLAG_UPDATE_VALUES: update config values and short
0025  *  idle timeout
0026  */
0027 enum iwl_ltr_config_flags {
0028     LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0),
0029     LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1),
0030     LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2),
0031     LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3),
0032     LTR_CFG_FLAG_SW_SET_SHORT = BIT(4),
0033     LTR_CFG_FLAG_SW_SET_LONG = BIT(5),
0034     LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6),
0035     LTR_CFG_FLAG_UPDATE_VALUES = BIT(7),
0036 };
0037 
0038 /**
0039  * struct iwl_ltr_config_cmd_v1 - configures the LTR
0040  * @flags: See &enum iwl_ltr_config_flags
0041  * @static_long: static LTR Long register value.
0042  * @static_short: static LTR Short register value.
0043  */
0044 struct iwl_ltr_config_cmd_v1 {
0045     __le32 flags;
0046     __le32 static_long;
0047     __le32 static_short;
0048 } __packed; /* LTR_CAPABLE_API_S_VER_1 */
0049 
0050 #define LTR_VALID_STATES_NUM 4
0051 
0052 /**
0053  * struct iwl_ltr_config_cmd - configures the LTR
0054  * @flags: See &enum iwl_ltr_config_flags
0055  * @static_long: static LTR Long register value.
0056  * @static_short: static LTR Short register value.
0057  * @ltr_cfg_values: LTR parameters table values (in usec) in folowing order:
0058  *  TX, RX, Short Idle, Long Idle. Used only if %LTR_CFG_FLAG_UPDATE_VALUES
0059  *  is set.
0060  * @ltr_short_idle_timeout: LTR Short Idle timeout (in usec). Used only if
0061  *  %LTR_CFG_FLAG_UPDATE_VALUES is set.
0062  */
0063 struct iwl_ltr_config_cmd {
0064     __le32 flags;
0065     __le32 static_long;
0066     __le32 static_short;
0067     __le32 ltr_cfg_values[LTR_VALID_STATES_NUM];
0068     __le32 ltr_short_idle_timeout;
0069 } __packed; /* LTR_CAPABLE_API_S_VER_2 */
0070 
0071 /* Radio LP RX Energy Threshold measured in dBm */
0072 #define POWER_LPRX_RSSI_THRESHOLD   75
0073 #define POWER_LPRX_RSSI_THRESHOLD_MAX   94
0074 #define POWER_LPRX_RSSI_THRESHOLD_MIN   30
0075 
0076 /**
0077  * enum iwl_power_flags - masks for power table command flags
0078  * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off
0079  *      receiver and transmitter. '0' - does not allow.
0080  * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management,
0081  *      '1' Driver enables PM (use rest of parameters)
0082  * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM,
0083  *      '1' PM could sleep over DTIM till listen Interval.
0084  * @POWER_FLAGS_SNOOZE_ENA_MSK: Enable snoozing only if uAPSD is enabled and all
0085  *      access categories are both delivery and trigger enabled.
0086  * @POWER_FLAGS_BT_SCO_ENA: Enable BT SCO coex only if uAPSD and
0087  *      PBW Snoozing enabled
0088  * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask
0089  * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable.
0090  * @POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK: AP/GO's uAPSD misbehaving
0091  *      detection enablement
0092 */
0093 enum iwl_power_flags {
0094     POWER_FLAGS_POWER_SAVE_ENA_MSK      = BIT(0),
0095     POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK    = BIT(1),
0096     POWER_FLAGS_SKIP_OVER_DTIM_MSK      = BIT(2),
0097     POWER_FLAGS_SNOOZE_ENA_MSK      = BIT(5),
0098     POWER_FLAGS_BT_SCO_ENA          = BIT(8),
0099     POWER_FLAGS_ADVANCE_PM_ENA_MSK      = BIT(9),
0100     POWER_FLAGS_LPRX_ENA_MSK        = BIT(11),
0101     POWER_FLAGS_UAPSD_MISBEHAVING_ENA_MSK   = BIT(12),
0102 };
0103 
0104 #define IWL_POWER_VEC_SIZE 5
0105 
0106 /**
0107  * struct iwl_powertable_cmd - legacy power command. Beside old API support this
0108  *  is used also with a new power API for device wide power settings.
0109  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
0110  *
0111  * @flags:      Power table command flags from POWER_FLAGS_*
0112  * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
0113  *          Minimum allowed:- 3 * DTIM. Keep alive period must be
0114  *          set regardless of power scheme or current power state.
0115  *          FW use this value also when PM is disabled.
0116  * @debug_flags:    debug flags
0117  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
0118  *          PSM transition - legacy PM
0119  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
0120  *          PSM transition - legacy PM
0121  * @sleep_interval: not in use
0122  * @skip_dtim_periods:  Number of DTIM periods to skip if Skip over DTIM flag
0123  *          is set. For example, if it is required to skip over
0124  *          one DTIM, this value need to be set to 2 (DTIM periods).
0125  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
0126  *          Default: 80dbm
0127  */
0128 struct iwl_powertable_cmd {
0129     /* PM_POWER_TABLE_CMD_API_S_VER_6 */
0130     __le16 flags;
0131     u8 keep_alive_seconds;
0132     u8 debug_flags;
0133     __le32 rx_data_timeout;
0134     __le32 tx_data_timeout;
0135     __le32 sleep_interval[IWL_POWER_VEC_SIZE];
0136     __le32 skip_dtim_periods;
0137     __le32 lprx_rssi_threshold;
0138 } __packed;
0139 
0140 /**
0141  * enum iwl_device_power_flags - masks for device power command flags
0142  * @DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK:
0143  *  '1' Allow to save power by turning off
0144  *  receiver and transmitter. '0' - does not allow.
0145  * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
0146  *  Device Retention indication, '1' indicate retention is enabled.
0147  * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
0148  *  32Khz external slow clock valid indication, '1' indicate cloack is
0149  *  valid.
0150 */
0151 enum iwl_device_power_flags {
0152     DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK       = BIT(0),
0153     DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK  = BIT(1),
0154     DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK        = BIT(12),
0155 };
0156 
0157 /**
0158  * struct iwl_device_power_cmd - device wide power command.
0159  * DEVICE_POWER_CMD = 0x77 (command, has simple generic response)
0160  *
0161  * @flags:  Power table command flags from &enum iwl_device_power_flags
0162  * @reserved: reserved (padding)
0163  */
0164 struct iwl_device_power_cmd {
0165     /* PM_POWER_TABLE_CMD_API_S_VER_6 */
0166     __le16 flags;
0167     __le16 reserved;
0168 } __packed;
0169 
0170 /**
0171  * struct iwl_mac_power_cmd - New power command containing uAPSD support
0172  * MAC_PM_POWER_TABLE = 0xA9 (command, has simple generic response)
0173  * @id_and_color:   MAC contex identifier, &enum iwl_ctxt_id_and_color
0174  * @flags:      Power table command flags from POWER_FLAGS_*
0175  * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec.
0176  *          Minimum allowed:- 3 * DTIM. Keep alive period must be
0177  *          set regardless of power scheme or current power state.
0178  *          FW use this value also when PM is disabled.
0179  * @rx_data_timeout:    Minimum time (usec) from last Rx packet for AM to
0180  *          PSM transition - legacy PM
0181  * @tx_data_timeout:    Minimum time (usec) from last Tx packet for AM to
0182  *          PSM transition - legacy PM
0183  * @skip_dtim_periods:  Number of DTIM periods to skip if Skip over DTIM flag
0184  *          is set. For example, if it is required to skip over
0185  *          one DTIM, this value need to be set to 2 (DTIM periods).
0186  * @rx_data_timeout_uapsd: Minimum time (usec) from last Rx packet for AM to
0187  *          PSM transition - uAPSD
0188  * @tx_data_timeout_uapsd: Minimum time (usec) from last Tx packet for AM to
0189  *          PSM transition - uAPSD
0190  * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled.
0191  *          Default: 80dbm
0192  * @snooze_interval:    Maximum time between attempts to retrieve buffered data
0193  *          from the AP [msec]
0194  * @snooze_window:  A window of time in which PBW snoozing insures that all
0195  *          packets received. It is also the minimum time from last
0196  *          received unicast RX packet, before client stops snoozing
0197  *          for data. [msec]
0198  * @snooze_step:    TBD
0199  * @qndp_tid:       TID client shall use for uAPSD QNDP triggers
0200  * @uapsd_ac_flags: Set trigger-enabled and delivery-enabled indication for
0201  *          each corresponding AC.
0202  *          Use IEEE80211_WMM_IE_STA_QOSINFO_AC* for correct values.
0203  * @uapsd_max_sp:   Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct
0204  *          values.
0205  * @heavy_tx_thld_packets:  TX threshold measured in number of packets
0206  * @heavy_rx_thld_packets:  RX threshold measured in number of packets
0207  * @heavy_tx_thld_percentage:   TX threshold measured in load's percentage
0208  * @heavy_rx_thld_percentage:   RX threshold measured in load's percentage
0209  * @limited_ps_threshold: (unused)
0210  * @reserved: reserved (padding)
0211  */
0212 struct iwl_mac_power_cmd {
0213     /* CONTEXT_DESC_API_T_VER_1 */
0214     __le32 id_and_color;
0215 
0216     /* CLIENT_PM_POWER_TABLE_S_VER_1 */
0217     __le16 flags;
0218     __le16 keep_alive_seconds;
0219     __le32 rx_data_timeout;
0220     __le32 tx_data_timeout;
0221     __le32 rx_data_timeout_uapsd;
0222     __le32 tx_data_timeout_uapsd;
0223     u8 lprx_rssi_threshold;
0224     u8 skip_dtim_periods;
0225     __le16 snooze_interval;
0226     __le16 snooze_window;
0227     u8 snooze_step;
0228     u8 qndp_tid;
0229     u8 uapsd_ac_flags;
0230     u8 uapsd_max_sp;
0231     u8 heavy_tx_thld_packets;
0232     u8 heavy_rx_thld_packets;
0233     u8 heavy_tx_thld_percentage;
0234     u8 heavy_rx_thld_percentage;
0235     u8 limited_ps_threshold;
0236     u8 reserved;
0237 } __packed;
0238 
0239 /*
0240  * struct iwl_uapsd_misbehaving_ap_notif - FW sends this notification when
0241  * associated AP is identified as improperly implementing uAPSD protocol.
0242  * PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78
0243  * @sta_id: index of station in uCode's station table - associated AP ID in
0244  *      this context.
0245  */
0246 struct iwl_uapsd_misbehaving_ap_notif {
0247     __le32 sta_id;
0248     u8 mac_id;
0249     u8 reserved[3];
0250 } __packed;
0251 
0252 /**
0253  * struct iwl_reduce_tx_power_cmd - TX power reduction command
0254  * REDUCE_TX_POWER_CMD = 0x9f
0255  * @flags: (reserved for future implementation)
0256  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
0257  * @pwr_restriction: TX power restriction in dBms.
0258  */
0259 struct iwl_reduce_tx_power_cmd {
0260     u8 flags;
0261     u8 mac_context_id;
0262     __le16 pwr_restriction;
0263 } __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
0264 
0265 enum iwl_dev_tx_power_cmd_mode {
0266     IWL_TX_POWER_MODE_SET_MAC = 0,
0267     IWL_TX_POWER_MODE_SET_DEVICE = 1,
0268     IWL_TX_POWER_MODE_SET_CHAINS = 2,
0269     IWL_TX_POWER_MODE_SET_ACK = 3,
0270     IWL_TX_POWER_MODE_SET_SAR_TIMER = 4,
0271     IWL_TX_POWER_MODE_SET_SAR_TIMER_DEFAULT_TABLE = 5,
0272 }; /* TX_POWER_REDUCED_FLAGS_TYPE_API_E_VER_5 */;
0273 
0274 #define IWL_NUM_CHAIN_TABLES    1
0275 #define IWL_NUM_CHAIN_TABLES_V2 2
0276 #define IWL_NUM_CHAIN_LIMITS    2
0277 #define IWL_NUM_SUB_BANDS_V1    5
0278 #define IWL_NUM_SUB_BANDS_V2    11
0279 
0280 /**
0281  * struct iwl_dev_tx_power_common - Common part of the TX power reduction cmd
0282  * @set_mode: see &enum iwl_dev_tx_power_cmd_mode
0283  * @mac_context_id: id of the mac ctx for which we are reducing TX power.
0284  * @pwr_restriction: TX power restriction in 1/8 dBms.
0285  * @dev_24: device TX power restriction in 1/8 dBms
0286  * @dev_52_low: device TX power restriction upper band - low
0287  * @dev_52_high: device TX power restriction upper band - high
0288  */
0289 struct iwl_dev_tx_power_common {
0290     __le32 set_mode;
0291     __le32 mac_context_id;
0292     __le16 pwr_restriction;
0293     __le16 dev_24;
0294     __le16 dev_52_low;
0295     __le16 dev_52_high;
0296 };
0297 
0298 /**
0299  * struct iwl_dev_tx_power_cmd_v3 - TX power reduction command version 3
0300  * @per_chain: per chain restrictions
0301  */
0302 struct iwl_dev_tx_power_cmd_v3 {
0303     __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
0304 } __packed; /* TX_REDUCED_POWER_API_S_VER_3 */
0305 
0306 #define IWL_DEV_MAX_TX_POWER 0x7FFF
0307 
0308 /**
0309  * struct iwl_dev_tx_power_cmd_v4 - TX power reduction command version 4
0310  * @per_chain: per chain restrictions
0311  * @enable_ack_reduction: enable or disable close range ack TX power
0312  *  reduction.
0313  * @reserved: reserved (padding)
0314  */
0315 struct iwl_dev_tx_power_cmd_v4 {
0316     __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
0317     u8 enable_ack_reduction;
0318     u8 reserved[3];
0319 } __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
0320 
0321 /**
0322  * struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5
0323  * @per_chain: per chain restrictions
0324  * @enable_ack_reduction: enable or disable close range ack TX power
0325  *  reduction.
0326  * @per_chain_restriction_changed: is per_chain_restriction has changed
0327  *  from last command. used if set_mode is
0328  *  IWL_TX_POWER_MODE_SET_SAR_TIMER.
0329  *  note: if not changed, the command is used for keep alive only.
0330  * @reserved: reserved (padding)
0331  * @timer_period: timer in milliseconds. if expires FW will change to default
0332  *  BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
0333  */
0334 struct iwl_dev_tx_power_cmd_v5 {
0335     __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
0336     u8 enable_ack_reduction;
0337     u8 per_chain_restriction_changed;
0338     u8 reserved[2];
0339     __le32 timer_period;
0340 } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
0341 
0342 /**
0343  * struct iwl_dev_tx_power_cmd_v6 - TX power reduction command version 6
0344  * @per_chain: per chain restrictions
0345  * @enable_ack_reduction: enable or disable close range ack TX power
0346  *  reduction.
0347  * @per_chain_restriction_changed: is per_chain_restriction has changed
0348  *  from last command. used if set_mode is
0349  *  IWL_TX_POWER_MODE_SET_SAR_TIMER.
0350  *  note: if not changed, the command is used for keep alive only.
0351  * @reserved: reserved (padding)
0352  * @timer_period: timer in milliseconds. if expires FW will change to default
0353  *  BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
0354  */
0355 struct iwl_dev_tx_power_cmd_v6 {
0356     __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
0357     u8 enable_ack_reduction;
0358     u8 per_chain_restriction_changed;
0359     u8 reserved[2];
0360     __le32 timer_period;
0361 } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
0362 
0363 /**
0364  * struct iwl_dev_tx_power_cmd_v7 - TX power reduction command version 7
0365  * @per_chain: per chain restrictions
0366  * @enable_ack_reduction: enable or disable close range ack TX power
0367  *  reduction.
0368  * @per_chain_restriction_changed: is per_chain_restriction has changed
0369  *  from last command. used if set_mode is
0370  *  IWL_TX_POWER_MODE_SET_SAR_TIMER.
0371  *  note: if not changed, the command is used for keep alive only.
0372  * @reserved: reserved (padding)
0373  * @timer_period: timer in milliseconds. if expires FW will change to default
0374  *  BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
0375  * @flags: reduce power flags.
0376  */
0377 struct iwl_dev_tx_power_cmd_v7 {
0378     __le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
0379     u8 enable_ack_reduction;
0380     u8 per_chain_restriction_changed;
0381     u8 reserved[2];
0382     __le32 timer_period;
0383     __le32 flags;
0384 } __packed; /* TX_REDUCED_POWER_API_S_VER_7 */
0385 /**
0386  * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
0387  * @common: common part of the command
0388  * @v3: version 3 part of the command
0389  * @v4: version 4 part of the command
0390  * @v5: version 5 part of the command
0391  * @v6: version 6 part of the command
0392  */
0393 struct iwl_dev_tx_power_cmd {
0394     struct iwl_dev_tx_power_common common;
0395     union {
0396         struct iwl_dev_tx_power_cmd_v3 v3;
0397         struct iwl_dev_tx_power_cmd_v4 v4;
0398         struct iwl_dev_tx_power_cmd_v5 v5;
0399         struct iwl_dev_tx_power_cmd_v6 v6;
0400         struct iwl_dev_tx_power_cmd_v7 v7;
0401     };
0402 };
0403 
0404 #define IWL_NUM_GEO_PROFILES        3
0405 #define IWL_NUM_GEO_PROFILES_V3     8
0406 #define IWL_NUM_BANDS_PER_CHAIN_V1  2
0407 #define IWL_NUM_BANDS_PER_CHAIN_V2  3
0408 
0409 /**
0410  * enum iwl_geo_per_chain_offset_operation - type of operation
0411  * @IWL_PER_CHAIN_OFFSET_SET_TABLES: send the tables from the host to the FW.
0412  * @IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE: retrieve the last configured table.
0413  */
0414 enum iwl_geo_per_chain_offset_operation {
0415     IWL_PER_CHAIN_OFFSET_SET_TABLES,
0416     IWL_PER_CHAIN_OFFSET_GET_CURRENT_TABLE,
0417 };  /* PER_CHAIN_OFFSET_OPERATION_E */
0418 
0419 /**
0420  * struct iwl_per_chain_offset - embedded struct for PER_CHAIN_LIMIT_OFFSET_CMD.
0421  * @max_tx_power: maximum allowed tx power.
0422  * @chain_a: tx power offset for chain a.
0423  * @chain_b: tx power offset for chain b.
0424  */
0425 struct iwl_per_chain_offset {
0426     __le16 max_tx_power;
0427     u8 chain_a;
0428     u8 chain_b;
0429 } __packed; /* PER_CHAIN_LIMIT_OFFSET_PER_CHAIN_S_VER_1 */
0430 
0431 /**
0432  * struct iwl_geo_tx_power_profile_cmd_v1 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
0433  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
0434  * @table: offset profile per band.
0435  */
0436 struct iwl_geo_tx_power_profiles_cmd_v1 {
0437     __le32 ops;
0438     struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
0439 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_1 */
0440 
0441 /**
0442  * struct iwl_geo_tx_power_profile_cmd_v2 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
0443  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
0444  * @table: offset profile per band.
0445  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
0446  */
0447 struct iwl_geo_tx_power_profiles_cmd_v2 {
0448     __le32 ops;
0449     struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V1];
0450     __le32 table_revision;
0451 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_2 */
0452 
0453 /**
0454  * struct iwl_geo_tx_power_profile_cmd_v3 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
0455  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
0456  * @table: offset profile per band.
0457  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
0458  */
0459 struct iwl_geo_tx_power_profiles_cmd_v3 {
0460     __le32 ops;
0461     struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES][IWL_NUM_BANDS_PER_CHAIN_V2];
0462     __le32 table_revision;
0463 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_3 */
0464 
0465 /**
0466  * struct iwl_geo_tx_power_profile_cmd_v4 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
0467  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
0468  * @table: offset profile per band.
0469  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
0470  */
0471 struct iwl_geo_tx_power_profiles_cmd_v4 {
0472     __le32 ops;
0473     struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V1];
0474     __le32 table_revision;
0475 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_4 */
0476 
0477 /**
0478  * struct iwl_geo_tx_power_profile_cmd_v5 - struct for PER_CHAIN_LIMIT_OFFSET_CMD cmd.
0479  * @ops: operations, value from &enum iwl_geo_per_chain_offset_operation
0480  * @table: offset profile per band.
0481  * @table_revision: 0 for not-South Korea, 1 for South Korea (the name is misleading)
0482  */
0483 struct iwl_geo_tx_power_profiles_cmd_v5 {
0484     __le32 ops;
0485     struct iwl_per_chain_offset table[IWL_NUM_GEO_PROFILES_V3][IWL_NUM_BANDS_PER_CHAIN_V2];
0486     __le32 table_revision;
0487 } __packed; /* PER_CHAIN_LIMIT_OFFSET_CMD_VER_5 */
0488 
0489 union iwl_geo_tx_power_profiles_cmd {
0490     struct iwl_geo_tx_power_profiles_cmd_v1 v1;
0491     struct iwl_geo_tx_power_profiles_cmd_v2 v2;
0492     struct iwl_geo_tx_power_profiles_cmd_v3 v3;
0493     struct iwl_geo_tx_power_profiles_cmd_v4 v4;
0494     struct iwl_geo_tx_power_profiles_cmd_v5 v5;
0495 };
0496 
0497 /**
0498  * struct iwl_geo_tx_power_profiles_resp -  response to PER_CHAIN_LIMIT_OFFSET_CMD cmd
0499  * @profile_idx: current geo profile in use
0500  */
0501 struct iwl_geo_tx_power_profiles_resp {
0502     __le32 profile_idx;
0503 } __packed; /* PER_CHAIN_LIMIT_OFFSET_RSP */
0504 
0505 /**
0506  * union iwl_ppag_table_cmd - union for all versions of PPAG command
0507  * @v1: version 1
0508  * @v2: version 2
0509  *
0510  * @flags: bit 0 - indicates enablement of PPAG for ETSI
0511  *         bit 1 - indicates enablement of PPAG for CHINA BIOS
0512  *         bit 1 can be used only in v3 (identical to v2)
0513  * @gain: table of antenna gain values per chain and sub-band
0514  * @reserved: reserved
0515  */
0516 union iwl_ppag_table_cmd {
0517     struct {
0518         __le32 flags;
0519         s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
0520         s8 reserved[2];
0521     } v1;
0522     struct {
0523         __le32 flags;
0524         s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
0525         s8 reserved[2];
0526     } v2;
0527 } __packed;
0528 
0529 #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE    26
0530 #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE    13
0531 
0532 /**
0533  * struct iwl_sar_offset_mapping_cmd - struct for SAR_OFFSET_MAPPING_TABLE_CMD
0534  * @offset_map: mapping a mcc to a geo sar group
0535  * @reserved: reserved
0536  */
0537 struct iwl_sar_offset_mapping_cmd {
0538     u8 offset_map[MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE]
0539         [MCC_TO_SAR_OFFSET_TABLE_COL_SIZE];
0540     u16 reserved;
0541 } __packed; /*SAR_OFFSET_MAPPING_TABLE_CMD_API_S*/
0542 
0543 /**
0544  * struct iwl_beacon_filter_cmd
0545  * REPLY_BEACON_FILTERING_CMD = 0xd2 (command)
0546  * @bf_energy_delta: Used for RSSI filtering, if in 'normal' state. Send beacon
0547  *      to driver if delta in Energy values calculated for this and last
0548  *      passed beacon is greater than this threshold. Zero value means that
0549  *      the Energy change is ignored for beacon filtering, and beacon will
0550  *      not be forced to be sent to driver regardless of this delta. Typical
0551  *      energy delta 5dB.
0552  * @bf_roaming_energy_delta: Used for RSSI filtering, if in 'roaming' state.
0553  *      Send beacon to driver if delta in Energy values calculated for this
0554  *      and last passed beacon is greater than this threshold. Zero value
0555  *      means that the Energy change is ignored for beacon filtering while in
0556  *      Roaming state, typical energy delta 1dB.
0557  * @bf_roaming_state: Used for RSSI filtering. If absolute Energy values
0558  *      calculated for current beacon is less than the threshold, use
0559  *      Roaming Energy Delta Threshold, otherwise use normal Energy Delta
0560  *      Threshold. Typical energy threshold is -72dBm.
0561  * @bf_temp_threshold: This threshold determines the type of temperature
0562  *  filtering (Slow or Fast) that is selected (Units are in Celsuis):
0563  *  If the current temperature is above this threshold - Fast filter
0564  *  will be used, If the current temperature is below this threshold -
0565  *  Slow filter will be used.
0566  * @bf_temp_fast_filter: Send Beacon to driver if delta in temperature values
0567  *      calculated for this and the last passed beacon is greater than this
0568  *      threshold. Zero value means that the temperature change is ignored for
0569  *      beacon filtering; beacons will not be  forced to be sent to driver
0570  *      regardless of whether its temerature has been changed.
0571  * @bf_temp_slow_filter: Send Beacon to driver if delta in temperature values
0572  *      calculated for this and the last passed beacon is greater than this
0573  *      threshold. Zero value means that the temperature change is ignored for
0574  *      beacon filtering; beacons will not be forced to be sent to driver
0575  *      regardless of whether its temerature has been changed.
0576  * @bf_enable_beacon_filter: 1, beacon filtering is enabled; 0, disabled.
0577  * @bf_debug_flag: beacon filtering debug configuration
0578  * @bf_escape_timer: Send beacons to to driver if no beacons were passed
0579  *      for a specific period of time. Units: Beacons.
0580  * @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
0581  *      for a longer period of time then this escape-timeout. Units: Beacons.
0582  * @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
0583  * @bf_threshold_absolute_low: See below.
0584  * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
0585  *      for this beacon crossed this absolute threshold. For the 'Increase'
0586  *      direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
0587  *      direction the bf_energy_absolute_high[i] is used. Zero value means
0588  *      that this specific threshold is ignored for beacon filtering, and
0589  *      beacon will not be forced to be sent to driver due to this setting.
0590  */
0591 struct iwl_beacon_filter_cmd {
0592     __le32 bf_energy_delta;
0593     __le32 bf_roaming_energy_delta;
0594     __le32 bf_roaming_state;
0595     __le32 bf_temp_threshold;
0596     __le32 bf_temp_fast_filter;
0597     __le32 bf_temp_slow_filter;
0598     __le32 bf_enable_beacon_filter;
0599     __le32 bf_debug_flag;
0600     __le32 bf_escape_timer;
0601     __le32 ba_escape_timer;
0602     __le32 ba_enable_beacon_abort;
0603     __le32 bf_threshold_absolute_low[2];
0604     __le32 bf_threshold_absolute_high[2];
0605 } __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
0606 
0607 /* Beacon filtering and beacon abort */
0608 #define IWL_BF_ENERGY_DELTA_DEFAULT 5
0609 #define IWL_BF_ENERGY_DELTA_D0I3 20
0610 #define IWL_BF_ENERGY_DELTA_MAX 255
0611 #define IWL_BF_ENERGY_DELTA_MIN 0
0612 
0613 #define IWL_BF_ROAMING_ENERGY_DELTA_DEFAULT 1
0614 #define IWL_BF_ROAMING_ENERGY_DELTA_D0I3 20
0615 #define IWL_BF_ROAMING_ENERGY_DELTA_MAX 255
0616 #define IWL_BF_ROAMING_ENERGY_DELTA_MIN 0
0617 
0618 #define IWL_BF_ROAMING_STATE_DEFAULT 72
0619 #define IWL_BF_ROAMING_STATE_D0I3 72
0620 #define IWL_BF_ROAMING_STATE_MAX 255
0621 #define IWL_BF_ROAMING_STATE_MIN 0
0622 
0623 #define IWL_BF_TEMP_THRESHOLD_DEFAULT 112
0624 #define IWL_BF_TEMP_THRESHOLD_D0I3 112
0625 #define IWL_BF_TEMP_THRESHOLD_MAX 255
0626 #define IWL_BF_TEMP_THRESHOLD_MIN 0
0627 
0628 #define IWL_BF_TEMP_FAST_FILTER_DEFAULT 1
0629 #define IWL_BF_TEMP_FAST_FILTER_D0I3 1
0630 #define IWL_BF_TEMP_FAST_FILTER_MAX 255
0631 #define IWL_BF_TEMP_FAST_FILTER_MIN 0
0632 
0633 #define IWL_BF_TEMP_SLOW_FILTER_DEFAULT 5
0634 #define IWL_BF_TEMP_SLOW_FILTER_D0I3 20
0635 #define IWL_BF_TEMP_SLOW_FILTER_MAX 255
0636 #define IWL_BF_TEMP_SLOW_FILTER_MIN 0
0637 
0638 #define IWL_BF_ENABLE_BEACON_FILTER_DEFAULT 1
0639 
0640 #define IWL_BF_DEBUG_FLAG_DEFAULT 0
0641 #define IWL_BF_DEBUG_FLAG_D0I3 0
0642 
0643 #define IWL_BF_ESCAPE_TIMER_DEFAULT 0
0644 #define IWL_BF_ESCAPE_TIMER_D0I3 0
0645 #define IWL_BF_ESCAPE_TIMER_MAX 1024
0646 #define IWL_BF_ESCAPE_TIMER_MIN 0
0647 
0648 #define IWL_BA_ESCAPE_TIMER_DEFAULT 6
0649 #define IWL_BA_ESCAPE_TIMER_D0I3 6
0650 #define IWL_BA_ESCAPE_TIMER_D3 9
0651 #define IWL_BA_ESCAPE_TIMER_MAX 1024
0652 #define IWL_BA_ESCAPE_TIMER_MIN 0
0653 
0654 #define IWL_BA_ENABLE_BEACON_ABORT_DEFAULT 1
0655 
0656 #define IWL_BF_CMD_CONFIG(mode)                      \
0657     .bf_energy_delta = cpu_to_le32(IWL_BF_ENERGY_DELTA ## mode),          \
0658     .bf_roaming_energy_delta =                        \
0659         cpu_to_le32(IWL_BF_ROAMING_ENERGY_DELTA ## mode),         \
0660     .bf_roaming_state = cpu_to_le32(IWL_BF_ROAMING_STATE ## mode),        \
0661     .bf_temp_threshold = cpu_to_le32(IWL_BF_TEMP_THRESHOLD ## mode),      \
0662     .bf_temp_fast_filter = cpu_to_le32(IWL_BF_TEMP_FAST_FILTER ## mode),  \
0663     .bf_temp_slow_filter = cpu_to_le32(IWL_BF_TEMP_SLOW_FILTER ## mode),  \
0664     .bf_debug_flag = cpu_to_le32(IWL_BF_DEBUG_FLAG ## mode),          \
0665     .bf_escape_timer = cpu_to_le32(IWL_BF_ESCAPE_TIMER ## mode),          \
0666     .ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER ## mode)
0667 
0668 #define IWL_BF_CMD_CONFIG_DEFAULTS IWL_BF_CMD_CONFIG(_DEFAULT)
0669 #define IWL_BF_CMD_CONFIG_D0I3 IWL_BF_CMD_CONFIG(_D0I3)
0670 #endif /* __iwl_fw_api_power_h__ */