* [PATCH V2] mmc/sdhci-spear: Implement suspend/resume
@ 2011-11-15 10:54 Viresh Kumar
2011-11-15 15:33 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: Viresh Kumar @ 2011-11-15 10:54 UTC (permalink / raw)
To: cjb
Cc: linux-mmc, armando.visconti, shiraz.hashim, vipin.kumar,
rajeev-dlh.kumar, deepak.sikri, vipulkumar.samar, amit.virdi,
viresh.kumar, pratyush.anand, bhupesh.sharma, viresh.linux,
bhavna.yadav, vincenzo.frascino, mirko.gardi
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>
---
Changes in V2:
- support for clk enable/disable is added in suspend/resume
drivers/mmc/host/sdhci-spear.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 63cc8b6..dee70b6 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),
--
1.7.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2] mmc/sdhci-spear: Implement suspend/resume
2011-11-15 10:54 [PATCH V2] mmc/sdhci-spear: Implement suspend/resume Viresh Kumar
@ 2011-11-15 15:33 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2011-11-15 15:33 UTC (permalink / raw)
To: Viresh Kumar
Cc: linux-mmc, armando.visconti, shiraz.hashim, vipin.kumar,
rajeev-dlh.kumar, deepak.sikri, vipulkumar.samar, amit.virdi,
pratyush.anand, bhupesh.sharma, viresh.linux, bhavna.yadav,
vincenzo.frascino, mirko.gardi
Hi Viresh,
On Tue, Nov 15 2011, Viresh Kumar wrote:
> 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>
Pushed to mmc-next for 3.3, thanks.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-15 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 10:54 [PATCH V2] mmc/sdhci-spear: Implement suspend/resume Viresh Kumar
2011-11-15 15:33 ` Chris Ball
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.