* [PATCH] wifi: brcmfmac: keep power during suspend if board requires it
@ 2025-02-12 18:59 Matthias Proske
2025-02-12 20:07 ` Arend van Spriel
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Proske @ 2025-02-12 18:59 UTC (permalink / raw)
To: Arend van Spriel, Kalle Valo, Norbert van Bolhuis,
Krzysztof Kozlowski, Ondrej Jirman, Erick Archer, Matthias Proske,
Jacobe Zang
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel
After commit 92cadedd9d5f ("brcmfmac: Avoid keeping power to SDIO card
unless WOWL is used"), the wifi adapter by default is turned off on
suspend and then re-probed on resume.
This conflicts with some embedded boards that require to remain powered.
They will fail on resume with:
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
ieee80211 phy1: brcmf_bus_started: failed: -110
ieee80211 phy1: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
This commit checks for the Device Tree property 'cap-power-off-cards'.
If this property is not set, it means that we do not have the capability
to power off and should therefore remain powered.
Signed-off-by: Matthias Proske <email@matthias-proske.de>
---
.../broadcom/brcm80211/brcmfmac/bcmsdh.c | 20 ++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
index 60eb95fc19a5..6bc107476a2a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
@@ -1172,6 +1172,7 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
struct brcmf_bus *bus_if;
struct brcmf_sdio_dev *sdiodev;
mmc_pm_flag_t sdio_flags;
+ bool cap_power_off;
int ret = 0;
func = container_of(dev, struct sdio_func, dev);
@@ -1179,19 +1180,23 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
if (func->num != 1)
return 0;
+ cap_power_off = !!(func->card->host->caps & MMC_CAP_POWER_OFF_CARD);
bus_if = dev_get_drvdata(dev);
sdiodev = bus_if->bus_priv.sdio;
- if (sdiodev->wowl_enabled) {
+ if (sdiodev->wowl_enabled || !cap_power_off) {
brcmf_sdiod_freezer_on(sdiodev);
brcmf_sdio_wd_timer(sdiodev->bus, 0);
sdio_flags = MMC_PM_KEEP_POWER;
- if (sdiodev->settings->bus.sdio.oob_irq_supported)
- enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
- else
- sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
+
+ if (sdiodev->wowl_enabled) {
+ if (sdiodev->settings->bus.sdio.oob_irq_supported)
+ enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
+ else
+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
+ }
if (sdio_set_host_pm_flags(sdiodev->func1, sdio_flags))
brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
@@ -1213,18 +1218,19 @@ static int brcmf_ops_sdio_resume(struct device *dev)
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
struct sdio_func *func = container_of(dev, struct sdio_func, dev);
int ret = 0;
+ bool cap_power_off = !!(func->card->host->caps & MMC_CAP_POWER_OFF_CARD);
brcmf_dbg(SDIO, "Enter: F%d\n", func->num);
if (func->num != 2)
return 0;
- if (!sdiodev->wowl_enabled) {
+ if (!sdiodev->wowl_enabled && cap_power_off) {
/* bus was powered off and device removed, probe again */
ret = brcmf_sdiod_probe(sdiodev);
if (ret)
brcmf_err("Failed to probe device on resume\n");
} else {
- if (sdiodev->settings->bus.sdio.oob_irq_supported)
+ if (sdiodev->wowl_enabled && sdiodev->settings->bus.sdio.oob_irq_supported)
disable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
brcmf_sdiod_freezer_off(sdiodev);
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: brcmfmac: keep power during suspend if board requires it
2025-02-12 18:59 [PATCH] wifi: brcmfmac: keep power during suspend if board requires it Matthias Proske
@ 2025-02-12 20:07 ` Arend van Spriel
0 siblings, 0 replies; 2+ messages in thread
From: Arend van Spriel @ 2025-02-12 20:07 UTC (permalink / raw)
To: Matthias Proske, Kalle Valo, Norbert van Bolhuis,
Krzysztof Kozlowski, Ondrej Jirman, Erick Archer, Jacobe Zang
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel
On 2/12/2025 7:59 PM, Matthias Proske wrote:
> After commit 92cadedd9d5f ("brcmfmac: Avoid keeping power to SDIO card
> unless WOWL is used"), the wifi adapter by default is turned off on
> suspend and then re-probed on resume.
>
> This conflicts with some embedded boards that require to remain powered.
> They will fail on resume with:
>
> brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
> ieee80211 phy1: brcmf_bus_started: failed: -110
> ieee80211 phy1: brcmf_attach: dongle is not responding: err=-110
> brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
>
> This commit checks for the Device Tree property 'cap-power-off-cards'.
> If this property is not set, it means that we do not have the capability
> to power off and should therefore remain powered.
Thanks! Looks good to me.
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Matthias Proske <email@matthias-proske.de>
> ---
> .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 20 ++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-12 20:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 18:59 [PATCH] wifi: brcmfmac: keep power during suspend if board requires it Matthias Proske
2025-02-12 20:07 ` Arend van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox