2018-10-12 09:49:45

by Govind Singh

[permalink] [raw]
Subject: [PATCH v2 0/3] 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(-)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



2018-10-12 09:49:48

by Govind Singh

[permalink] [raw]
Subject: [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.

Signed-off-by: Govind Singh <[email protected]>
---
drivers/net/wireless/ath/ath10k/snoc.c | 45 ++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index bdef3d00f3f4..3f935c5ce8a8 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -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 = {
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2018-10-12 09:49:49

by Govind Singh

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

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.

Signed-off-by: Govind Singh <[email protected]>
---
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 ++
drivers/net/wireless/ath/ath10k/wmi-tlv.h | 7 +++++++
2 files changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 8c49a26fc571..1e608ef6499c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -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;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 3e1e340cd834..a8bdb5614b9b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -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 {
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2018-10-12 09:49:51

by Govind Singh

[permalink] [raw]
Subject: [PATCH v2 3/3] ath10k: Request credit report if flow control enabled on ep

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.

Signed-off-by: Govind Singh <[email protected]>
---
drivers/net/wireless/ath/ath10k/htc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 8902720b4e49..31f1a316be7c 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -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++;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2018-11-05 13:01:54

by Kalle Valo

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

Govind Singh <[email protected]> wrote:

> 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.
>
> Signed-off-by: Govind Singh <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

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

--
https://patchwork.kernel.org/patch/10638235/

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