ENGR00295184-7 mmc: sdhci: do not enable card cd wakeup for gpio case
authorDong Aisheng <b29396@freescale.com>
Mon, 13 Jan 2014 10:27:58 +0000 (18:27 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:54 +0000 (10:06 +0200)
Do not need to enable the controller card cd interrupt wakeup
if using GPIO as card detect since it's meaningless.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
drivers/mmc/host/sdhci.c

index 47055f3..8d62cec 100644 (file)
@@ -2518,6 +2518,7 @@ static irqreturn_t sdhci_thread_irq(int irq, void *dev_id)
 #ifdef CONFIG_PM
 void sdhci_enable_irq_wakeups(struct sdhci_host *host)
 {
+       int gpio_cd = mmc_gpio_get_cd(host->mmc);
        u8 val;
        u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
                        | SDHCI_WAKE_ON_INT;
@@ -2525,7 +2526,8 @@ void sdhci_enable_irq_wakeups(struct sdhci_host *host)
        val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
        val |= mask ;
        /* Avoid fake wake up */
-       if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
+       if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION ||
+               !IS_ERR_VALUE(gpio_cd))
                val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
        sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
 }