From patchwork Thu Dec 11 17:45:44 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: 5476981 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 15ACB9F1D4 for ; Thu, 11 Dec 2014 17:51:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39FAF201B9 for ; Thu, 11 Dec 2014 17:51:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6B8E120160 for ; Thu, 11 Dec 2014 17:51:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9A5C326550C; Thu, 11 Dec 2014 18:51:01 +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 3B730265522; Thu, 11 Dec 2014 18:48:15 +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 1E0C02655E3; Thu, 11 Dec 2014 18:48:14 +0100 (CET) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by alsa0.perex.cz (Postfix) with ESMTP id B64072652AE for ; Thu, 11 Dec 2014 18:46:41 +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 <0NGF00GCPIPSI090@mailout4.samsung.com> for alsa-devel@alsa-project.org; Fri, 12 Dec 2014 02:46:40 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-ce-5489d88073df Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 80.E0.20081.088D9845; Fri, 12 Dec 2014 02:46:40 +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:40 +0900 (KST) From: Sylwester Nawrocki To: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org Date: Thu, 11 Dec 2014 18:45:44 +0100 Message-id: <1418319952-10163-7-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+NgFprMLMWRmVeSWpSXmKPExsVy+t9jAd2GG50hBiceqVpcuXiIyWLqwyds Fo/mP2a2mHF+H5PF75vf2SwOv2lntbi44guTA7vHhs9NbB6Lvmd5bFrVyebRt2UVo8fnTXIB rFFcNimpOZllqUX6dglcGb/e97MU9ItXLDi9hamB8bNQFyMnh4SAicTTb7OYIWwxiQv31rN1 MXJxCAksYpT4Mec1I4TTwSSx8tAbJpAqNgFDid6jfYwgtoiAk8TMOe/BOpgFmhklzv+6AVYk LBAvse7BWVYQm0VAVWL1u9tgK3gF3CS2dJ4BinMArVOQmDPJBiTMKeAusf7XORYQWwio5NHG BtYJjLwLGBlWMYqmFiQXFCel5xrqFSfmFpfmpesl5+duYgQH1TOpHYwrGywOMQpwMCrx8GbE d4YIsSaWFVfmHmKU4GBWEuHdcxkoxJuSWFmVWpQfX1Sak1p8iFGag0VJnFfJvi1ESCA9sSQ1 OzW1ILUIJsvEwSnVwKjzTWDDx4A9m1dmcO1lXJCzpG93/PFt4u47DCp+mDFLZvxyL3TzE/GJ dP80s0VKYP9i/o4rdR+0njzYJv9QPGz7MrcNni7ivXcC7iw5UDVnQoyo9oK2R15H8lhnbTD6 msqttNef99KF2z8/sYk3NMS/Fk0NXL0j2XT+u53S35bw/FyQveb8cnMlluKMREMt5qLiRADX eQ4xJgIAAA== Cc: sbkim73@samsung.com, broonie@kernel.org, drake@endlessm.com, Sylwester Nawrocki , padma.v@samsung.com Subject: [alsa-devel] [PATCH/RFC 06/14] ASoC: samsung: i2s: Move clk enable to the 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 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 later on a clock provider already in samsung_i2s_probe(). 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 56fe01d..871925b 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;