[2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
diff mbox

Message ID 1417571484-31405-1-git-send-email-jay.xu@rock-chips.com
State New, archived
Headers show

Commit Message

Jianqun Xu Dec. 3, 2014, 1:51 a.m. UTC
From: Sonny Rao <sonnyrao@chromium.org>

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 <sonnyrao@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 sound/soc/rockchip/rockchip_i2s.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Doug Anderson Dec. 3, 2014, 5:27 a.m. UTC | #1
Jianqun,

On Tue, Dec 2, 2014 at 5:51 PM, Jianqun Xu <jay.xu@rock-chips.com> wrote:
> From: Sonny Rao <sonnyrao@chromium.org>
>
> 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 <sonnyrao@chromium.org>
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
> ---
>  sound/soc/rockchip/rockchip_i2s.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

This looks fine to me now and you can add:

Reviewed-by: Doug Anderson <dianders@chromium.org>

...but you lost the whole CC list and this definitely needs to include
broonie in the "To" list, so you need to repost.  When you repost it
would be super helpful if you could include a version number and a
list of changes between versions.
jianqun Dec. 3, 2014, 7:14 a.m. UTC | #2
? 12/03/2014 01:27 PM, Doug Anderson ??:
> Jianqun,
> 
> On Tue, Dec 2, 2014 at 5:51 PM, Jianqun Xu <jay.xu@rock-chips.com> wrote:
>> From: Sonny Rao <sonnyrao@chromium.org>
>>
>> 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 <sonnyrao@chromium.org>
>> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
>> ---
>>  sound/soc/rockchip/rockchip_i2s.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
> 
> This looks fine to me now and you can add:
> 
> Reviewed-by: Doug Anderson <dianders@chromium.org>
> 
> ...but you lost the whole CC list and this definitely needs to include
> broonie in the "To" list, so you need to repost.  When you repost it
> would be super helpful if you could include a version number and a
> list of changes between versions.
> 
Dear Doug:

I try to send patches to linux-rockchip@lists.infradead.org first, and if no problem, I will re-send it to more reviewers
and thanks for your review

I will do it today, but may a little later
> 
>

Patch
diff mbox

diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index c74ba37..5db4f79 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,15 @@  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 +515,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);