From patchwork Wed Nov 19 03:07:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 5334221 Return-Path: X-Original-To: patchwork-linux-arm@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 9ABAB9F3ED for ; Wed, 19 Nov 2014 03:10:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C83D1201EF for ; Wed, 19 Nov 2014 03:10:13 +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 E93FA2017E for ; Wed, 19 Nov 2014 03:10:12 +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 1Xqvd7-0001Vp-MG; Wed, 19 Nov 2014 03:08:29 +0000 Received: from irl-smtp01.263.net ([54.76.167.174]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xqvd4-0001Pj-M1; Wed, 19 Nov 2014 03:08:27 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by irl-smtp01.263.net (Postfix) with ESMTP id 292987F900; Wed, 19 Nov 2014 03:07:55 +0000 (UTC) X-RL-SENDER: jay.xu@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 127.0.0.1 X-LOGIN-NAME: jay.xu@rock-chips.com X-UNIQUE-TAG: <3ee82631d5641be171dae78ba51aa3f5> X-ATTACHMENT-NUM: 0 X-SENDER: xjq@rock-chips.com X-DNS-TYPE: 1 Received: from localhost.localdomain (localhost [127.0.0.1]) by irl-smtp01.263.net (Postfix) whith ESMTP id 247122QCNVA; Wed, 19 Nov 2014 03:07:55 +0000 (UTC) From: Jianqun Xu To: heiko@sntech.de, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.de, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, huangtao@rock-chips.com Subject: [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Date: Wed, 19 Nov 2014 11:07:48 +0800 Message-Id: <1416366468-4744-1-git-send-email-jay.xu@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416366365-4632-1-git-send-email-jay.xu@rock-chips.com> References: <1416366365-4632-1-git-send-email-jay.xu@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_190826_960275_D510517F X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: Sonny Rao , Jianqun Xu 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 We need to claim the clock which is driving the codec so that when we enable clock gating, we continue to clock the codec when needed. I make this an optional clock since there might be some applications where we don't need it but can still use the I2S block. Signed-off-by: Sonny Rao Signed-off-by: Jianqun Xu --- sound/soc/rockchip/rockchip_i2s.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index c74ba37..2820ade 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -28,6 +28,7 @@ struct rk_i2s_dev { struct clk *hclk; struct clk *mclk; + struct clk *oclk; struct snd_dmaengine_dai_dma_data capture_dma_data; struct snd_dmaengine_dai_dma_data playback_dma_data; @@ -439,6 +440,14 @@ static int rockchip_i2s_probe(struct platform_device *pdev) return PTR_ERR(i2s->mclk); } + i2s->oclk = devm_clk_get(&pdev->dev, "i2s_clk_out"); + if (IS_ERR(i2s->oclk)) { + dev_dbg(&pdev->dev, "Didn't find output clock\n"); + i2s->oclk = NULL; + } + if (i2s->oclk) + ret = clk_prepare_enable(i2s->oclk); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(regs)) @@ -505,6 +514,8 @@ static int rockchip_i2s_remove(struct platform_device *pdev) if (!pm_runtime_status_suspended(&pdev->dev)) i2s_runtime_suspend(&pdev->dev); + if (i2s->oclk) + clk_disable_unprepare(i2s->oclk); clk_disable_unprepare(i2s->mclk); clk_disable_unprepare(i2s->hclk); snd_dmaengine_pcm_unregister(&pdev->dev);