aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-31 23:31:55 -0400
committerChris Ball <cjb@laptop.org>2012-04-05 20:32:20 -0400
commit9f4e8151dbbc4ca4d5dd7792666a50c137102204 (patch)
treec27bcdcac25a557010910177098cd071e3977107
parentd5e9c02cab60920d5ac16a8244bb6085dc27564f (diff)
mmc: sdhci-s3c: Enable runtime power management
Since most of the work is already done by the core we just need to add runtime suspend methods and tell the PM core that runtime PM is enabled for this device. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sdhci-s3c.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 2ea3e6b8bd6a..55a164fcaa15 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -23,6 +23,7 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_gpio.h> 24#include <linux/of_gpio.h>
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/pm_runtime.h>
26 27
27#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
28 29
@@ -593,9 +594,16 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
593 if (pdata->host_caps2) 594 if (pdata->host_caps2)
594 host->mmc->caps2 |= pdata->host_caps2; 595 host->mmc->caps2 |= pdata->host_caps2;
595 596
597 pm_runtime_enable(&pdev->dev);
598 pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
599 pm_runtime_use_autosuspend(&pdev->dev);
600 pm_suspend_ignore_children(&pdev->dev, 1);
601
596 ret = sdhci_add_host(host); 602 ret = sdhci_add_host(host);
597 if (ret) { 603 if (ret) {
598 dev_err(dev, "sdhci_add_host() failed\n"); 604 dev_err(dev, "sdhci_add_host() failed\n");
605 pm_runtime_forbid(&pdev->dev);
606 pm_runtime_get_noresume(&pdev->dev);
599 goto err_req_regs; 607 goto err_req_regs;
600 } 608 }
601 609
@@ -646,6 +654,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
646 654
647 sdhci_remove_host(host, 1); 655 sdhci_remove_host(host, 1);
648 656
657 pm_runtime_disable(&pdev->dev);
658
649 for (ptr = 0; ptr < 3; ptr++) { 659 for (ptr = 0; ptr < 3; ptr++) {
650 if (sc->clk_bus[ptr]) { 660 if (sc->clk_bus[ptr]) {
651 clk_disable(sc->clk_bus[ptr]); 661 clk_disable(sc->clk_bus[ptr]);
@@ -677,9 +687,27 @@ static int sdhci_s3c_resume(struct device *dev)
677} 687}
678#endif 688#endif
679 689
690#ifdef CONFIG_PM_RUNTIME
691static int sdhci_s3c_runtime_suspend(struct device *dev)
692{
693 struct sdhci_host *host = dev_get_drvdata(dev);
694
695 return sdhci_runtime_suspend_host(host);
696}
697
698static int sdhci_s3c_runtime_resume(struct device *dev)
699{
700 struct sdhci_host *host = dev_get_drvdata(dev);
701
702 return sdhci_runtime_resume_host(host);
703}
704#endif
705
680#ifdef CONFIG_PM 706#ifdef CONFIG_PM
681static const struct dev_pm_ops sdhci_s3c_pmops = { 707static const struct dev_pm_ops sdhci_s3c_pmops = {
682 SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume) 708 SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume)
709 SET_RUNTIME_PM_OPS(sdhci_s3c_runtime_suspend, sdhci_s3c_runtime_resume,
710 NULL)
683}; 711};
684 712
685#define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops) 713#define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops)