diff mbox series

[05/12] wifi: wilc1000: do not depend on power save flag to wake up chip

Message ID 20250212-wilc3000_bt-v1-5-9609b784874e@bootlin.com
State New
Headers show
Series [01/12] dt-bindings: bluetooth: describe wilc 3000 bluetooth chip | expand

Commit Message

Alexis Lothoré Feb. 12, 2025, 3:46 p.m. UTC
The wilc chips family has at least two mechanisms dedicated to power save:
- a firmware configuration message, currently wired to the
  set_power_mgmt_ops of the cfg80211_ops structure (and so, configured
  through iw)
- dedicated raw registers which allow to wake up the chip each time we
  need to communicate with it and to allow it again to sleep once done:
  those registers are currently manipulated almost any time we are about
  to use the SDIO/SPI bus to drive the chip.

Those mechanisms are currently coupled together, and so the second
mechanism is driven only if the first one is enabled, but it is wrong:
even without the power save feature being configured in the wlan
firmware, there are cases where the wake up and clock registers need to
be written correctly, otherwise the chip stays unresponsive. The
downstream driver seems to acknowledge this issue, since the flag
matching the first feature has been completely removed.

Decouple those two features by removing the condition on the powersave
flag in acquire_bus/release_bus to make sure that the wakeup/allow_sleep
registers are actually written when the passed enums
(WILC_BUS_ACQUIRE_AND_WAKEUP, WILC_BUS_RELEASE_ALLOW_SLEEP) explicitly
require those writes.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 drivers/net/wireless/microchip/wilc1000/wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index a697caf73ac3ed06602c029c17773f50e3f8edb5..1031f8153c76ca5761c1e91d03ba357a5c915774 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -748,7 +748,7 @@  int acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
 	int ret = 0;
 
 	mutex_lock(&wilc->hif_cs);
-	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode) {
+	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP) {
 		ret = chip_wakeup(wilc);
 		if (ret)
 			mutex_unlock(&wilc->hif_cs);
@@ -761,7 +761,7 @@  int release_bus(struct wilc *wilc, enum bus_release release)
 {
 	int ret = 0;
 
-	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
+	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP)
 		ret = chip_allow_sleep(wilc);
 
 	mutex_unlock(&wilc->hif_cs);