Commit b0aa02b3 authored by Ayala Barazani's avatar Ayala Barazani Committed by Luca Coelho

iwlwifi: mvm: add a flag to reduce power command.

Add a flags bitfield in REDUCED_TX_POWER_CMD, and
send it as is to FW.
Signed-off-by: default avatarAyala Barazani <ayala.barazani@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220304131517.55c2f014f5ee.Iceb632f620de959800f979e212f0dc20240f9d38@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 8061effc
...@@ -537,8 +537,8 @@ IWL_EXPORT_SYMBOL(iwl_sar_select_profile); ...@@ -537,8 +537,8 @@ IWL_EXPORT_SYMBOL(iwl_sar_select_profile);
int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
{ {
union acpi_object *wifi_pkg, *table, *data; union acpi_object *wifi_pkg, *table, *data;
bool enabled;
int ret, tbl_rev; int ret, tbl_rev;
u32 flags;
u8 num_chains, num_sub_bands; u8 num_chains, num_sub_bands;
data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDS_METHOD); data = iwl_acpi_get_object(fwrt->dev, ACPI_WRDS_METHOD);
...@@ -604,7 +604,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) ...@@ -604,7 +604,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
IWL_DEBUG_RADIO(fwrt, "Reading WRDS tbl_rev=%d\n", tbl_rev); IWL_DEBUG_RADIO(fwrt, "Reading WRDS tbl_rev=%d\n", tbl_rev);
enabled = !!(wifi_pkg->package.elements[1].integer.value); flags = wifi_pkg->package.elements[1].integer.value;
fwrt->reduced_power_flags = flags >> IWL_REDUCE_POWER_FLAGS_POS;
/* position of the actual table */ /* position of the actual table */
table = &wifi_pkg->package.elements[2]; table = &wifi_pkg->package.elements[2];
...@@ -612,7 +613,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt) ...@@ -612,7 +613,8 @@ int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
/* The profile from WRDS is officially profile 1, but goes /* The profile from WRDS is officially profile 1, but goes
* into sar_profiles[0] (because we don't have a profile 0). * into sar_profiles[0] (because we don't have a profile 0).
*/ */
ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0], enabled, ret = iwl_sar_set_profile(table, &fwrt->sar_profiles[0],
flags & IWL_SAR_ENABLE_MSK,
num_chains, num_sub_bands); num_chains, num_sub_bands);
out_free: out_free:
kfree(data); kfree(data);
......
...@@ -92,6 +92,9 @@ ...@@ -92,6 +92,9 @@
#define ACPI_PPAG_MIN_HB -16 #define ACPI_PPAG_MIN_HB -16
#define ACPI_PPAG_MAX_HB 40 #define ACPI_PPAG_MAX_HB 40
#define IWL_SAR_ENABLE_MSK BIT(0)
#define IWL_REDUCE_POWER_FLAGS_POS 1
/* /*
* The profile for revision 2 is a superset of revision 1, which is in * The profile for revision 2 is a superset of revision 1, which is in
* turn a superset of revision 0. So we can store all revisions * turn a superset of revision 0. So we can store all revisions
......
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* Copyright (C) 2012-2014, 2018-2021 Intel Corporation * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
* Copyright (C) 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2015-2017 Intel Deutschland GmbH * Copyright (C) 2015-2017 Intel Deutschland GmbH
*/ */
...@@ -340,7 +340,7 @@ struct iwl_dev_tx_power_cmd_v5 { ...@@ -340,7 +340,7 @@ struct iwl_dev_tx_power_cmd_v5 {
} __packed; /* TX_REDUCED_POWER_API_S_VER_5 */ } __packed; /* TX_REDUCED_POWER_API_S_VER_5 */
/** /**
* struct iwl_dev_tx_power_cmd_v5 - TX power reduction command version 5 * struct iwl_dev_tx_power_cmd_v6 - TX power reduction command version 6
* @per_chain: per chain restrictions * @per_chain: per chain restrictions
* @enable_ack_reduction: enable or disable close range ack TX power * @enable_ack_reduction: enable or disable close range ack TX power
* reduction. * reduction.
...@@ -360,6 +360,28 @@ struct iwl_dev_tx_power_cmd_v6 { ...@@ -360,6 +360,28 @@ struct iwl_dev_tx_power_cmd_v6 {
__le32 timer_period; __le32 timer_period;
} __packed; /* TX_REDUCED_POWER_API_S_VER_6 */ } __packed; /* TX_REDUCED_POWER_API_S_VER_6 */
/**
* struct iwl_dev_tx_power_cmd_v7 - TX power reduction command version 7
* @per_chain: per chain restrictions
* @enable_ack_reduction: enable or disable close range ack TX power
* reduction.
* @per_chain_restriction_changed: is per_chain_restriction has changed
* from last command. used if set_mode is
* IWL_TX_POWER_MODE_SET_SAR_TIMER.
* note: if not changed, the command is used for keep alive only.
* @reserved: reserved (padding)
* @timer_period: timer in milliseconds. if expires FW will change to default
* BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
* @flags: reduce power flags.
*/
struct iwl_dev_tx_power_cmd_v7 {
__le16 per_chain[IWL_NUM_CHAIN_TABLES_V2][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
u8 enable_ack_reduction;
u8 per_chain_restriction_changed;
u8 reserved[2];
__le32 timer_period;
__le32 flags;
} __packed; /* TX_REDUCED_POWER_API_S_VER_7 */
/** /**
* struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion) * struct iwl_dev_tx_power_cmd - TX power reduction command (multiversion)
* @common: common part of the command * @common: common part of the command
...@@ -375,6 +397,7 @@ struct iwl_dev_tx_power_cmd { ...@@ -375,6 +397,7 @@ struct iwl_dev_tx_power_cmd {
struct iwl_dev_tx_power_cmd_v4 v4; struct iwl_dev_tx_power_cmd_v4 v4;
struct iwl_dev_tx_power_cmd_v5 v5; struct iwl_dev_tx_power_cmd_v5 v5;
struct iwl_dev_tx_power_cmd_v6 v6; struct iwl_dev_tx_power_cmd_v6 v6;
struct iwl_dev_tx_power_cmd_v7 v7;
}; };
}; };
......
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* Copyright (C) 2017 Intel Deutschland GmbH * Copyright (C) 2017 Intel Deutschland GmbH
* Copyright (C) 2018-2020 Intel Corporation * Copyright (C) 2018-2022 Intel Corporation
*/ */
#ifndef __iwl_fw_runtime_h__ #ifndef __iwl_fw_runtime_h__
#define __iwl_fw_runtime_h__ #define __iwl_fw_runtime_h__
...@@ -163,6 +163,7 @@ struct iwl_fw_runtime { ...@@ -163,6 +163,7 @@ struct iwl_fw_runtime {
u32 ppag_ver; u32 ppag_ver;
struct iwl_sar_offset_mapping_cmd sgom_table; struct iwl_sar_offset_mapping_cmd sgom_table;
bool sgom_enabled; bool sgom_enabled;
u8 reduced_power_flags;
#endif #endif
}; };
......
...@@ -806,8 +806,12 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b) ...@@ -806,8 +806,12 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
u32 n_subbands; u32 n_subbands;
u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
IWL_FW_CMD_VER_UNKNOWN); IWL_FW_CMD_VER_UNKNOWN);
if (cmd_ver == 7) {
if (cmd_ver == 6) { len = sizeof(cmd.v7);
n_subbands = IWL_NUM_SUB_BANDS_V2;
per_chain = cmd.v7.per_chain[0][0];
cmd.v7.flags = cpu_to_le32(mvm->fwrt.reduced_power_flags);
} else if (cmd_ver == 6) {
len = sizeof(cmd.v6); len = sizeof(cmd.v6);
n_subbands = IWL_NUM_SUB_BANDS_V2; n_subbands = IWL_NUM_SUB_BANDS_V2;
per_chain = cmd.v6.per_chain[0][0]; per_chain = cmd.v6.per_chain[0][0];
......
...@@ -1336,7 +1336,9 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -1336,7 +1336,9 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
if (tx_power == IWL_DEFAULT_MAX_TX_POWER) if (tx_power == IWL_DEFAULT_MAX_TX_POWER)
cmd.common.pwr_restriction = cpu_to_le16(IWL_DEV_MAX_TX_POWER); cmd.common.pwr_restriction = cpu_to_le16(IWL_DEV_MAX_TX_POWER);
if (cmd_ver == 6) if (cmd_ver == 7)
len = sizeof(cmd.v7);
else if (cmd_ver == 6)
len = sizeof(cmd.v6); len = sizeof(cmd.v6);
else if (fw_has_api(&mvm->fw->ucode_capa, else if (fw_has_api(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_API_REDUCE_TX_POWER)) IWL_UCODE_TLV_API_REDUCE_TX_POWER))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment