From patchwork Thu Dec 11 17:45:43 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: 5476971 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DD2399F1D4 for ; Thu, 11 Dec 2014 17:50:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17B39201BB for ; Thu, 11 Dec 2014 17:50:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CC05D20160 for ; Thu, 11 Dec 2014 17:50:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C747C2654B6; Thu, 11 Dec 2014 18:50:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8B9CB26526F; Thu, 11 Dec 2014 18:47:39 +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 71AC52654C1; Thu, 11 Dec 2014 18:47:38 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id E18CC26526F for ; Thu, 11 Dec 2014 18:46:38 +0100 (CET) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGF00FSEIPP8790@mailout4.samsung.com> for alsa-devel@alsa-project.org; Fri, 12 Dec 2014 02:46:37 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-c8-5489d87d3fbf Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6F.D0.20081.D78D9845; Fri, 12 Dec 2014 02:46:37 +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 <0NGF00MHSIP1T280@mmp1.samsung.com>; Fri, 12 Dec 2014 02:46:37 +0900 (KST) From: Sylwester Nawrocki To: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org Date: Thu, 11 Dec 2014 18:45:43 +0100 Message-id: <1418319952-10163-6-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418319952-10163-1-git-send-email-s.nawrocki@samsung.com> References: <1418319952-10163-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t9jAd3aG50hBk3rDC2uXDzEZDH14RM2 i0fzHzNbzDi/j8ni983vbBaH37SzWlxc8YXJgd1jw+cmNo9F37M8Nq3qZPPo27KK0ePzJrkA 1igum5TUnMyy1CJ9uwSujNY9K1gL5ghX3OlbxdLAeIe/i5GTQ0LAROLz1H52CFtM4sK99Wxd jFwcQgKLGCVeTL7KAuF0MElMmbeABaSKTcBQovdoHyOILSLgJDFzznuwDmaBZkaJ879uMIEk hAWiJLomnAZKcHCwCKhKtPcpgoR5BdwkThz8yQwSlhBQkJgzyQYkzCngLrH+1zmw8UJAJY82 NrBOYORdwMiwilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyM4pJ5J7WBc2WBxiFGAg1GJhzcj vjNEiDWxrLgy9xCjBAezkgjvnstAId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxK9m0hQgLpiSWp 2ampBalFMFkmDk6pBsZC07BLVj59e4wD/37YEZSwX/w787NdyoVTvCYvM7e4vLfTQWrLrcvK hTsmP/UQ1F1i9VRvc/+lk89UXuxQTtysJ8J2oG3XTF7Gn6dXuzC9zFJ8cOoZ94cVR+7zyrHq dbp+9Tipt+gMS9CrgrNzj2908zt7ckOqnVRbt9hWi5Mvilk25ywV7lRRYinOSDTUYi4qTgQA 9NLI2SUCAAA= Cc: sbkim73@samsung.com, broonie@kernel.org, drake@endlessm.com, Sylwester Nawrocki , padma.v@samsung.com Subject: [alsa-devel] [PATCH/RFC 05/14] 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 5d8aebd..56fe01d 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;