From patchwork Fri Sep 21 05:42:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 11620 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 088CD24111 for ; Fri, 21 Sep 2012 05:43:44 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 344DE3D09A54 for ; Fri, 21 Sep 2012 05:43:42 +0000 (UTC) Received: by iafj25 with SMTP id j25so2211705iaf.11 for ; Thu, 20 Sep 2012 22:43:41 -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=w85cJORWoPDXzvtCpQsO9LsPdIwPWDE6NdXA1z9ZO2w=; b=TU11WENTrZ5bvCHyFV6gKSRH6ymdcmLr7YnRb6GKEqOppIUrK+07pQGnf5JQOBLBj+ byzQyrETw9nIs2x0IcnpmAvQyQgTeydosLSS3+wK0yuRUSSuNazpi701HDCE/LO22YDZ Hkf95gyDXIDnzQanXo9FlcB/tfFDACmh2iN3rXTA6V6tghQZbb7XXbxooFPohjjQzEDC bsrlPww2u/0Zg0bkM8etC0XUlTbObPCXzmSFp1txPIiFJHrI8QsvNDaFs0MeqNDYQPOH Famu9cc5LszbhAT5FPx5f7rqFmqeTamytHbpBkEQKrfoQZ9r/+T2kOjGooK67blTi3JX yLnQ== Received: by 10.50.7.212 with SMTP id l20mr688548iga.43.1348206221348; Thu, 20 Sep 2012 22:43:41 -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 ex8csp113150igc; Thu, 20 Sep 2012 22:43:40 -0700 (PDT) Received: by 10.66.83.33 with SMTP id n1mr10516996pay.66.1348206219989; Thu, 20 Sep 2012 22:43:39 -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 wn9si10386879pbc.354.2012.09.20.22.43.39 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 22:43:39 -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 pbcmd12 with SMTP id md12so7244468pbc.37 for ; Thu, 20 Sep 2012 22:43:39 -0700 (PDT) Received: by 10.68.190.8 with SMTP id gm8mr12775123pbc.74.1348206219267; Thu, 20 Sep 2012 22:43:39 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pi1sm4618492pbb.7.2012.09.20.22.43.35 (version=SSLv3 cipher=OTHER); Thu, 20 Sep 2012 22:43:38 -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 , Chander Kashyap Subject: [PATCH v2 3/3] mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume Date: Fri, 21 Sep 2012 11:12:08 +0530 Message-Id: <1348206128-11083-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347613731-29428-4-git-send-email-chander.kashyap@linaro.org> References: <1347613731-29428-4-git-send-email-chander.kashyap@linaro.org> X-Gm-Message-State: ALoCoQmtF8pGfWvjTmnVANeMXwbZqKI+YkdKoxN6tUlTD2VnXsasAEJlF0/n6CeC+UQWUiJKxDQP From: Chander Kashyap Perform clock disable/enable in runtime suspend/resume. Signed-off-by: Chander Kashyap Acked-by: Jaehoon Chung --- Changelog: v2: - Wrapped clk_disable in probe and clk_enable in remove with #ifdef CONFIG_PM_RUNTIME conditional check. drivers/mmc/host/sdhci-s3c.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index e019672..3726c18 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) 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); @@ -744,10 +746,15 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) gpio_is_valid(pdata->ext_cd_gpio)) sdhci_s3c_setup_card_detect_gpio(sc); +#ifdef CONFIG_PM_RUNTIME + clk_disable(sc->clk_io); +#endif 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]); @@ -786,12 +793,17 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) if (gpio_is_valid(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); 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 < MAX_BUS_CLK; ptr++) { if (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) { 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