wifi: iwlwifi: no power save during transition to D3
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 13 Sep 2023 11:56:48 +0000 (14:56 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 13 Sep 2023 14:11:40 +0000 (16:11 +0200)
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: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.ced036106507.Ib5ed5a47ee35f624902bd8882dde3e559285965b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/power.h
drivers/net/wireless/intel/iwlwifi/mvm/power.c

index 85d89f5..040d83f 100644 (file)
@@ -1,6 +1,6 @@
 /* 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;
index 9131b5f..1b9b06e 100644 (file)
@@ -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);