From patchwork Fri Sep 14 09:08:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 11411 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3AC0023E41 for ; Fri, 14 Sep 2012 09:10:03 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9DBDEA32EB2 for ; Fri, 14 Sep 2012 09:10:02 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so6203860iea.11 for ; Fri, 14 Sep 2012 02:10:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=TTAV2L61Yy7gHZ50j0zPEkCZOBQkQHZyn8TP6b1Sj+o=; b=X9RmRfxf2B68xbOi4fZkVkQaB6aZcUSDAEKQNO5wXB+jXULZCfuSsMMZh7NGNGu9Mc UseTA+VcvrB7h/KoKk0L3OodD4l+O3y2xw0M0zSRlt9Pf/kpGbVHJBsPs4pJrUNkLPq0 654dlkL2Ky/3Mv08fh5aWef67RmFr/wAMrrRIYddS+eF1Jb1TO66nsgFBzvAq7dG4oQ2 NHx0ukSMd5crTM9+/mqsIoMPCi8HBk+9yN9Pcmri3zfyIfeXDPJVfAn7ZfBefJBARL3o HEK+HXXoBiBm/aF94FnPr/ZLYCiegx77C8b0oxKqWBad5YOkT29rawiggfltg0MRUOwc keWw== Received: by 10.50.217.227 with SMTP id pb3mr27867844igc.28.1347613802414; Fri, 14 Sep 2012 02:10:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp178483igc; Fri, 14 Sep 2012 02:10:01 -0700 (PDT) Received: by 10.68.197.100 with SMTP id it4mr4574307pbc.16.1347613801624; Fri, 14 Sep 2012 02:10:01 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id mt5si1906550pbb.295.2012.09.14.02.10.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Sep 2012 02:10:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) smtp.mail=chander.kashyap@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md12so6121470pbc.37 for ; Fri, 14 Sep 2012 02:10:01 -0700 (PDT) Received: by 10.68.234.7 with SMTP id ua7mr4468813pbc.91.1347613801355; Fri, 14 Sep 2012 02:10:01 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id qo8sm683031pbb.19.2012.09.14.02.09.57 (version=SSLv3 cipher=OTHER); Fri, 14 Sep 2012 02:10:00 -0700 (PDT) From: Chander Kashyap To: linux-mmc@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: cjb@laptop.org, ben@simtec.co.uk, broonie@opensource.wolfsonmicro.com, kgene.kim@samsung.com, girish.shivananjappa@linaro.org, patches@linaro.org, Chander Kashyap Subject: [PATCH 3/3] mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume Date: Fri, 14 Sep 2012 14:38:51 +0530 Message-Id: <1347613731-29428-4-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347613731-29428-1-git-send-email-chander.kashyap@linaro.org> References: <1347613731-29428-1-git-send-email-chander.kashyap@linaro.org> X-Gm-Message-State: ALoCoQltOglspNFek5ga3mRJjdh2Gs8JaLqm3Xkt2HMFXeBCrI4qYAKsczb5oyCOH4oI6ovvIeYC Perform clock disable/enable in runtime suspend/resume. Signed-off-by: Chander Kashyap Acked-by: Jaehoon Chung --- drivers/mmc/host/sdhci-s3c.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 3f4518d..ffffd51 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -513,7 +513,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) goto err_no_busclks; } +#ifndef CONFIG_PM_RUNTIME clk_enable(sc->clk_bus[sc->cur_clk]); +#endif res = platform_get_resource(pdev, IORESOURCE_MEM, 0); host->ioaddr = devm_request_and_ioremap(&pdev->dev, res); @@ -620,10 +622,13 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) gpio_is_valid(pdata->ext_cd_gpio)) sdhci_s3c_setup_card_detect_gpio(sc); + clk_disable(sc->clk_io); return 0; err_req_regs: +#ifndef CONFIG_PM_RUNTIME clk_disable(sc->clk_bus[sc->cur_clk]); +#endif for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { if (sc->clk_bus[ptr]) { clk_put(sc->clk_bus[ptr]); @@ -656,12 +661,15 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) if (gpio_is_valid(sc->ext_cd_gpio)) gpio_free(sc->ext_cd_gpio); + clk_enable(sc->clk_io); sdhci_remove_host(host, 1); pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); +#ifndef CONFIG_PM_RUNTIME clk_disable(sc->clk_bus[sc->cur_clk]); +#endif for (ptr = 0; ptr < 3; ptr++) { if (sc->clk_bus[ptr]) { clk_put(sc->clk_bus[ptr]); @@ -696,15 +704,28 @@ static int sdhci_s3c_resume(struct device *dev) static int sdhci_s3c_runtime_suspend(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_s3c *ourhost = to_s3c(host); + struct clk *busclk = ourhost->clk_io; + int ret; + + ret = sdhci_runtime_suspend_host(host); - return 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) { 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