summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@stericsson.com>2011-09-30 16:10:36 +0200
committerUlf HANSSON <ulf.hansson@stericsson.com>2011-09-30 16:49:46 +0200
commit869e45e50ef2c9ae829d2ad371bae1c048b41f0a (patch)
treef4830d665a96e5af6a5fc5662b8c1cb18c9cd407
parente9413319990700017af1e6254fe24887f0e42888 (diff)
mmc: mmci: Added initial support for pm_runtime
Use pm_runtime to get and put our GPIO pins. Especially needed for making suspend/resume functionality working. Change-Id: Ie62c08f7e274d07d6be83075c1cbf6a58d4beab4 Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32762 Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>
-rw-r--r--drivers/mmc/host/mmci.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 13222bd32a1..393ede681aa 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -19,6 +19,7 @@
#include <linux/err.h>
#include <linux/highmem.h>
#include <linux/log2.h>
+#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <linux/amba/bus.h>
@@ -1381,6 +1382,10 @@ static int __devinit mmci_probe(struct amba_device *dev,
amba_set_drvdata(dev, mmc);
+ pm_runtime_enable(mmc->parent);
+ if (pm_runtime_get_sync(mmc->parent) < 0)
+ dev_err(mmc_dev(mmc), "failed pm_runtime_get_sync\n");
+
dev_info(&dev->dev, "%s: PL%03x manf %x rev%u at 0x%08llx irq %d,%d (pio)\n",
mmc_hostname(mmc), amba_part(dev), amba_manf(dev),
amba_rev(dev), (unsigned long long)dev->res.start,
@@ -1473,6 +1478,9 @@ static int mmci_suspend(struct amba_device *dev, pm_message_t state)
ret = mmc_suspend_host(mmc);
if (ret == 0)
writel(0, host->base + MMCIMASK0);
+
+ if (pm_runtime_put_sync(mmc->parent) < 0)
+ dev_err(mmc_dev(mmc), "failed pm_runtime_put_sync\n");
}
return ret;
@@ -1486,6 +1494,9 @@ static int mmci_resume(struct amba_device *dev)
if (mmc) {
struct mmci_host *host = mmc_priv(mmc);
+ if (pm_runtime_get_sync(mmc->parent) < 0)
+ dev_err(mmc_dev(mmc), "failed pm_runtime_get_sync\n");
+
writel(MCI_IRQENABLE, host->base + MMCIMASK0);
ret = mmc_resume_host(mmc);