From patchwork Wed Jan 14 18:42:31 2015 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: 5634551 Return-Path: X-Original-To: patchwork-alsa-devel@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 BA208C058D for ; Wed, 14 Jan 2015 18:45:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA1DD2017E for ; Wed, 14 Jan 2015 18:45:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C23512012E for ; Wed, 14 Jan 2015 18:45:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0DBE92654E0; Wed, 14 Jan 2015 19:45:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 25F2E26545F; Wed, 14 Jan 2015 19:44:18 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3DF1C26545D; Wed, 14 Jan 2015 19:44:17 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 28BC5261A01 for ; Wed, 14 Jan 2015 19:43:23 +0100 (CET) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NI600K8JK09JT70@mailout2.samsung.com> for alsa-devel@alsa-project.org; Thu, 15 Jan 2015 03:43:22 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-9a-54b6b8c96ca5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id FF.58.09430.9C8B6B45; Thu, 15 Jan 2015 03:43:21 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NI600JMDJZE6P20@mmp1.samsung.com>; Thu, 15 Jan 2015 03:43:21 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, kgene@kernel.org Date: Wed, 14 Jan 2015 19:42:31 +0100 Message-id: <1421260962-16892-5-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> References: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsVy+t9jAd2TO7aFGDQ2WFtcuXiIyWLqwyds FvOPnGO1eDT/MbNF/+PXzBabHl9jtZhxfh+Txe+b39ksDr9pZ7W4uOILkwOXx4bPTWwei75n eWxa1cnmsXlJvUffllWMHp83yQWwRXHZpKTmZJalFunbJXBlTP50iKVgjnDFhs8v2BoY7/B3 MXJySAiYSHxsPMwGYYtJXLi3Hsjm4hASWMQo8XHeMmYIp4NJoutmOyNIFZuAoUTv0T4wW0RA Q2LLxrdMIEXMAl8ZJf5P7WUBSQgLRErs2PGJGcRmEVCV6P/SA9bAK+Am0XC4BSjOAbROQWLO JBuQMKeAu8Tlc3eZQGwhoJL3l76zTmDkXcDIsIpRNLUguaA4KT3XSK84Mbe4NC9dLzk/dxMj OPSeSe9gXNVgcYhRgINRiYfX4cjWECHWxLLiytxDjBIczEoivKu2bAsR4k1JrKxKLcqPLyrN SS0+xCjNwaIkzqtk3xYiJJCeWJKanZpakFoEk2Xi4JRqYOyvMl+U/5g16cTOkh2Pp31duWW5 6PVLP1XO7BQ3bI708/Dco6PfEf538dpylTdrP3z+sthuNs+6HzZbHrAeVOYOzXx096T+7dBr c0TSj8jeyU5VWPR4WuCs3Q5T9dh+Mdl1Ny3madq2mMdt9rWdEo4v983M9dVRdDTPd/4ke1vy NG+X6G2+7UpKLMUZiYZazEXFiQAEjiF2OQIAAA== Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.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 Subject: [alsa-devel] [PATCH V3 04/15] ASoC: samsung: i2s: Move clk_get() to platform driver probe() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Acquire the I2S interface clock in driver probe() callback as it's a per-device not a per-DAI clock. While at it switch to the resource managed clk_get(). Signed-off-by: Sylwester Nawrocki --- sound/soc/samsung/i2s.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 366b720..a854ffc 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -971,18 +971,12 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) struct i2s_dai *other = i2s->pri_dai ? : i2s->sec_dai; int ret; - if (other && other->clk) { /* If this is probe on secondary */ + if (is_secondary(i2s)) { /* If this is probe on the secondary DAI */ samsung_asoc_init_dma_data(dai, &other->sec_dai->dma_playback, NULL); goto probe_exit; } - i2s->clk = clk_get(&i2s->pdev->dev, "iis"); - if (IS_ERR(i2s->clk)) { - dev_err(&i2s->pdev->dev, "failed to get i2s_clock\n"); - return PTR_ERR(i2s->clk); - } - ret = clk_prepare_enable(i2s->clk); if (ret != 0) { dev_err(&i2s->pdev->dev, "failed to enable clock: %d\n", ret); @@ -991,10 +985,6 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture); - if (other) { - other->clk = i2s->clk; - } - if (i2s->quirks & QUIRK_NEED_RSTCLR) writel(CON_RSTCLR, i2s->addr + I2SCON); @@ -1032,7 +1022,6 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) writel(0, i2s->addr + I2SCON); clk_disable_unprepare(i2s->clk); - clk_put(i2s->clk); } i2s->clk = NULL; @@ -1222,6 +1211,11 @@ static int samsung_i2s_probe(struct platform_device *pdev) regs_base = res->start; + pri_dai->clk = devm_clk_get(&pdev->dev, "iis"); + if (IS_ERR(pri_dai->clk)) { + dev_err(&pdev->dev, "Failed to get iis clock\n"); + return PTR_ERR(pri_dai->clk); + } 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"; @@ -1253,6 +1247,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->dma_playback.dma_size = 4; sec_dai->addr = pri_dai->addr; + sec_dai->clk = pri_dai->clk; sec_dai->quirks = quirks; sec_dai->idma_playback.dma_addr = idma_addr; sec_dai->pri_dai = pri_dai;