From: Sean Wang <sean.wang@kernel.org>
To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Sean Wang <sean.wang@mediatek.com>,
Stella Liu <yu-ching.liu@mediatek.com>
Subject: [PATCH] wifi: mt76: mt7925: support new WoW pattern TLV
Date: Mon, 15 Jun 2026 16:21:37 -0500 [thread overview]
Message-ID: <20260615212137.477893-1-sean.wang@kernel.org> (raw)
From: Sean Wang <sean.wang@mediatek.com>
Newer mt7925 firmware uses a shorter WoW pattern TLV with rsv[3]. Select
the v2 layout based on the firmware build date, while keeping the old
layout for older firmware.
This also makes the WoW pattern handling compatible with newer devices
such as MT7928.
Tested-by: Stella Liu <yu-ching.liu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 30 +++++++++++++++++--
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 ++
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 17bc7204f02a..32297f4a5e0b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -10,6 +10,24 @@
#define MT_STA_BFER BIT(0)
#define MT_STA_BFEE BIT(1)
+#define MT7925_WOW_PATTERN_NEW_FW_DATE "20260414153105"
+
+static bool mt7925_mcu_wow_pattern_old_tlv(struct mt76_dev *dev)
+{
+ const char *fw_version = dev->hw->wiphy->fw_version;
+ const char *build_date = strrchr(fw_version, '-');
+
+ if (!is_mt7925(dev))
+ return false;
+
+ if (!build_date)
+ return false;
+
+ build_date++;
+
+ return strncmp(build_date, MT7925_WOW_PATTERN_NEW_FW_DATE,
+ strlen(MT7925_WOW_PATTERN_NEW_FW_DATE)) < 0;
+}
int mt7925_mcu_parse_response(struct mt76_dev *mdev, int cmd,
struct sk_buff *skb, int seq)
@@ -219,6 +237,8 @@ mt7925_mcu_set_wow_pattern(struct mt76_dev *dev,
struct mt76_vif_link *mvif = (struct mt76_vif_link *)vif->drv_priv;
struct mt7925_wow_pattern_tlv *tlv;
struct sk_buff *skb;
+ int tlv_len;
+ bool old_tlv;
struct {
u8 bss_idx;
u8 pad[3];
@@ -226,14 +246,18 @@ mt7925_mcu_set_wow_pattern(struct mt76_dev *dev,
.bss_idx = mvif->idx,
};
- skb = mt76_mcu_msg_alloc(dev, NULL, sizeof(hdr) + sizeof(*tlv));
+ old_tlv = mt7925_mcu_wow_pattern_old_tlv(dev);
+ tlv_len = old_tlv ? sizeof(struct mt7925_wow_pattern_tlv) :
+ MT7925_WOW_PATTERN_TLV_V2_SIZE;
+
+ skb = mt76_mcu_msg_alloc(dev, NULL, sizeof(hdr) + tlv_len);
if (!skb)
return -ENOMEM;
skb_put_data(skb, &hdr, sizeof(hdr));
- tlv = (struct mt7925_wow_pattern_tlv *)skb_put(skb, sizeof(*tlv));
+ tlv = (struct mt7925_wow_pattern_tlv *)skb_put_zero(skb, tlv_len);
tlv->tag = cpu_to_le16(UNI_SUSPEND_WOW_PATTERN);
- tlv->len = cpu_to_le16(sizeof(*tlv));
+ tlv->len = cpu_to_le16(tlv_len);
tlv->bss_idx = 0xF;
tlv->data_len = pattern->pattern_len;
tlv->enable = enable;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 293f173b23dd..26e9d90ad503 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -587,6 +587,9 @@ struct mt7925_wow_pattern_tlv {
u8 rsv[4];
};
+#define MT7925_WOW_PATTERN_TLV_V2_SIZE \
+ (offsetof(struct mt7925_wow_pattern_tlv, rsv) + 3)
+
struct roc_acquire_tlv {
__le16 tag;
__le16 len;
--
2.43.0
reply other threads:[~2026-06-15 21:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260615212137.477893-1-sean.wang@kernel.org \
--to=sean.wang@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=sean.wang@mediatek.com \
--cc=yu-ching.liu@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