Despite being implemented, power management for wilc1000 does not work as
expected and suffer some issues. Those issues can be observed by
executing "echo devices > /sys/power/pm_test && echo mem >
/sys/power/state":
- system does not resume correctly (at least on my testing platform,
sama5d27-wlsom1-evk, either with devices test mode or user button
configured as wake up source)
- warnings are triggered during suspend
This series brings fixes for those issues, and more generally try to
improve things a bit:
- implement only one pair of suspend/resume callbacks (those are currently
implemented for both 802.11 class and driver, with one depending on the
other)
- fix some warnings (for example, IRQ still being enabled on SDIO func
while going to suspend)
- fix some scenarios leading to chip becoming unresponsive to SDIO
re-enumeration (error -110)
With this series the following sequence works:
- echo devices > /sys/power/pm_test
- echo mem > /sys/power/state
- chip is properly disconnected from any AP when entering suspend
- chip properly reconnects on resume
The patches comes both from Microchip internal patches (slightly reworked)
and new patches based on encountered issues.
Tested on SAMA5D27 EVK with a WILC 1000 SD module, tested both in SDIO
mode and SPI mode
Signed-off-by: Alexis Lothoré <[email protected]>
---
Ajay Singh (1):
wifi: wilc1000: disable power sequencer
Alexis Lothoré (5):
wifi: wilc1000: let host->chip suspend/resume notifications manage chip wake/sleep
wifi: wilc1000: do not keep sdio bus claimed during suspend/resume
wifi: wilc1000: move sdio suspend method next to resume and pm ops definition
wifi: wilc1000: remove suspend/resume from cfg80211 part
wifi: wilc1000: disable SDIO func IRQ before suspend
drivers/net/wireless/microchip/wilc1000/cfg80211.c | 19 ------
drivers/net/wireless/microchip/wilc1000/netdev.h | 1 -
drivers/net/wireless/microchip/wilc1000/sdio.c | 74 ++++++++--------------
drivers/net/wireless/microchip/wilc1000/wlan.c | 8 +--
drivers/net/wireless/microchip/wilc1000/wlan.h | 1 -
5 files changed, 30 insertions(+), 73 deletions(-)
---
base-commit: 3971a5a8f911615f9a816f76c83c37d51ac522a9
change-id: 20240123-wilc_suspend-441a5944d941
Best regards,
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Issuing a system suspend command raises the following warning:
WARNING: CPU: 0 PID: 15 at drivers/mmc/core/sdio.c:1042 mmc_sdio_suspend+0xd4/0x19c
CPU: 0 PID: 15 Comm: kworker/u2:1 Not tainted 6.7.0-rc1-wt+ #710
Hardware name: Atmel SAMA5
Workqueue: events_unbound async_run_entry_fn
unwind_backtrace from show_stack+0x18/0x1c
show_stack from dump_stack_lvl+0x34/0x48
dump_stack_lvl from __warn+0x98/0x160
__warn from warn_slowpath_fmt+0xcc/0x140
warn_slowpath_fmt from mmc_sdio_suspend+0xd4/0x19c
mmc_sdio_suspend from mmc_bus_suspend+0x50/0x70
mmc_bus_suspend from dpm_run_callback+0xe4/0x248
dpm_run_callback from __device_suspend+0x234/0x91c
__device_suspend from async_suspend+0x24/0x9c
async_suspend from async_run_entry_fn+0x6c/0x210
async_run_entry_fn from process_one_work+0x3a0/0x870
[...]
This warning is due to a check in SDIO core ensuring that interrupts do not
remain enabled for cards being powered down during suspend. WILC driver
currently does not set the MMC_PM_KEEP_POWER flag, so disable interrupt
when entering resume.
Signed-off-by: Alexis Lothoré <[email protected]>
---
drivers/net/wireless/microchip/wilc1000/sdio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c
index 4e7014670945..0043f7a0fdf9 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -982,6 +982,8 @@ static int wilc_sdio_suspend(struct device *dev)
host_sleep_notify(wilc);
+ wilc_sdio_disable_interrupt(wilc);
+
ret = wilc_sdio_reset(wilc);
if (ret) {
dev_err(&func->dev, "Fail reset sdio\n");
@@ -998,6 +1000,7 @@ static int wilc_sdio_resume(struct device *dev)
dev_info(dev, "sdio resume\n");
wilc_sdio_init(wilc, true);
+ wilc_sdio_enable_interrupt(wilc);
host_wakeup_notify(wilc);
--
2.45.2