aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorChander Kashyap <chander.kashyap@gmail.com>2012-09-21 01:42:08 -0400
committerChris Ball <cjb@laptop.org>2012-10-07 17:41:43 -0400
commit2abeb5c5ded2e7f7d288058426fb0ae852adc77f (patch)
treecd175007e32205094e91c424ba7e70da5710de21 /drivers/mmc
parent9cde5b7a49a88939d648c361ec938fa8a633a045 (diff)
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-s3c.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index e0196726b132..2903949594c6 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -637,7 +637,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
637 goto err_no_busclks; 637 goto err_no_busclks;
638 } 638 }
639 639
640#ifndef CONFIG_PM_RUNTIME
640 clk_enable(sc->clk_bus[sc->cur_clk]); 641 clk_enable(sc->clk_bus[sc->cur_clk]);
642#endif
641 643
642 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
643 host->ioaddr = devm_request_and_ioremap(&pdev->dev, res); 645 host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
@@ -744,10 +746,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
744 gpio_is_valid(pdata->ext_cd_gpio)) 746 gpio_is_valid(pdata->ext_cd_gpio))
745 sdhci_s3c_setup_card_detect_gpio(sc); 747 sdhci_s3c_setup_card_detect_gpio(sc);
746 748
749#ifdef CONFIG_PM_RUNTIME
750 clk_disable(sc->clk_io);
751#endif
747 return 0; 752 return 0;
748 753
749 err_req_regs: 754 err_req_regs:
755#ifndef CONFIG_PM_RUNTIME
750 clk_disable(sc->clk_bus[sc->cur_clk]); 756 clk_disable(sc->clk_bus[sc->cur_clk]);
757#endif
751 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { 758 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
752 if (sc->clk_bus[ptr]) { 759 if (sc->clk_bus[ptr]) {
753 clk_put(sc->clk_bus[ptr]); 760 clk_put(sc->clk_bus[ptr]);
@@ -786,12 +793,17 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
786 if (gpio_is_valid(sc->ext_cd_gpio)) 793 if (gpio_is_valid(sc->ext_cd_gpio))
787 gpio_free(sc->ext_cd_gpio); 794 gpio_free(sc->ext_cd_gpio);
788 795
796#ifdef CONFIG_PM_RUNTIME
797 clk_enable(sc->clk_io);
798#endif
789 sdhci_remove_host(host, 1); 799 sdhci_remove_host(host, 1);
790 800
791 pm_runtime_dont_use_autosuspend(&pdev->dev); 801 pm_runtime_dont_use_autosuspend(&pdev->dev);
792 pm_runtime_disable(&pdev->dev); 802 pm_runtime_disable(&pdev->dev);
793 803
804#ifndef CONFIG_PM_RUNTIME
794 clk_disable(sc->clk_bus[sc->cur_clk]); 805 clk_disable(sc->clk_bus[sc->cur_clk]);
806#endif
795 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { 807 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
796 if (sc->clk_bus[ptr]) { 808 if (sc->clk_bus[ptr]) {
797 clk_put(sc->clk_bus[ptr]); 809 clk_put(sc->clk_bus[ptr]);
@@ -831,15 +843,28 @@ static int sdhci_s3c_resume(struct device *dev)
831static int sdhci_s3c_runtime_suspend(struct device *dev) 843static int sdhci_s3c_runtime_suspend(struct device *dev)
832{ 844{
833 struct sdhci_host *host = dev_get_drvdata(dev); 845 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);
834 851
835 return sdhci_runtime_suspend_host(host); 852 clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
853 clk_disable(busclk);
854 return ret;
836} 855}
837 856
838static int sdhci_s3c_runtime_resume(struct device *dev) 857static int sdhci_s3c_runtime_resume(struct device *dev)
839{ 858{
840 struct sdhci_host *host = dev_get_drvdata(dev); 859 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;
841 863
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;
843} 868}
844#endif 869#endif
845 870