From patchwork Thu Apr 23 08:45:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 6260861 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 279EABF4A6 for ; Thu, 23 Apr 2015 08:46:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2225320172 for ; Thu, 23 Apr 2015 08:46:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24C4B20380 for ; Thu, 23 Apr 2015 08:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756682AbbDWIqO (ORCPT ); Thu, 23 Apr 2015 04:46:14 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46839 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932351AbbDWIqM (ORCPT ); Thu, 23 Apr 2015 04:46:12 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 62BBD140710; Thu, 23 Apr 2015 08:46:11 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 518DB140715; Thu, 23 Apr 2015 08:46:11 +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 301B2140710; Thu, 23 Apr 2015 08:46:07 +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 6/6] spi: qup: Get rid of clock handling as its done using runtime callbacks Date: Thu, 23 Apr 2015 14:15:44 +0530 Message-Id: <1429778744-13352-7-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 Remove all clock handling from the driver as this is not handled from within platform runtime callbacks. Signed-off-by: Rajendra Nayak --- drivers/spi/spi-qup.c | 54 ++++++++++----------------------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 810a7fa..a95993b 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -131,7 +131,6 @@ struct spi_qup { void __iomem *base; struct device *dev; struct clk *cclk; /* core clock */ - struct clk *iclk; /* interface clock */ int irq; spinlock_t lock; @@ -753,7 +752,7 @@ err_tx: static int spi_qup_probe(struct platform_device *pdev) { struct spi_master *master; - struct clk *iclk, *cclk; + struct clk *cclk; struct spi_qup *controller; struct resource *res; struct device *dev; @@ -775,10 +774,6 @@ static int spi_qup_probe(struct platform_device *pdev) if (IS_ERR(cclk)) return PTR_ERR(cclk); - iclk = devm_clk_get(dev, "iface"); - if (IS_ERR(iclk)) - return PTR_ERR(iclk); - /* This is optional parameter */ if (of_property_read_u32(dev->of_node, "spi-max-frequency", &max_freq)) max_freq = SPI_MAX_RATE; @@ -788,23 +783,15 @@ static int spi_qup_probe(struct platform_device *pdev) return -ENXIO; } - ret = clk_prepare_enable(cclk); - if (ret) { - dev_err(dev, "cannot enable core clock\n"); - return ret; - } - - ret = clk_prepare_enable(iclk); - if (ret) { - clk_disable_unprepare(cclk); - dev_err(dev, "cannot enable iface clock\n"); - return ret; - } + pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); + pm_runtime_use_autosuspend(dev); + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); master = spi_alloc_master(dev, sizeof(struct spi_qup)); if (!master) { - clk_disable_unprepare(cclk); - clk_disable_unprepare(iclk); + pm_runtime_set_suspended(dev); + pm_runtime_disable(dev); dev_err(dev, "cannot allocate master\n"); return -ENOMEM; } @@ -832,7 +819,6 @@ static int spi_qup_probe(struct platform_device *pdev) controller->dev = dev; controller->base = base; - controller->iclk = iclk; controller->cclk = cclk; controller->irq = irq; @@ -904,24 +890,17 @@ static int spi_qup_probe(struct platform_device *pdev) if (ret) goto error_dma; - pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); - pm_runtime_use_autosuspend(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - ret = devm_spi_register_master(dev, master); if (ret) - goto disable_pm; + goto error_dma; return 0; -disable_pm: - pm_runtime_disable(&pdev->dev); error_dma: spi_qup_release_dma(master); error: - clk_disable_unprepare(cclk); - clk_disable_unprepare(iclk); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); spi_master_put(master); return ret; } @@ -969,8 +948,6 @@ static int spi_qup_suspend(struct device *device) if (ret) return ret; - clk_disable_unprepare(controller->cclk); - clk_disable_unprepare(controller->iclk); return 0; } @@ -980,14 +957,6 @@ static int spi_qup_resume(struct device *device) struct spi_qup *controller = spi_master_get_devdata(master); int ret; - ret = clk_prepare_enable(controller->iclk); - if (ret) - return ret; - - ret = clk_prepare_enable(controller->cclk); - if (ret) - return ret; - ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) return ret; @@ -1012,9 +981,6 @@ static int spi_qup_remove(struct platform_device *pdev) spi_qup_release_dma(master); - clk_disable_unprepare(controller->cclk); - clk_disable_unprepare(controller->iclk); - pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); return 0;