Commit 406d99df authored by Sean Wang's avatar Sean Wang Committed by Felix Fietkau
Browse files

mt76: mt7663s: introduce WoW support via GPIO



SDIO-based WiFi would rely on an additional GPIO pin to wake up the host.

Co-developed-by: default avatarYN Chen <YN.Chen@mediatek.com>
Signed-off-by: default avatarYN Chen <YN.Chen@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 3cb43b66
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -3498,6 +3498,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);
@@ -3516,6 +3518,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,
@@ -3525,6 +3528,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)
@@ -3538,9 +3546,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);
+16 −0
Original line number Diff line number Diff line
@@ -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 {