summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/sdhci-spear.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2011-11-15 16:24:40 +0530
committerChris Ball <cjb@laptop.org>2012-01-11 23:58:41 -0500
commitb70a7fab26db65f7daaf04f49a3bd673250f48c7 (patch)
tree14a99b660e277fa15aadbbfe29d369a8b5845417 /drivers/mmc/host/sdhci-spear.c
parent597dd9d79cfbbb1636d00a7fd0880355d9b20c41 (diff)
mmc: sdhci-spear: Implement suspend/resume
Suspend/Resume is missing from sdhci-spear driver. This patch adds support for suspend/resume for this driver. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci-spear.c')
-rw-r--r--drivers/mmc/host/sdhci-spear.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 63cc8b6a1c9e..dee70b66305a 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -21,6 +21,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sdhci-spear.h>
@@ -271,10 +272,49 @@ static int __devexit sdhci_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int sdhci_suspend(struct device *dev)
+{
+ struct sdhci_host *host = dev_get_drvdata(dev);
+ struct spear_sdhci *sdhci = dev_get_platdata(dev);
+ pm_message_t state = {.event = 0};
+ int ret;
+
+ ret = sdhci_suspend_host(host, state);
+ if (!ret)
+ clk_disable(sdhci->clk);
+
+ return ret;
+}
+
+static int sdhci_resume(struct device *dev)
+{
+ struct sdhci_host *host = dev_get_drvdata(dev);
+ struct spear_sdhci *sdhci = dev_get_platdata(dev);
+ int ret;
+
+ ret = clk_enable(sdhci->clk);
+ if (ret) {
+ dev_dbg(dev, "Resume: Error enabling clock\n");
+ return ret;
+ }
+
+ return sdhci_resume_host(host);
+}
+
+const struct dev_pm_ops sdhci_pm_ops = {
+ .suspend = sdhci_suspend,
+ .resume = sdhci_resume,
+};
+#endif
+
static struct platform_driver sdhci_driver = {
.driver = {
.name = "sdhci",
.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+ .pm = &sdhci_pm_ops,
+#endif
},
.probe = sdhci_probe,
.remove = __devexit_p(sdhci_remove),