Skip to content

Commit 8c31706

Browse files
matproskejmberg-intel
authored andcommitted
wifi: brcmfmac: keep power during suspend if board requires it
After commit 92caded ("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> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> Link: https://patch.msgid.link/20250212185941.146958-2-email@matthias-proske.de Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 861d044 commit 8c31706

File tree

1 file changed

+13
-7
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+13
-7
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,26 +1172,31 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
11721172
struct brcmf_bus *bus_if;
11731173
struct brcmf_sdio_dev *sdiodev;
11741174
mmc_pm_flag_t sdio_flags;
1175+
bool cap_power_off;
11751176
int ret = 0;
11761177

11771178
func = container_of(dev, struct sdio_func, dev);
11781179
brcmf_dbg(SDIO, "Enter: F%d\n", func->num);
11791180
if (func->num != 1)
11801181
return 0;
11811182

1183+
cap_power_off = !!(func->card->host->caps & MMC_CAP_POWER_OFF_CARD);
11821184

11831185
bus_if = dev_get_drvdata(dev);
11841186
sdiodev = bus_if->bus_priv.sdio;
11851187

1186-
if (sdiodev->wowl_enabled) {
1188+
if (sdiodev->wowl_enabled || !cap_power_off) {
11871189
brcmf_sdiod_freezer_on(sdiodev);
11881190
brcmf_sdio_wd_timer(sdiodev->bus, 0);
11891191

11901192
sdio_flags = MMC_PM_KEEP_POWER;
1191-
if (sdiodev->settings->bus.sdio.oob_irq_supported)
1192-
enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
1193-
else
1194-
sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
1193+
1194+
if (sdiodev->wowl_enabled) {
1195+
if (sdiodev->settings->bus.sdio.oob_irq_supported)
1196+
enable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
1197+
else
1198+
sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
1199+
}
11951200

11961201
if (sdio_set_host_pm_flags(sdiodev->func1, sdio_flags))
11971202
brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
@@ -1213,18 +1218,19 @@ static int brcmf_ops_sdio_resume(struct device *dev)
12131218
struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
12141219
struct sdio_func *func = container_of(dev, struct sdio_func, dev);
12151220
int ret = 0;
1221+
bool cap_power_off = !!(func->card->host->caps & MMC_CAP_POWER_OFF_CARD);
12161222

12171223
brcmf_dbg(SDIO, "Enter: F%d\n", func->num);
12181224
if (func->num != 2)
12191225
return 0;
12201226

1221-
if (!sdiodev->wowl_enabled) {
1227+
if (!sdiodev->wowl_enabled && cap_power_off) {
12221228
/* bus was powered off and device removed, probe again */
12231229
ret = brcmf_sdiod_probe(sdiodev);
12241230
if (ret)
12251231
brcmf_err("Failed to probe device on resume\n");
12261232
} else {
1227-
if (sdiodev->settings->bus.sdio.oob_irq_supported)
1233+
if (sdiodev->wowl_enabled && sdiodev->settings->bus.sdio.oob_irq_supported)
12281234
disable_irq_wake(sdiodev->settings->bus.sdio.oob_irq_nr);
12291235

12301236
brcmf_sdiod_freezer_off(sdiodev);

0 commit comments

Comments
 (0)