drivers: mmc: sdhci-tegra: Add suspend/resume processing
authorDmitry Shmidt <dimitrysh@google.com>
Thu, 1 Jul 2010 21:47:07 +0000 (14:47 -0700)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:28:00 +0000 (16:28 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/mmc/host/sdhci-tegra.c

index 5e2a1f170dfc51bec2e772218711d72a0d60b0e9..3d7f6628bc44775ec410b2ec2ee6c54155492296 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/mmc/card.h>
 
 #include <mach/sdhci.h>
 
@@ -177,12 +178,30 @@ static int tegra_sdhci_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int tegra_sdhci_suspend(struct platform_device *pdev, pm_message_t state)
 {
-       return -1;
+       struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
+       struct mmc_host *mmc = host->sdhci->mmc;
+       int ret = 0;
+
+       if (mmc->card && (mmc->card->type != MMC_TYPE_SDIO)) {
+               ret = sdhci_suspend_host(host->sdhci, state);
+               if (ret)
+                       pr_err("%s: failed, error = %d\n", __func__, ret);
+       }
+       return ret;
 }
 
 static int tegra_sdhci_resume(struct platform_device *pdev)
 {
-       return -1;
+       struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
+       struct mmc_host *mmc = host->sdhci->mmc;
+       int ret = 0;
+
+       if (mmc->card && (mmc->card->type != MMC_TYPE_SDIO)) {
+               ret = sdhci_resume_host(host->sdhci);
+               if (ret)
+                       pr_err("%s: failed, error = %d\n", __func__, ret);
+       }
+       return ret;
 }
 #else
 #define tegra_sdhci_suspend    NULL