Skip to contentSkip to conversation

Add support for suspend/resume and WOW for WCN3990 chipset

PATCH Superseded Govind Singh 2 participants 6 messages Oct 12, 2018 – Nov 5, 2018 Qualcomm Atheros ATH10K wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for suspend/resume and WOW for WCN3990 chipset

This series adds support for driver suspend/resume and wake over wlan support for WCN3990 chipset. CE2 is configured as wakeup source before driver suspend and FW can wake up application processor on Magic packet/Deauth/AP lost.

change since v1:
Log enhancement in "ath10k: Enable bus layer suspend/resume for WCN3990" patch.

Govind Singh (3):
ath10k: Enable bus layer suspend/resume for WCN3990
ath10k: Disable interface pause wow config for integrated chipset
ath10k: Request credit report if flow control enabled on ep

 drivers/net/wireless/ath/ath10k/htc.c     |  3 +-
 drivers/net/wireless/ath/ath10k/snoc.c    | 45 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  7 ++++
 4 files changed, 56 insertions(+), 1 deletion(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH v2 1/3 ath10k: Enable bus layer suspend/resume for WCN3990

Register snoc bus layer suspend/resume PM ops and configure the wakeup source(CE2) for the device.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

---
 drivers/net/wireless/ath/ath10k/snoc.c | 45 ++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
drivers/net/wireless/ath/ath10k/snoc.c +45 -0
index bdef3d00f3f4..3f935c5ce8a8 100644
@@ -30,6 +30,7 @@
 
 #define ATH10K_SNOC_RX_POST_RETRY_MS 50
 #define CE_POLL_PIPE 4
+#define ATH10K_SNOC_WAKE_IRQ 2
 
 static char *const ce_name[] = {
 	"WLAN_CE_0",
@@ -1025,6 +1026,46 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
 	return ret;
 }
 
+#ifdef CONFIG_PM
+static int ath10k_snoc_hif_suspend(struct ath10k *ar)
+{
+	struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+	int ret;
+
+	if (!device_may_wakeup(ar->dev))
+		return -EPERM;
+
+	ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+	if (ret) {
+		ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret);
+		return ret;
+	}
+
+	ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n");
+
+	return ret;
+}
+
+static int ath10k_snoc_hif_resume(struct ath10k *ar)
+{
+	struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+	int ret;
+
+	if (!device_may_wakeup(ar->dev))
+		return -EPERM;
+
+	ret = disable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+	if (ret) {
+		ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret);
+		return ret;
+	}
+
+	ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n");
+
+	return ret;
+}
+#endif
+
 static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
 	.read32		= ath10k_snoc_read32,
 	.write32	= ath10k_snoc_write32,
@@ -1038,6 +1079,10 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
 	.send_complete_check	= ath10k_snoc_hif_send_complete_check,
 	.get_free_queue_number	= ath10k_snoc_hif_get_free_queue_number,
 	.get_target_info	= ath10k_snoc_hif_get_target_info,
+#ifdef CONFIG_PM
+	.suspend                = ath10k_snoc_hif_suspend,
+	.resume                 = ath10k_snoc_hif_resume,
+#endif
 };
 
 static const struct ath10k_bus_ops ath10k_snoc_bus_ops = {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

PATCH v2 2/3 ath10k: Disable interface pause wow config for integrated chipset

In reply to Govind Singh

wow pause iface config controls the PCI D0/D3-WOW cases for pcie bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config for bus/link that cannot be suspended ex:snoc and does not trigger common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990) for correct WOW configuration in the firmware.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 7 +++++++
 2 files changed, 9 insertions(+)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +2 -0
index 8c49a26fc571..1e608ef6499c 100644
@@ -3185,6 +3185,8 @@ ath10k_wmi_tlv_op_gen_wow_enable(struct ath10k *ar)
 	cmd = (void *)tlv->value;
 
 	cmd->enable = __cpu_to_le32(1);
+	if (ar->hif.bus == ATH10K_BUS_SNOC)
+		cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED;
 
 	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv wow enable\n");
 	return skb;
drivers/net/wireless/ath/ath10k/wmi-tlv.h +7 -0
index 3e1e340cd834..a8bdb5614b9b 100644
@@ -1968,8 +1968,15 @@ struct wmi_tlv_set_quiet_cmd {
 	__le32 enabled;
 } __packed;
 
+enum wmi_tlv_wow_interface_cfg {
+	WOW_IFACE_PAUSE_ENABLED,
+	WOW_IFACE_PAUSE_DISABLED
+};
+
 struct wmi_tlv_wow_enable_cmd {
 	__le32 enable;
+	__le32 pause_iface_config;
+	__le32 flags;
 } __packed;
 
 struct wmi_tlv_wow_host_wakeup_ind {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#5 lore raw

PATCH v2 3/3 ath10k: Request credit report if flow control enabled on ep

In reply to Govind Singh

FW credit flow control is enabled for only WMI ctrl service(CE3) but credit update is requested unconditionally on all HTC services as part of HTC tx in CE3/CE0/CE4.

This is causing WOW failure as FW is not expecting credit report request on other end-points(CE0/CE4).

Request credit report only on those endpoints where credit flow control is enabled.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

---
 drivers/net/wireless/ath/ath10k/htc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htc.c +2 -1
index 8902720b4e49..31f1a316be7c 100644
@@ -87,7 +87,8 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep *ep,
 	hdr->eid = ep->eid;
 	hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
 	hdr->flags = 0;
-	hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
+	if (ep->tx_credit_flow_enabled)
+		hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
 	spin_lock_bh(&ep->htc->tx_lock);
 	hdr->seq_no = ep->seq_no++;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

Re: [PATCH v2 2/3] ath10k: Disable interface pause wow config for integrated chipset

In reply to Govind Singh
Quoted 7 lines · Govind Singh

wow pause iface config controls the PCI D0/D3-WOW cases for pcie bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config for bus/link that cannot be suspended ex:snoc and does not trigger common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990) for correct WOW configuration in the firmware.

Quoted 6 lines

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

This introduced a new warning:

drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: expected restricted __le32 [usertype] pause_iface_config
drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: got int

I fixed it in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=22aab99eaf71dadc3cf2e8a2b982986a40ca641e

Signature · 3 lines
https://patchwork.kernel.org/patch/10638235/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw

Re: [PATCH v2 2/3] ath10k: Disable interface pause wow config for integrated chipset

In reply to Govind Singh
Quoted 7 lines · Govind Singh

wow pause iface config controls the PCI D0/D3-WOW cases for pcie bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config for bus/link that cannot be suspended ex:snoc and does not trigger common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990) for correct WOW configuration in the firmware.

Quoted 6 lines

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

This introduced a new warning:

drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: expected restricted __le32 [usertype] pause_iface_config
drivers/net/wireless/ath/ath10k/wmi-tlv.c:3263:41: got int

I fixed it in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=22aab99eaf71dadc3cf2e8a2b982986a40ca641e

Signature · 9 lines
https://patchwork.kernel.org/patch/10638235/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k