Commit 9f4e8151 authored by Mark Brown's avatar Mark Brown Committed by Chris Ball

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent d5e9c02c
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
...@@ -593,9 +594,16 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) ...@@ -593,9 +594,16 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
if (pdata->host_caps2) if (pdata->host_caps2)
host->mmc->caps2 |= pdata->host_caps2; host->mmc->caps2 |= pdata->host_caps2;
pm_runtime_enable(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
pm_runtime_use_autosuspend(&pdev->dev);
pm_suspend_ignore_children(&pdev->dev, 1);
ret = sdhci_add_host(host); ret = sdhci_add_host(host);
if (ret) { if (ret) {
dev_err(dev, "sdhci_add_host() failed\n"); dev_err(dev, "sdhci_add_host() failed\n");
pm_runtime_forbid(&pdev->dev);
pm_runtime_get_noresume(&pdev->dev);
goto err_req_regs; goto err_req_regs;
} }
...@@ -646,6 +654,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) ...@@ -646,6 +654,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
sdhci_remove_host(host, 1); sdhci_remove_host(host, 1);
pm_runtime_disable(&pdev->dev);
for (ptr = 0; ptr < 3; ptr++) { for (ptr = 0; ptr < 3; ptr++) {
if (sc->clk_bus[ptr]) { if (sc->clk_bus[ptr]) {
clk_disable(sc->clk_bus[ptr]); clk_disable(sc->clk_bus[ptr]);
...@@ -677,9 +687,27 @@ static int sdhci_s3c_resume(struct device *dev) ...@@ -677,9 +687,27 @@ static int sdhci_s3c_resume(struct device *dev)
} }
#endif #endif
#ifdef CONFIG_PM_RUNTIME
static int sdhci_s3c_runtime_suspend(struct device *dev)
{
struct sdhci_host *host = dev_get_drvdata(dev);
return sdhci_runtime_suspend_host(host);
}
static int sdhci_s3c_runtime_resume(struct device *dev)
{
struct sdhci_host *host = dev_get_drvdata(dev);
return sdhci_runtime_resume_host(host);
}
#endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
static const struct dev_pm_ops sdhci_s3c_pmops = { static const struct dev_pm_ops sdhci_s3c_pmops = {
SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume) SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume)
SET_RUNTIME_PM_OPS(sdhci_s3c_runtime_suspend, sdhci_s3c_runtime_resume,
NULL)
}; };
#define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops) #define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment