[PATCH v2 22/26][SRU][U/OEM-5.10] UBUNTU: SAUCE: ath11k: put target to wow state when suspend happens

You-Sheng Yang vicamo.yang at canonical.com
Fri Dec 4 15:25:16 UTC 2020


From: Carl Huang <cjhuang at codeaurora.org>

BugLink: https://bugs.launchpad.net/bugs/1879633

This change is to put QCA6390 to wow state instead of suspend state
when system suspend happens. It also disables CE irq and DP irq, and
then put MHI to suspend state.

When system resumes, driver resumes MHI firstly, then enables CE irq
and dp IRQ, and sends wow wakeup command to firmware.

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Carl Huang <cjhuang at codeaurora.org>
Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
(cherry picked from commit 0c214f7ebce5eadb589554611bb927517c7aa7ea
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 26 +++++++++++++-------------
 drivers/net/wireless/ath/ath11k/pci.c  |  8 --------
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index af1d1b1e097c..04bc4390b5cd 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -12,6 +12,7 @@
 #include "dp_rx.h"
 #include "debug.h"
 #include "hif.h"
+#include "wow.h"
 
 unsigned int ath11k_debug_mask;
 EXPORT_SYMBOL(ath11k_debug_mask);
@@ -952,21 +953,18 @@ int ath11k_core_suspend(struct ath11k_base *ab)
 	int ret = 0;
 
 	if (ab->hw_params.support_suspend) {
+		msleep(500);
 		ath11k_purge_rx_pktlog(ar, true);
+		ret = ath11k_wow_enable(ar);
+		if (ret)
+			return ret;
+
+		ath11k_purge_rx_pktlog(ar, false);
 		ath11k_ce_stop_shadow_timers(ab);
 		ath11k_dp_stop_shadow_timers(ab);
-		reinit_completion(&ar->target_suspend);
-		ath11k_wmi_pdev_suspend(ar, 1, 0);
-		ret = wait_for_completion_timeout(&ar->target_suspend, 3 * HZ);
-		if (ret == 0) {
-			ath11k_warn(ab,
-				    "timed out while waiting for suspend completion\n");
-			return -ETIMEDOUT;
-		} else if (!ar->target_suspend_ack) {
-			ath11k_warn(ab, "suspend failed\n");
-			return -EAGAIN;
-		}
-		ath11k_purge_rx_pktlog(ar, false);
+
+		ath11k_hif_irq_disable(ab);
+		ath11k_hif_ce_irq_disable(ab);
 		return ath11k_hif_suspend(ab);
 	}
 	return 0;
@@ -979,8 +977,10 @@ int ath11k_core_resume(struct ath11k_base *ab)
 
 	if (ab->hw_params.support_suspend) {
 		ath11k_hif_resume(ab);
+		ath11k_hif_ce_irq_enable(ab);
+		ath11k_hif_irq_enable(ab);
 		ath11k_enable_rx_pktlog(ar);
-		ath11k_wmi_pdev_resume(ab->pdevs[0].ar, 0);
+		ath11k_wow_wakeup(ar);
 	}
 
 	return 0;
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index 7fcba8e02f92..18432c360249 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -1345,14 +1345,10 @@ static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev)
 	struct ath11k_base *ab = dev_get_drvdata(dev);
 	int ret;
 
-	msleep(3000);
-
 	ret = ath11k_core_suspend(ab);
 	if (ret)
 		ath11k_warn(ab, "failed to suspend hif: %d\n", ret);
 
-	msleep(3000);
-
 	return ret;
 }
 
@@ -1361,14 +1357,10 @@ static __maybe_unused int ath11k_pci_pm_resume(struct device *dev)
 	struct ath11k_base *ab = dev_get_drvdata(dev);
 	int ret;
 
-	msleep(3000);
-
 	ret = ath11k_core_resume(ab);
 	if (ret)
 		ath11k_warn(ab, "failed to resume hif: %d\n", ret);
 
-	msleep(3000);
-
 	return ret;
 }
 
-- 
2.29.2




More information about the kernel-team mailing list