From d7384ba75a2ba23f2deb8d984c6aaa4d835743d5 Mon Sep 17 00:00:00 2001 From: Gokul Sivakumar Date: Tue, 29 Oct 2024 00:45:15 -0500 Subject: [PATCH 299/299] brcmfmac: enable remote wakeup before USB suspend, if WOWL configs are set When the host system attached with USB WLAN device goes to suspend state, remote wakeup was supposed to be enabled for the device, to allow waking the system based on the configured WOWL triggers. Currently, the remote wakeup was enabled in the device driver's USB suspend routine, which would not take effect until the next suspend, so the WOWL triggers are ineffective in the current suspend. And in the device driver's USB resume routine, the remote wakeup is disabled, so the remote wakeup that is supposed to be effective in the next routine also got avoided. This cycle makes the remote wakeup ineffective for all the received WOWL trigger instances. So before USB suspend, enable remote wakeup for USB device while setting the WOWL triggers in the USB Device firmware. Signed-off-by: Gokul Sivakumar --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index 730793ba17f5..233af5fe00fe 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -1190,6 +1190,12 @@ static int brcmf_usb_get_blob(struct device *dev, const struct firmware **fw, return 0; } +static void brcmf_usb_wowl_config(struct device *dev, bool enabled) +{ + brcmf_dbg(USB, "Configuring WOWL, enabled=%d\n", enabled); + device_set_wakeup_enable(dev, enabled); +} + static const struct brcmf_bus_ops brcmf_usb_bus_ops = { .preinit = brcmf_usb_up, .stop = brcmf_usb_down, @@ -1197,6 +1203,7 @@ static const struct brcmf_bus_ops brcmf_usb_bus_ops = { .txctl = brcmf_usb_tx_ctlpkt, .rxctl = brcmf_usb_rx_ctlpkt, .get_blob = brcmf_usb_get_blob, + .wowl_config = brcmf_usb_wowl_config, }; #define BRCMF_USB_FW_CODE 0 @@ -1547,7 +1554,6 @@ static int brcmf_usb_suspend(struct usb_interface *intf, pm_message_t state) devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP; brcmf_cancel_all_urbs(devinfo); - device_set_wakeup_enable(devinfo->dev, true); return 0; } @@ -1563,7 +1569,6 @@ static int brcmf_usb_resume(struct usb_interface *intf) devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; brcmf_usb_rx_fill_all(devinfo); - device_set_wakeup_enable(devinfo->dev, false); return 0; } -- 2.25.1