Skip to content

Commit 2abeb5c

Browse files
chanderkashyapcjb
authored andcommitted
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>
1 parent 9cde5b7 commit 2abeb5c

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

drivers/mmc/host/sdhci-s3c.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
637637
goto err_no_busclks;
638638
}
639639

640+
#ifndef CONFIG_PM_RUNTIME
640641
clk_enable(sc->clk_bus[sc->cur_clk]);
642+
#endif
641643

642644
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
643645
host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
@@ -744,10 +746,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
744746
gpio_is_valid(pdata->ext_cd_gpio))
745747
sdhci_s3c_setup_card_detect_gpio(sc);
746748

749+
#ifdef CONFIG_PM_RUNTIME
750+
clk_disable(sc->clk_io);
751+
#endif
747752
return 0;
748753

749754
err_req_regs:
755+
#ifndef CONFIG_PM_RUNTIME
750756
clk_disable(sc->clk_bus[sc->cur_clk]);
757+
#endif
751758
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
752759
if (sc->clk_bus[ptr]) {
753760
clk_put(sc->clk_bus[ptr]);
@@ -786,12 +793,17 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
786793
if (gpio_is_valid(sc->ext_cd_gpio))
787794
gpio_free(sc->ext_cd_gpio);
788795

796+
#ifdef CONFIG_PM_RUNTIME
797+
clk_enable(sc->clk_io);
798+
#endif
789799
sdhci_remove_host(host, 1);
790800

791801
pm_runtime_dont_use_autosuspend(&pdev->dev);
792802
pm_runtime_disable(&pdev->dev);
793803

804+
#ifndef CONFIG_PM_RUNTIME
794805
clk_disable(sc->clk_bus[sc->cur_clk]);
806+
#endif
795807
for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
796808
if (sc->clk_bus[ptr]) {
797809
clk_put(sc->clk_bus[ptr]);
@@ -831,15 +843,28 @@ static int sdhci_s3c_resume(struct device *dev)
831843
static int sdhci_s3c_runtime_suspend(struct device *dev)
832844
{
833845
struct sdhci_host *host = dev_get_drvdata(dev);
846+
struct sdhci_s3c *ourhost = to_s3c(host);
847+
struct clk *busclk = ourhost->clk_io;
848+
int ret;
849+
850+
ret = sdhci_runtime_suspend_host(host);
834851

835-
return sdhci_runtime_suspend_host(host);
852+
clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
853+
clk_disable(busclk);
854+
return ret;
836855
}
837856

838857
static int sdhci_s3c_runtime_resume(struct device *dev)
839858
{
840859
struct sdhci_host *host = dev_get_drvdata(dev);
860+
struct sdhci_s3c *ourhost = to_s3c(host);
861+
struct clk *busclk = ourhost->clk_io;
862+
int ret;
841863

842-
return sdhci_runtime_resume_host(host);
864+
clk_enable(busclk);
865+
clk_enable(ourhost->clk_bus[ourhost->cur_clk]);
866+
ret = sdhci_runtime_resume_host(host);
867+
return ret;
843868
}
844869
#endif
845870

0 commit comments

Comments
 (0)