sdhci: Don't set SDIO card intr in resume by default
Pavan Kunapuli [Fri, 18 Nov 2011 12:31:47 +0000 (17:31 +0530)]
Enable SDIO card interrupt in resume only if it is
set before suspend.

Bug 902633

Change-Id: I2ade8c204ddfa97e41d5c0e5bec67d07e68f81ad
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/66099
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

Rebase-Id: Rb2ba0ae696df9104840566a794780730d6da845f

drivers/mmc/host/sdhci.c
include/linux/mmc/sdhci.h

index 0291ab3..05dde5f 100644 (file)
@@ -2307,6 +2307,10 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)
        if (mmc->card && (mmc->card->type != MMC_TYPE_SDIO))
                ret = mmc_suspend_host(host->mmc);
 
+       if (host->flags & MMC_PM_KEEP_POWER)
+               host->card_int_set = sdhci_readl(host, SDHCI_INT_ENABLE) &
+                       SDHCI_INT_CARD_INT;
+
        sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
 
        if (host->vmmc)
@@ -2350,7 +2354,8 @@ int sdhci_resume_host(struct sdhci_host *host)
                        /* Enable card interrupt as it is overwritten in sdhci_init */
                        if ((mmc->caps & MMC_CAP_SDIO_IRQ) &&
                                (mmc->pm_flags & MMC_PM_KEEP_POWER))
-                                       mmc->ops->enable_sdio_irq(mmc, true);
+                                       if (host->card_int_set)
+                                               mmc->ops->enable_sdio_irq(mmc, true);
                }
        }
 
index 5666f3a..9d499a0 100644 (file)
@@ -145,6 +145,7 @@ struct sdhci_host {
        struct tasklet_struct finish_tasklet;
 
        struct timer_list timer;        /* Timer for timeouts */
+       unsigned int card_int_set;      /* card int status */
 
        unsigned int caps;      /* Alternative capabilities */