diff options
author | Viresh Kumar <viresh.kumar@st.com> | 2011-11-15 05:54:40 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-01-11 23:58:41 -0500 |
commit | b70a7fab26db65f7daaf04f49a3bd673250f48c7 (patch) | |
tree | 14a99b660e277fa15aadbbfe29d369a8b5845417 /drivers/mmc/host/sdhci-spear.c | |
parent | 597dd9d79cfbbb1636d00a7fd0880355d9b20c41 (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.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 63cc8b6a1c9e..dee70b66305a 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/pm.h> | ||
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
25 | #include <linux/mmc/host.h> | 26 | #include <linux/mmc/host.h> |
26 | #include <linux/mmc/sdhci-spear.h> | 27 | #include <linux/mmc/sdhci-spear.h> |
@@ -271,10 +272,49 @@ static int __devexit sdhci_remove(struct platform_device *pdev) | |||
271 | return 0; | 272 | return 0; |
272 | } | 273 | } |
273 | 274 | ||
275 | #ifdef CONFIG_PM | ||
276 | static int sdhci_suspend(struct device *dev) | ||
277 | { | ||
278 | struct sdhci_host *host = dev_get_drvdata(dev); | ||
279 | struct spear_sdhci *sdhci = dev_get_platdata(dev); | ||
280 | pm_message_t state = {.event = 0}; | ||
281 | int ret; | ||
282 | |||
283 | ret = sdhci_suspend_host(host, state); | ||
284 | if (!ret) | ||
285 | clk_disable(sdhci->clk); | ||
286 | |||
287 | return ret; | ||
288 | } | ||
289 | |||
290 | static int sdhci_resume(struct device *dev) | ||
291 | { | ||
292 | struct sdhci_host *host = dev_get_drvdata(dev); | ||
293 | struct spear_sdhci *sdhci = dev_get_platdata(dev); | ||
294 | int ret; | ||
295 | |||
296 | ret = clk_enable(sdhci->clk); | ||
297 | if (ret) { | ||
298 | dev_dbg(dev, "Resume: Error enabling clock\n"); | ||
299 | return ret; | ||
300 | } | ||
301 | |||
302 | return sdhci_resume_host(host); | ||
303 | } | ||
304 | |||
305 | const struct dev_pm_ops sdhci_pm_ops = { | ||
306 | .suspend = sdhci_suspend, | ||
307 | .resume = sdhci_resume, | ||
308 | }; | ||
309 | #endif | ||
310 | |||
274 | static struct platform_driver sdhci_driver = { | 311 | static struct platform_driver sdhci_driver = { |
275 | .driver = { | 312 | .driver = { |
276 | .name = "sdhci", | 313 | .name = "sdhci", |
277 | .owner = THIS_MODULE, | 314 | .owner = THIS_MODULE, |
315 | #ifdef CONFIG_PM | ||
316 | .pm = &sdhci_pm_ops, | ||
317 | #endif | ||
278 | }, | 318 | }, |
279 | .probe = sdhci_probe, | 319 | .probe = sdhci_probe, |
280 | .remove = __devexit_p(sdhci_remove), | 320 | .remove = __devexit_p(sdhci_remove), |