diff options
-rw-r--r-- | drivers/net/wireless/wl12xx/sdio.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index d5e874825069..f27e91502631 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mmc/sdio_func.h> | 28 | #include <linux/mmc/sdio_func.h> |
29 | #include <linux/mmc/sdio_ids.h> | 29 | #include <linux/mmc/sdio_ids.h> |
30 | #include <linux/mmc/card.h> | 30 | #include <linux/mmc/card.h> |
31 | #include <linux/mmc/host.h> | ||
31 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
32 | #include <linux/wl12xx.h> | 33 | #include <linux/wl12xx.h> |
33 | #include <linux/pm_runtime.h> | 34 | #include <linux/pm_runtime.h> |
@@ -163,11 +164,16 @@ static int wl1271_sdio_power_on(struct wl1271 *wl) | |||
163 | struct sdio_func *func = wl_to_func(wl); | 164 | struct sdio_func *func = wl_to_func(wl); |
164 | int ret; | 165 | int ret; |
165 | 166 | ||
166 | /* Power up the card */ | 167 | /* Make sure the card will not be powered off by runtime PM */ |
167 | ret = pm_runtime_get_sync(&func->dev); | 168 | ret = pm_runtime_get_sync(&func->dev); |
168 | if (ret < 0) | 169 | if (ret < 0) |
169 | goto out; | 170 | goto out; |
170 | 171 | ||
172 | /* Runtime PM might be disabled, so power up the card manually */ | ||
173 | ret = mmc_power_restore_host(func->card->host); | ||
174 | if (ret < 0) | ||
175 | goto out; | ||
176 | |||
171 | sdio_claim_host(func); | 177 | sdio_claim_host(func); |
172 | sdio_enable_func(func); | 178 | sdio_enable_func(func); |
173 | sdio_release_host(func); | 179 | sdio_release_host(func); |
@@ -179,12 +185,18 @@ out: | |||
179 | static int wl1271_sdio_power_off(struct wl1271 *wl) | 185 | static int wl1271_sdio_power_off(struct wl1271 *wl) |
180 | { | 186 | { |
181 | struct sdio_func *func = wl_to_func(wl); | 187 | struct sdio_func *func = wl_to_func(wl); |
188 | int ret; | ||
182 | 189 | ||
183 | sdio_claim_host(func); | 190 | sdio_claim_host(func); |
184 | sdio_disable_func(func); | 191 | sdio_disable_func(func); |
185 | sdio_release_host(func); | 192 | sdio_release_host(func); |
186 | 193 | ||
187 | /* Power down the card */ | 194 | /* Runtime PM might be disabled, so power off the card manually */ |
195 | ret = mmc_power_save_host(func->card->host); | ||
196 | if (ret < 0) | ||
197 | return ret; | ||
198 | |||
199 | /* Let runtime PM know the card is powered off */ | ||
188 | return pm_runtime_put_sync(&func->dev); | 200 | return pm_runtime_put_sync(&func->dev); |
189 | } | 201 | } |
190 | 202 | ||