Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d42801b authored by Eliad Peller's avatar Eliad Peller Committed by Emmanuel Grumbach
Browse files

Revert "iwlwifi: mvm: move deferred d0i3 exit to resume_complete op"



This reverts commit 088070a2.

When working in d0i3_on_idle mode, we explicitly go out
of d0i3 on resume (so other potential commands could
be sent).

However, D0I3_DEFER_WAKEUP is currently cleared on
resume complete (which happens only later on), causing
d0i3 exit to timeout.

Since mac80211 was modified to accept incoming frames
once drv_resume was called, we can safely revert this
patch, and handle the pending work on iwl_mvm_resume().

Signed-off-by: default avatarEliad Peller <eliadx.peller@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 88742c9e
Loading
Loading
Loading
Loading
+43 −15
Original line number Diff line number Diff line
@@ -1935,16 +1935,36 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
	return 1;
}

int iwl_mvm_resume(struct ieee80211_hw *hw)
static int iwl_mvm_resume_d3(struct iwl_mvm *mvm)
{
	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
	iwl_trans_resume(mvm->trans);

	return __iwl_mvm_resume(mvm, false);
}

static int iwl_mvm_resume_d0i3(struct iwl_mvm *mvm)
{
	bool exit_now;

	/*
	 * make sure to clear D0I3_DEFER_WAKEUP before
	 * calling iwl_trans_resume(), which might wait
	 * for d0i3 exit completion.
	 */
	mutex_lock(&mvm->d0i3_suspend_mutex);
	__clear_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags);
	exit_now = __test_and_clear_bit(D0I3_PENDING_WAKEUP,
					&mvm->d0i3_suspend_flags);
	mutex_unlock(&mvm->d0i3_suspend_mutex);
	if (exit_now) {
		IWL_DEBUG_RPM(mvm, "Run deferred d0i3 exit\n");
		_iwl_mvm_exit_d0i3(mvm);
	}

	iwl_trans_resume(mvm->trans);

	if (mvm->hw->wiphy->wowlan_config->any) {
		/* 'any' trigger means d0i3 usage */
	if (mvm->trans->d0i3_mode == IWL_D0I3_MODE_ON_SUSPEND) {
			int ret = iwl_mvm_exit_d0i3(hw->priv);
		int ret = iwl_mvm_exit_d0i3(mvm->hw->priv);

		if (ret)
			return ret;
@@ -1956,7 +1976,15 @@ int iwl_mvm_resume(struct ieee80211_hw *hw)
	return 0;
}

	return __iwl_mvm_resume(mvm, false);
int iwl_mvm_resume(struct ieee80211_hw *hw)
{
	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);

	/* 'any' trigger means d0i3 was used */
	if (hw->wiphy->wowlan_config->any)
		return iwl_mvm_resume_d0i3(mvm);
	else
		return iwl_mvm_resume_d3(mvm);
}

void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled)
+0 −13
Original line number Diff line number Diff line
@@ -1433,22 +1433,9 @@ static void iwl_mvm_restart_complete(struct iwl_mvm *mvm)

static void iwl_mvm_resume_complete(struct iwl_mvm *mvm)
{
	bool exit_now;

	if (!iwl_mvm_is_d0i3_supported(mvm))
		return;

	mutex_lock(&mvm->d0i3_suspend_mutex);
	__clear_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags);
	exit_now = __test_and_clear_bit(D0I3_PENDING_WAKEUP,
					&mvm->d0i3_suspend_flags);
	mutex_unlock(&mvm->d0i3_suspend_mutex);

	if (exit_now) {
		IWL_DEBUG_RPM(mvm, "Run deferred d0i3 exit\n");
		_iwl_mvm_exit_d0i3(mvm);
	}

	if (mvm->trans->d0i3_mode == IWL_D0I3_MODE_ON_SUSPEND)
		if (!wait_event_timeout(mvm->d0i3_exit_waitq,
					!test_bit(IWL_MVM_STATUS_IN_D0I3,