From: <sean.wang@mediatek.com>
To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com>
Cc: <sean.wang@mediatek.com>, <ryder.lee@mediatek.com>,
<linux-wireless@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>,
Sean Wang <objelf@gmail.com>, YN Chen <YN.Chen@mediatek.com>
Subject: [PATCH 2/2] mt76: mt7663s: introduce WoW support via GPIO
Date: Fri, 16 Oct 2020 08:26:42 +0800 [thread overview]
Message-ID: <e83ee8b209124306f3f62e85823d7f0e30721b26.1602807276.git.objelf@gmail.com> (raw)
In-Reply-To: <267346a9a9c5f71caec03292b6c33b39864b38c5.1602807276.git.objelf@gmail.com>
From: Sean Wang <objelf@gmail.com>
SDIO-based WiFi would rely on an additional GPIO pin to wake up the host.
Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 14 ++++++++++++--
drivers/net/wireless/mediatek/mt76/mt7615/mcu.h | 16 ++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index c990ccd6f472..ecf6c6165e72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -3525,6 +3525,8 @@ int mt7615_mcu_set_hif_suspend(struct mt7615_dev *dev, bool suspend)
req.hdr.hif_type = 2;
else if (mt76_is_usb(&dev->mt76))
req.hdr.hif_type = 1;
+ else if (mt76_is_sdio(&dev->mt76))
+ req.hdr.hif_type = 0;
return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_HIF_CTRL, &req,
sizeof(req), true);
@@ -3543,6 +3545,7 @@ mt7615_mcu_set_wow_ctrl(struct mt7615_phy *phy, struct ieee80211_vif *vif,
u8 pad[3];
} __packed hdr;
struct mt7615_wow_ctrl_tlv wow_ctrl_tlv;
+ struct mt7615_wow_gpio_param_tlv gpio_tlv;
} req = {
.hdr = {
.bss_idx = mvif->idx,
@@ -3552,6 +3555,11 @@ mt7615_mcu_set_wow_ctrl(struct mt7615_phy *phy, struct ieee80211_vif *vif,
.len = cpu_to_le16(sizeof(struct mt7615_wow_ctrl_tlv)),
.cmd = suspend ? 1 : 2,
},
+ .gpio_tlv = {
+ .tag = cpu_to_le16(UNI_SUSPEND_WOW_GPIO_PARAM),
+ .len = cpu_to_le16(sizeof(struct mt7615_wow_gpio_param_tlv)),
+ .gpio_pin = 0xff, /* follow fw about GPIO pin */
+ },
};
if (wowlan->magic_pkt)
@@ -3565,9 +3573,11 @@ mt7615_mcu_set_wow_ctrl(struct mt7615_phy *phy, struct ieee80211_vif *vif,
}
if (mt76_is_mmio(&dev->mt76))
- req.wow_ctrl_tlv.wakeup_hif = 2;
+ req.wow_ctrl_tlv.wakeup_hif = WOW_PCIE;
else if (mt76_is_usb(&dev->mt76))
- req.wow_ctrl_tlv.wakeup_hif = 1;
+ req.wow_ctrl_tlv.wakeup_hif = WOW_USB;
+ else if (mt76_is_sdio(&dev->mt76))
+ req.wow_ctrl_tlv.wakeup_hif = WOW_GPIO;
return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD_SUSPEND, &req,
sizeof(req), true);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
index 7b856e9eee1e..59ad6ac15e41 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h
@@ -477,6 +477,12 @@ struct mt7615_bss_qos_tlv {
u8 pad[3];
} __packed;
+enum {
+ WOW_USB = 1,
+ WOW_PCIE = 2,
+ WOW_GPIO = 3,
+};
+
struct mt7615_wow_ctrl_tlv {
__le16 tag;
__le16 len;
@@ -501,6 +507,16 @@ struct mt7615_wow_ctrl_tlv {
u8 rsv[4];
} __packed;
+struct mt7615_wow_gpio_param_tlv {
+ __le16 tag;
+ __le16 len;
+ u8 gpio_pin;
+ u8 trigger_lvl;
+ u8 pad[2];
+ __le32 gpio_interval;
+ u8 rsv[4];
+} __packed;
+
#define MT7615_WOW_MASK_MAX_LEN 16
#define MT7615_WOW_PATTEN_MAX_LEN 128
struct mt7615_wow_pattern_tlv {
--
2.25.1
next prev parent reply other threads:[~2020-10-16 0:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 0:26 [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd sean.wang
2020-10-16 0:26 ` sean.wang [this message]
2020-10-16 15:45 ` Lorenzo Bianconi
2020-10-16 23:14 ` Ryder Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e83ee8b209124306f3f62e85823d7f0e30721b26.1602807276.git.objelf@gmail.com \
--to=sean.wang@mediatek.com \
--cc=YN.Chen@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=objelf@gmail.com \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox