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

Commit 0ab84cff authored by Johannes Berg's avatar Johannes Berg Committed by Reinette Chatre
Browse files

iwlwifi: read rfkill during resume



When resuming from hibernate or suspend,
the status of the rfkill switch isn't
known since it might have been toggled
while the system was asleep. Therefore,
we need to read out the status at resume
time to make sure the system knows about
an up-to-date status.

Reported-by: default avatarMark Tung <mark.y.tung@intel.com>
Tested-by: default avatarMark Tung <mark.y.tung@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
parent 278c2f6f
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -2845,6 +2845,7 @@ int iwl_pci_resume(struct pci_dev *pdev)
{
{
	struct iwl_priv *priv = pci_get_drvdata(pdev);
	struct iwl_priv *priv = pci_get_drvdata(pdev);
	int ret;
	int ret;
	bool hw_rfkill = false;


	/*
	/*
	 * We disable the RETRY_TIMEOUT register (0x41) to keep
	 * We disable the RETRY_TIMEOUT register (0x41) to keep
@@ -2859,6 +2860,17 @@ int iwl_pci_resume(struct pci_dev *pdev)
	pci_restore_state(pdev);
	pci_restore_state(pdev);
	iwl_enable_interrupts(priv);
	iwl_enable_interrupts(priv);


	if (!(iwl_read32(priv, CSR_GP_CNTRL) &
				CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
		hw_rfkill = true;

	if (hw_rfkill)
		set_bit(STATUS_RF_KILL_HW, &priv->status);
	else
		clear_bit(STATUS_RF_KILL_HW, &priv->status);

	wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill);

	return 0;
	return 0;
}
}
EXPORT_SYMBOL(iwl_pci_resume);
EXPORT_SYMBOL(iwl_pci_resume);