From patchwork Thu Apr 23 08:45:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 6260811 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 58138BF4A6 for ; Thu, 23 Apr 2015 08:46:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FC8A20380 for ; Thu, 23 Apr 2015 08:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B47120172 for ; Thu, 23 Apr 2015 08:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756002AbbDWIqL (ORCPT ); Thu, 23 Apr 2015 04:46:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46821 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbbDWIqH (ORCPT ); Thu, 23 Apr 2015 04:46:07 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id A825E140701; Thu, 23 Apr 2015 08:46:06 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 92B4E140712; Thu, 23 Apr 2015 08:46:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from blr-ubuntu-34.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 705BB140701; Thu, 23 Apr 2015 08:46:03 +0000 (UTC) From: Rajendra Nayak To: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: Rajendra Nayak , Subject: [RFC/RFT 4/6] mmc: sdhci-msm: convert driver to use runtime PM apis Date: Thu, 23 Apr 2015 14:15:42 +0530 Message-Id: <1429778744-13352-5-git-send-email-rnayak@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> References: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With platform support now in place to manage clocks from within runtime PM callbacks, get rid of all clock handling from the driver and convert the driver to use runtime PM apis. Signed-off-by: Rajendra Nayak Cc: --- drivers/mmc/host/sdhci-msm.c | 46 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 4a09f76..3c62a77 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "sdhci-pltfm.h" @@ -56,8 +57,6 @@ struct sdhci_msm_host { struct platform_device *pdev; void __iomem *core_mem; /* MSM SDCC mapped address */ - struct clk *clk; /* main SD/MMC bus clock */ - struct clk *pclk; /* SDHC peripheral bus clock */ struct clk *bus_clk; /* SDHC bus voter clock */ struct mmc_host *mmc; struct sdhci_pltfm_data sdhci_msm_pdata; @@ -469,29 +468,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) goto pltfm_free; } - /* Setup main peripheral bus clock */ - msm_host->pclk = devm_clk_get(&pdev->dev, "iface"); - if (IS_ERR(msm_host->pclk)) { - ret = PTR_ERR(msm_host->pclk); - dev_err(&pdev->dev, "Perpheral clk setup failed (%d)\n", ret); - goto bus_clk_disable; - } - - ret = clk_prepare_enable(msm_host->pclk); - if (ret) - goto bus_clk_disable; - - /* Setup SDC MMC clock */ - msm_host->clk = devm_clk_get(&pdev->dev, "core"); - if (IS_ERR(msm_host->clk)) { - ret = PTR_ERR(msm_host->clk); - dev_err(&pdev->dev, "SDC MMC clk setup failed (%d)\n", ret); - goto pclk_disable; - } - - ret = clk_prepare_enable(msm_host->clk); - if (ret) - goto pclk_disable; + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1); msm_host->core_mem = devm_ioremap_resource(&pdev->dev, core_memres); @@ -499,7 +477,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (IS_ERR(msm_host->core_mem)) { dev_err(&pdev->dev, "Failed to remap registers\n"); ret = PTR_ERR(msm_host->core_mem); - goto clk_disable; + goto err; } /* Reset the core and Enable SDHC mode */ @@ -511,7 +489,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (readl(msm_host->core_mem + CORE_POWER) & CORE_SW_RST) { dev_err(&pdev->dev, "Stuck in reset\n"); ret = -ETIMEDOUT; - goto clk_disable; + goto err; } /* Set HC_MODE_EN bit in HC_MODE register */ @@ -545,15 +523,13 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) - goto clk_disable; + goto err; return 0; -clk_disable: - clk_disable_unprepare(msm_host->clk); -pclk_disable: - clk_disable_unprepare(msm_host->pclk); -bus_clk_disable: +err: + pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); pltfm_free: @@ -571,8 +547,8 @@ static int sdhci_msm_remove(struct platform_device *pdev) sdhci_remove_host(host, dead); sdhci_pltfm_free(pdev); - clk_disable_unprepare(msm_host->clk); - clk_disable_unprepare(msm_host->pclk); + pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); return 0;