Commit 1bd9c9eb authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg
Browse files

wifi: iwlwifi: no power save during transition to D3



Transition to d3 is much faster if there is no power save during the
transition. Therefore a new flag was added to the device power cmd to
indicate the power save isn't allowed until the transition is completed.
Set this flag in _iwl_mvm_suspend, when the transition begins.

Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.ced036106507.Ib5ed5a47ee35f624902bd8882dde3e559285965b@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent dfed221d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright (C) 2012-2014, 2018-2022 Intel Corporation
 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
 * Copyright (C) 2015-2017 Intel Deutschland GmbH
 */
@@ -144,6 +144,8 @@ struct iwl_powertable_cmd {
 *	receiver and transmitter. '0' - does not allow.
 * @DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK:
 *	Device Retention indication, '1' indicate retention is enabled.
 * @DEVICE_POWER_FLAGS_NO_SLEEP_TILL_D3_MSK:
 *	Prevent power save until entering d3 is completed.
 * @DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK:
 *	32Khz external slow clock valid indication, '1' indicate cloack is
 *	valid.
@@ -151,6 +153,7 @@ struct iwl_powertable_cmd {
enum iwl_device_power_flags {
	DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK		= BIT(0),
	DEVICE_POWER_FLAGS_ALLOW_MEM_RETENTION_MSK	= BIT(1),
	DEVICE_POWER_FLAGS_NO_SLEEP_TILL_D3_MSK		= BIT(7),
	DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK		= BIT(12),
};

@@ -162,7 +165,7 @@ enum iwl_device_power_flags {
 * @reserved: reserved (padding)
 */
struct iwl_device_power_cmd {
	/* PM_POWER_TABLE_CMD_API_S_VER_6 */
	/* PM_POWER_TABLE_CMD_API_S_VER_7 */
	__le16 flags;
	__le16 reserved;
} __packed;
+5 −0
Original line number Diff line number Diff line
@@ -489,6 +489,11 @@ int iwl_mvm_power_update_device(struct iwl_mvm *mvm)
	if (mvm->ext_clock_valid)
		cmd.flags |= cpu_to_le16(DEVICE_POWER_FLAGS_32K_CLK_VALID_MSK);

	if (iwl_fw_lookup_cmd_ver(mvm->fw, POWER_TABLE_CMD, 0) >= 7 &&
	    test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))
		cmd.flags |=
			cpu_to_le16(DEVICE_POWER_FLAGS_NO_SLEEP_TILL_D3_MSK);

	IWL_DEBUG_POWER(mvm,
			"Sending device power command with flags = 0x%X\n",
			cmd.flags);