mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume
Perform clock disable/enable in runtime suspend/resume. Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
9cde5b7a49
commit
2abeb5c5de
@ -637,7 +637,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
|
|||||||
goto err_no_busclks;
|
goto err_no_busclks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef CONFIG_PM_RUNTIME
|
||||||
clk_enable(sc->clk_bus[sc->cur_clk]);
|
clk_enable(sc->clk_bus[sc->cur_clk]);
|
||||||
|
#endif
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
|
host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
@ -744,10 +746,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
|
|||||||
gpio_is_valid(pdata->ext_cd_gpio))
|
gpio_is_valid(pdata->ext_cd_gpio))
|
||||||
sdhci_s3c_setup_card_detect_gpio(sc);
|
sdhci_s3c_setup_card_detect_gpio(sc);
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_RUNTIME
|
||||||
|
clk_disable(sc->clk_io);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_req_regs:
|
err_req_regs:
|
||||||
|
#ifndef CONFIG_PM_RUNTIME
|
||||||
clk_disable(sc->clk_bus[sc->cur_clk]);
|
clk_disable(sc->clk_bus[sc->cur_clk]);
|
||||||
|
#endif
|
||||||
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
|
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
|
||||||
if (sc->clk_bus[ptr]) {
|
if (sc->clk_bus[ptr]) {
|
||||||
clk_put(sc->clk_bus[ptr]);
|
clk_put(sc->clk_bus[ptr]);
|
||||||
@ -786,12 +793,17 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
|
|||||||
if (gpio_is_valid(sc->ext_cd_gpio))
|
if (gpio_is_valid(sc->ext_cd_gpio))
|
||||||
gpio_free(sc->ext_cd_gpio);
|
gpio_free(sc->ext_cd_gpio);
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM_RUNTIME
|
||||||
|
clk_enable(sc->clk_io);
|
||||||
|
#endif
|
||||||
sdhci_remove_host(host, 1);
|
sdhci_remove_host(host, 1);
|
||||||
|
|
||||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
|
||||||
|
#ifndef CONFIG_PM_RUNTIME
|
||||||
clk_disable(sc->clk_bus[sc->cur_clk]);
|
clk_disable(sc->clk_bus[sc->cur_clk]);
|
||||||
|
#endif
|
||||||
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
|
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
|
||||||
if (sc->clk_bus[ptr]) {
|
if (sc->clk_bus[ptr]) {
|
||||||
clk_put(sc->clk_bus[ptr]);
|
clk_put(sc->clk_bus[ptr]);
|
||||||
@ -831,15 +843,28 @@ static int sdhci_s3c_resume(struct device *dev)
|
|||||||
static int sdhci_s3c_runtime_suspend(struct device *dev)
|
static int sdhci_s3c_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct sdhci_host *host = dev_get_drvdata(dev);
|
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||||
|
struct sdhci_s3c *ourhost = to_s3c(host);
|
||||||
|
struct clk *busclk = ourhost->clk_io;
|
||||||
|
int ret;
|
||||||
|
|
||||||
return sdhci_runtime_suspend_host(host);
|
ret = sdhci_runtime_suspend_host(host);
|
||||||
|
|
||||||
|
clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
|
||||||
|
clk_disable(busclk);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sdhci_s3c_runtime_resume(struct device *dev)
|
static int sdhci_s3c_runtime_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct sdhci_host *host = dev_get_drvdata(dev);
|
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||||
|
struct sdhci_s3c *ourhost = to_s3c(host);
|
||||||
|
struct clk *busclk = ourhost->clk_io;
|
||||||
|
int ret;
|
||||||
|
|
||||||
return sdhci_runtime_resume_host(host);
|
clk_enable(busclk);
|
||||||
|
clk_enable(ourhost->clk_bus[ourhost->cur_clk]);
|
||||||
|
ret = sdhci_runtime_resume_host(host);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user