From patchwork Fri Dec 19 13:55:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 5519691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4780BEEA8 for ; Fri, 19 Dec 2014 14:01:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D010E20131 for ; Fri, 19 Dec 2014 14:01:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8551E2010E for ; Fri, 19 Dec 2014 14:01:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y1y4o-0003c4-Iw; Fri, 19 Dec 2014 13:58:42 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y1y4B-000339-5X for linux-arm-kernel@lists.infradead.org; Fri, 19 Dec 2014 13:58:04 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGU00G7P1G4FN40@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 19 Dec 2014 22:57:40 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-1c-54942ed4966d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B7.24.20081.4DE24945; Fri, 19 Dec 2014 22:57:40 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGU00HVQ1CREV30@mmp2.samsung.com>; Fri, 19 Dec 2014 22:57:40 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, kgene@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 06/16] ASoC: samsung: i2s: Move clk enable to the platform driver probe() Date: Fri, 19 Dec 2014 14:55:26 +0100 Message-id: <1418997336-17777-7-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418997336-17777-1-git-send-email-s.nawrocki@samsung.com> References: <1418997336-17777-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCLMWRmVeSWpSXmKPExsVy+t9jQd0relNCDC4vULe4cvEQk8XUh0/Y LOYfOcdq8Wj+Y2aL/sevmS02Pb7GajHj/D4mi983v7NZHH7TzmpxccUXJgcujw2fm9g8Fn3P 8ti0qpPNY/OSeo++LasYPT5vkgtgi+KySUnNySxLLdK3S+DK2HNxAUtBv3jFnDtbWBsYvwh1 MXJySAiYSKzZ18cOYYtJXLi3nq2LkYtDSGA6o8SdTV9YIZwOJom7/zcxg1SxCRhK9B7tYwSx RQRcJR7/v8kCUsQscI1R4sWnKWCjhAXiJK48mQxUxMHBIqAqse5IDUiYV8BN4vG0dSwgYQkB BYk5k2xATE4Bd4llSz1AKoSAKraf2M42gZF3ASPDKkbR1ILkguKk9FxDveLE3OLSvHS95Pzc TYzgsHsmtYNxZYPFIUYBDkYlHt6OwskhQqyJZcWVuYcYJTiYlUR4PwpPCRHiTUmsrEotyo8v Ks1JLT7EKM3BoiTOq2TfFiIkkJ5YkpqdmlqQWgSTZeLglGpgbHliYv59w+wr+97Mc/Q2eabA m8CX/+R2c9n5o9sW5d2yl2ny16jYcEpZXtarP+55T/L+jRWFwaLssZv+m5hd0U60tPUvq81+ 5rP02XW2LQGpixoVSy/6ll9aGthy5vHeKZaNog96d914O8Hrc+7bs6ENngyO7t86Fb4zfNny f8mMT6LBCse+K7EUZyQaajEXFScCAClHdx03AgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141219_055803_388613_73BEDA47 X-CRM114-Status: GOOD ( 14.53 ) X-Spam-Score: -5.0 (-----) Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, padma.v@samsung.com, sbkim73@samsung.com, drake@endlessm.com, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Gating the I2S bus clock in the driver's runtime PM callbacks has currently really no effect since the clock is being enabled in the DAI's probe() and thus is permanently turned on. Now we just move the enable to the platform driver's probe(), which doesn't change the situation much. It will allow us to register a clock provider already in samsung_i2s_probe() function. Signed-off-by: Sylwester Nawrocki --- sound/soc/samsung/i2s.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 7f967b2..80b5362 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -969,7 +969,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - int ret; if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, @@ -977,12 +976,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) goto probe_exit; } - ret = clk_prepare_enable(i2s->clk); - if (ret != 0) { - dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); - return ret; - } - samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); if (i2s->quirks & QUIRK_NEED_RSTCLR) @@ -1014,18 +1007,12 @@ probe_exit: static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) { struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); - struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; - - if (!other || !other->clk) { + if (!is_secondary(i2s)) { if (i2s->quirks & QUIRK_NEED_RSTCLR) writel(0, i2s->addr + I2SCON); - - clk_disable_unprepare(i2s->clk); } - i2s->clk = NULL; - return 0; } @@ -1139,6 +1126,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev->dev.of_node; const struct samsung_i2s_dai_data *i2s_dai_data; + int ret; /* Call during Seconday interface registration */ i2s_dai_data = samsung_i2s_get_driver_data(pdev); @@ -1216,6 +1204,12 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to get iis clock\n"); return PTR_ERR(pri_dai->clk); } + + ret = clk_prepare_enable(pri_dai->clk); + if (ret != 0) { + dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); + return ret; + } pri_dai->dma_playback.dma_addr = regs_base + I2STXD; pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; pri_dai->dma_playback.ch_name = "tx"; @@ -1286,6 +1280,9 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); } + if (!is_secondary(i2s)) + clk_disable_unprepare(i2s->clk); + i2s->pri_dai = NULL; i2s->sec_dai = NULL;