|
@@ -2349,19 +2349,30 @@ out:
|
|
|
int sdhci_suspend_host(struct sdhci_host *host)
|
|
|
{
|
|
|
int ret;
|
|
|
+ bool has_tuning_timer;
|
|
|
|
|
|
sdhci_disable_card_detection(host);
|
|
|
|
|
|
/* Disable tuning since we are suspending */
|
|
|
- if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
|
|
|
- host->tuning_mode == SDHCI_TUNING_MODE_1) {
|
|
|
+ has_tuning_timer = host->version >= SDHCI_SPEC_300 &&
|
|
|
+ host->tuning_count && host->tuning_mode == SDHCI_TUNING_MODE_1;
|
|
|
+ if (has_tuning_timer) {
|
|
|
del_timer_sync(&host->tuning_timer);
|
|
|
host->flags &= ~SDHCI_NEEDS_RETUNING;
|
|
|
}
|
|
|
|
|
|
ret = mmc_suspend_host(host->mmc);
|
|
|
- if (ret)
|
|
|
+ if (ret) {
|
|
|
+ if (has_tuning_timer) {
|
|
|
+ host->flags |= SDHCI_NEEDS_RETUNING;
|
|
|
+ mod_timer(&host->tuning_timer, jiffies +
|
|
|
+ host->tuning_count * HZ);
|
|
|
+ }
|
|
|
+
|
|
|
+ sdhci_enable_card_detection(host);
|
|
|
+
|
|
|
return ret;
|
|
|
+ }
|
|
|
|
|
|
free_irq(host->irq, host);
|
|
|
|