Skip to content

Commit 60f3663

Browse files
reizereyalKalle Valo
authored andcommitted
wlcore: sdio: allow pm to handle sdio power
pm_runtime handles sdio power on and power off transitions. An old workaround for trying to control the power explicitly from the driver was in fact causing failures on suspend/resume as the mmc layer already power the module on resume. In case of resume pm_runtime_get sync returns a positive device's usage count causing the driver to try an re-initialize an already initialized device. This was causing sdio bus failure on resume. Remove this manual power on/off sequence as it is in-fact not needed. Signed-off-by: Eyal Reizer <eyalr@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 3ff6ee2 commit 60f3663

File tree

1 file changed

+6
-21
lines changed
  • drivers/net/wireless/ti/wlcore

1 file changed

+6
-21
lines changed

drivers/net/wireless/ti/wlcore/sdio.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,11 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
155155
struct mmc_card *card = func->card;
156156

157157
ret = pm_runtime_get_sync(&card->dev);
158-
if (ret) {
159-
/*
160-
* Runtime PM might be temporarily disabled, or the device
161-
* might have a positive reference counter. Make sure it is
162-
* really powered on.
163-
*/
164-
ret = mmc_power_restore_host(card->host);
165-
if (ret < 0) {
166-
pm_runtime_put_sync(&card->dev);
167-
goto out;
168-
}
158+
if (ret < 0) {
159+
pm_runtime_put_noidle(&card->dev);
160+
dev_err(glue->dev, "%s: failed to get_sync(%d)\n",
161+
__func__, ret);
162+
goto out;
169163
}
170164

171165
sdio_claim_host(func);
@@ -178,24 +172,15 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue)
178172

179173
static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
180174
{
181-
int ret;
182175
struct sdio_func *func = dev_to_sdio_func(glue->dev);
183176
struct mmc_card *card = func->card;
184177

185178
sdio_claim_host(func);
186179
sdio_disable_func(func);
187180
sdio_release_host(func);
188181

189-
/* Power off the card manually in case it wasn't powered off above */
190-
ret = mmc_power_save_host(card->host);
191-
if (ret < 0)
192-
goto out;
193-
194182
/* Let runtime PM know the card is powered off */
195-
pm_runtime_put_sync(&card->dev);
196-
197-
out:
198-
return ret;
183+
return pm_runtime_put_sync(&card->dev);
199184
}
200185

201186
static int wl12xx_sdio_set_power(struct device *child, bool enable)

0 commit comments

Comments
 (0)