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

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

parent 8061effc
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -537,8 +537,8 @@ IWL_EXPORT_SYMBOL(iwl_sar_select_profile);
int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
{
	union acpi_object *wifi_pkg, *table, *data;
	bool enabled;
	int ret, tbl_rev;
	u32 flags;
	u8 num_chains, num_sub_bands;

	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)

	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 */
	table = &wifi_pkg->package.elements[2];
@@ -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
	 * 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);
out_free:
	kfree(data);
+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@
#define ACPI_PPAG_MIN_HB -16
#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
 * turn a superset of revision 0.  So we can store all revisions
+25 −2
Original line number Diff line number Diff line
/* 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) 2015-2017 Intel Deutschland GmbH
 */
@@ -340,7 +340,7 @@ struct iwl_dev_tx_power_cmd_v5 {
} __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
 * @enable_ack_reduction: enable or disable close range ack TX power
 *	reduction.
@@ -360,6 +360,28 @@ struct iwl_dev_tx_power_cmd_v6 {
	__le32 timer_period;
} __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)
 * @common: common part of the command
@@ -375,6 +397,7 @@ struct iwl_dev_tx_power_cmd {
		struct iwl_dev_tx_power_cmd_v4 v4;
		struct iwl_dev_tx_power_cmd_v5 v5;
		struct iwl_dev_tx_power_cmd_v6 v6;
		struct iwl_dev_tx_power_cmd_v7 v7;
	};
};

+2 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright (C) 2017 Intel Deutschland GmbH
 * Copyright (C) 2018-2020 Intel Corporation
 * Copyright (C) 2018-2022 Intel Corporation
 */
#ifndef __iwl_fw_runtime_h__
#define __iwl_fw_runtime_h__
@@ -163,6 +163,7 @@ struct iwl_fw_runtime {
	u32 ppag_ver;
	struct iwl_sar_offset_mapping_cmd sgom_table;
	bool sgom_enabled;
	u8 reduced_power_flags;
#endif
};

+6 −2
Original line number Diff line number Diff line
@@ -806,8 +806,12 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
	u32 n_subbands;
	u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id,
					   IWL_FW_CMD_VER_UNKNOWN);

	if (cmd_ver == 6) {
	if (cmd_ver == 7) {
		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);
		n_subbands = IWL_NUM_SUB_BANDS_V2;
		per_chain = cmd.v6.per_chain[0][0];
Loading