[PATCH 360/379][SRU][OEM-5.6] UBUNTU: SAUCE: ath11k: implement hif suspend and resume functions.
You-Sheng Yang
vicamo.yang at canonical.com
Wed Dec 23 08:51:33 UTC 2020
From: Carl Huang <cjhuang at codeaurora.org>
BugLink: https://bugs.launchpad.net/bugs/1879633
For WoW, host needs to suspend MHI before entering WoW and
resume MHI when leaving WoW.
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 2f164833bcca14e8aec0b2566eae4b5a7d09ee6f
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/hif.h | 18 ++++++++++++++++
drivers/net/wireless/ath/ath11k/pci.c | 31 +++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/hif.h b/drivers/net/wireless/ath/ath11k/hif.h
index b6bde194a390..0ec32ed579ae 100644
--- a/drivers/net/wireless/ath/ath11k/hif.h
+++ b/drivers/net/wireless/ath/ath11k/hif.h
@@ -17,6 +17,9 @@ struct ath11k_hif_ops {
void (*stop)(struct ath11k_base *sc);
int (*power_up)(struct ath11k_base *sc);
void (*power_down)(struct ath11k_base *sc);
+ void (*target_crash)(struct ath11k_base *sc);
+ int (*suspend)(struct ath11k_base *ab);
+ int (*resume)(struct ath11k_base *ab);
int (*map_service_to_pipe)(struct ath11k_base *sc, u16 service_id,
u8 *ul_pipe, u8 *dl_pipe);
int (*get_user_msi_vector)(struct ath11k_base *ab, char *user_name,
@@ -57,6 +60,21 @@ static inline void ath11k_hif_power_down(struct ath11k_base *sc)
sc->hif.ops->power_down(sc);
}
+static inline int ath11k_hif_suspend(struct ath11k_base *sc)
+{
+ return sc->hif.ops->suspend(sc);
+}
+
+static inline int ath11k_hif_resume(struct ath11k_base *ab)
+{
+ return ab->hif.ops->resume(ab);
+}
+
+static inline void ath11k_hif_force_crash(struct ath11k_base *ab)
+{
+ ab->hif.ops->target_crash(ab);
+}
+
static inline u32 ath11k_hif_read32(struct ath11k_base *sc, u32 address)
{
return sc->hif.ops->read32(sc, address);
diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index a07ded84eec8..be5b3b8f6bb6 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -890,6 +890,34 @@ static void ath11k_pci_power_down(struct ath11k_base *ab)
ath11k_pci_sw_reset(ab_pci->ab);
}
+static int ath11k_pci_hif_suspend(struct ath11k_base *ab)
+{
+ struct ath11k_pci *ar_pci;
+
+ ar_pci = ath11k_pci_priv(ab);
+ ath11k_mhi_suspend(ar_pci);
+
+ return 0;
+}
+
+static int ath11k_pci_hif_resume(struct ath11k_base *ab)
+{
+ struct ath11k_pci *ar_pci;
+
+ ar_pci = ath11k_pci_priv(ab);
+ ath11k_mhi_resume(ar_pci);
+
+ return 0;
+}
+
+static void ath11k_pci_force_rddm(struct ath11k_base *ab)
+{
+ struct ath11k_pci *ar_pci;
+
+ ar_pci = ath11k_pci_priv(ab);
+ ath11k_mhi_force_rddm(ar_pci);
+}
+
static void ath11k_pci_kill_tasklets(struct ath11k_base *ab)
{
int i;
@@ -979,6 +1007,9 @@ static const struct ath11k_hif_ops ath11k_pci_hif_ops = {
.write32 = ath11k_pci_write32,
.power_down = ath11k_pci_power_down,
.power_up = ath11k_pci_power_up,
+ .suspend = ath11k_pci_hif_suspend,
+ .resume = ath11k_pci_hif_resume,
+ .target_crash = ath11k_pci_force_rddm,
.irq_enable = ath11k_pci_ext_irq_enable,
.irq_disable = ath11k_pci_ext_irq_disable,
.get_msi_address = ath11k_pci_get_msi_address,
--
2.29.2
More information about the kernel-team
mailing list