Skip to contentSkip to conversation

wifi: wilc1000: Keep slot powered on during suspend/resume

PATCH In review Marek Vasut 3 participants 12 messages Sep 26, 2024 – Oct 17, 2024 Microchip WILC1000 wifi driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: wilc1000: Keep slot powered on during suspend/resume

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

---
 drivers/net/wireless/microchip/wilc1000/sdio.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +1 -8
index b4da05d5a498a..d67662b6b2a1a 100644
@@ -969,7 +969,6 @@ static int wilc_sdio_suspend(struct device *dev)
 {
 	struct sdio_func *func = dev_to_sdio_func(dev);
 	struct wilc *wilc = sdio_get_drvdata(func);
-	int ret;
 
 	dev_info(dev, "sdio suspend\n");
 
@@ -983,13 +982,7 @@ static int wilc_sdio_suspend(struct device *dev)
 
 	wilc_sdio_disable_interrupt(wilc);
 
-	ret = wilc_sdio_reset(wilc);
-	if (ret) {
-		dev_err(&func->dev, "Fail reset sdio\n");
-		return ret;
-	}
-
-	return 0;
+	return sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
 }
 
 static int wilc_sdio_resume(struct device *dev)
Signature · 1 line
2.45.2
#1 lore raw
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 21 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

Quoted 4 lines

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

I didn't know there was one such tree, added to remotes, thanks !

#3 lore raw
Quoted 23 lines · Marek Vasut
Quoted 21 lines · Kalle Valo
Quoted 18 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

Quoted 6 lines
Quoted 4 lines

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

I didn't know there was one such tree, added to remotes, thanks !

Another tip for the Monday :) get_maintainer script is a handy way to find what tree should be used:

$ scripts/get_maintainer.pl -f --scm drivers/net/wireless/microchip/wilc1000/wlan.c
Ajay Singh <[email protected]> (supporter:MICROCHIP WILC1000 WIFI DRIVER)
Claudiu Beznea <[email protected]> (supporter:MICROCHIP WILC1000 WIFI DRIVER)
Kalle Valo <[email protected]> (maintainer:NETWORKING DRIVERS (WIRELESS))
[email protected] (open list:MICROCHIP WILC1000 WIFI DRIVER)
[email protected] (open list)
git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git
git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw
In reply to Marek Vasut
Quoted 22 lines · Marek Vasut
Quoted 21 lines · Kalle Valo
Quoted 18 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

Quoted 5 lines
Quoted 4 lines

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw
Quoted 27 lines · Alexis Lothoré
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Quoted 6 lines
Quoted 1 line

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

I just had a look at a diff between wireless-next/main and next/master 20241003 for drivers/net/wireless/microchip , there are no changes to the driver between the two trees, so it should be possible to test this patch on either tree. Can you give it a try ? Ideally test this patch separately on WILC1000 across suspend/resume and check if it works. You might need the MMC controller fix which sets struct mmc_host .pm_caps |= MMC_PM_KEEP_POWER for your controller , unless this is already upstream.

The WILC3000 series depends on this patch.

#6 lore raw
Quoted 43 lines · Marek Vasut
Quoted 27 lines · Alexis Lothoré
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Quoted 6 lines
Quoted 1 line

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

I just had a look at a diff between wireless-next/main and next/master 20241003 for drivers/net/wireless/microchip , there are no changes to the driver between the two trees, so it should be possible to test this patch on either tree. Can you give it a try ? Ideally test this patch separately on WILC1000 across suspend/resume and check if it works. You might need the MMC controller fix which sets struct mmc_host .pm_caps |= MMC_PM_KEEP_POWER for your controller , unless this is already upstream.

Quoted 2 lines

The WILC3000 series depends on this patch.

Meh, you are right, I have read too fast your answer to my initial question about used base branch, and omitted the suspend/resume patch (I assumed it conflicted because of some other patches in wireless-next).

Thanks,

Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw
Quoted 44 lines · Alexis Lothoré
Quoted 43 lines · Marek Vasut
Quoted 27 lines · Alexis Lothoré
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Quoted 6 lines
Quoted 1 line

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

I just had a look at a diff between wireless-next/main and next/master 20241003 for drivers/net/wireless/microchip , there are no changes to the driver between the two trees, so it should be possible to test this patch on either tree. Can you give it a try ? Ideally test this patch separately on WILC1000 across suspend/resume and check if it works. You might need the MMC controller fix which sets struct mmc_host .pm_caps |= MMC_PM_KEEP_POWER for your controller , unless this is already upstream.

Quoted 5 lines
Quoted 2 lines

The WILC3000 series depends on this patch.

Meh, you are right, I have read too fast your answer to my initial question about used base branch, and omitted the suspend/resume patch (I assumed it conflicted because of some other patches in wireless-next).

Nope, it conflicted because I (again) didn't include cover letter with the WILC3000 series, which mentions this information. I really need to find some suitable tooling to manage the cover letters, branch description does not seem to cut it quite as I hoped it would.

#8 lore raw
Quoted 47 lines · Marek Vasut
Quoted 46 lines · Alexis Lothoré
Quoted 45 lines · Marek Vasut
Quoted 27 lines · Alexis Lothoré
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Quoted 6 lines
Quoted 1 line

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

I just had a look at a diff between wireless-next/main and next/master 20241003 for drivers/net/wireless/microchip , there are no changes to the driver between the two trees, so it should be possible to test this patch on either tree. Can you give it a try ? Ideally test this patch separately on WILC1000 across suspend/resume and check if it works. You might need the MMC controller fix which sets struct mmc_host .pm_caps |= MMC_PM_KEEP_POWER for your controller , unless this is already upstream.

The WILC3000 series depends on this patch.

Quoted 7 lines
Quoted 3 lines

Meh, you are right, I have read too fast your answer to my initial question about used base branch, and omitted the suspend/resume patch (I assumed it conflicted because of some other patches in wireless-next).

Nope, it conflicted because I (again) didn't include cover letter with the WILC3000 series, which mentions this information. I really need to find some suitable tooling to manage the cover letters, branch description does not seem to cut it quite as I hoped it would.

May I suggest b4 [0] for such task ? It really eases series submissions, taking care of all the small details that can be easily forgotten :) Latest versions of the tool will warn you during the sending phase if you forgot to create/update your cover letter (which is stored by default as an empty commit, this can be tuned). It is even able now to manage patch sets dependencies (but I still did not have the opportunity to give this feature a try)

[0] https://b4.docs.kernel.org/en/latest/

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw
Quoted 56 lines · Alexis Lothoré
Quoted 47 lines · Marek Vasut
Quoted 46 lines · Alexis Lothoré
Quoted 45 lines · Marek Vasut
Quoted 27 lines · Alexis Lothoré
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Kalle Valo
Quoted 9 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Quoted 9 lines

---
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
---
V2: Rebase on next-20240926

BTW I recommend using wireless-next as the baseline for wireless patches. For example, wireless-next is not pulled to linux-next during merge windows or other patches in linux-next might create unnecessary conflicts. Of course most of the cases using linux-next is fine.

Quoted 6 lines
Quoted 1 line

I didn't know there was one such tree, added to remotes, thanks !

+1, as already mentioned in previous revisions, I would gladly test wilc3000 changes on both wilc3000 and wilc1000 on my platform, and having the series on top of wireless-next would allow to do it on top of any change also affecting the driver in wireless-next :)

I just had a look at a diff between wireless-next/main and next/master 20241003 for drivers/net/wireless/microchip , there are no changes to the driver between the two trees, so it should be possible to test this patch on either tree. Can you give it a try ? Ideally test this patch separately on WILC1000 across suspend/resume and check if it works. You might need the MMC controller fix which sets struct mmc_host .pm_caps |= MMC_PM_KEEP_POWER for your controller , unless this is already upstream.

The WILC3000 series depends on this patch.

Quoted 7 lines
Quoted 3 lines

Meh, you are right, I have read too fast your answer to my initial question about used base branch, and omitted the suspend/resume patch (I assumed it conflicted because of some other patches in wireless-next).

Nope, it conflicted because I (again) didn't include cover letter with the WILC3000 series, which mentions this information. I really need to find some suitable tooling to manage the cover letters, branch description does not seem to cut it quite as I hoped it would.

Quoted 8 lines

May I suggest b4 [0] for such task ? It really eases series submissions, taking care of all the small details that can be easily forgotten :) Latest versions of the tool will warn you during the sending phase if you forgot to create/update your cover letter (which is stored by default as an empty commit, this can be tuned). It is even able now to manage patch sets dependencies (but I still did not have the opportunity to give this feature a try)

[0] https://b4.docs.kernel.org/en/latest/

I haven't set up b4 yet, but empty commit might actually work in my workflow.

Tested-by on v2 1/1
#10 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

So I have tested this change on wilc1000 over sdio (after enabling MMC_PM_KEEP_POWER capability on my sdmmc controller), and LGTM, system properly enters and leave suspend, and on resume module is working (ie in sta mode, chip properly reconnects to configured AP).

The only concern I still have is about existing user who currently do not declare MMC_PM_KEEP_POWER cap correctly on their platform (as it was the case for me, and as Ajay eventually raised in the first revision):
- they can currently enter system suspend (and yes, for at least some Atmel platforms, wilc chip still works on resume because it is "accidentally" kept powered on)
- after this change, they will fail to do so (because of the failing call to sdio_set_host_pm_flags, which makes the whole suspend method fail)

But I guess the issue is rather on the sdio host controller description on those platforms, which should always have the MMC_PM_KEEP_POWER cap set ? If so:

Tested-on: WILC1000SD 07 SDIO WILC_WIFI_FW_REL_16_1_2

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw
In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

The WILC3000 can suspend and enter low power state. According to local measurements, the WILC3000 consumes the same amount of power if the slot is powered up and WILC3000 is suspended, and if the WILC3000 is powered off. Use the former option, keep the WILC3000 powered up as that allows for things like WoWlan to work.

Note that this is tested on WILC3000 only, not on WILC1000 .

Patch applied to wireless-next.git, thanks.

98ca3178ad79 wifi: wilc1000: Keep slot powered on during suspend/resume

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches