linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] rockchip: i2s: patches to add optional clock output from
@ 2014-12-02 14:49 Jianqun Xu
  2014-12-02 14:49 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out" Jianqun Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Jianqun Xu @ 2014-12-02 14:49 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, jay.xu, sonnyrao, heiko
  Cc: linux-arm-kernel, alsa-devel, linux-kernel, devicetree, linux-rockchip

The clock output from rockchip SoCs' CRU to chip outside is from the same source
as hclk which is for i2s controller. We make it optional because some audio
codec outside not need the master clock from SoC but from other clock source.

Jianqun Xu (2):
  ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out"
  ASoC: rockchip: i2s: add support for grabbing output clock to codec

 Documentation/devicetree/bindings/sound/rockchip-i2s.txt |  8 ++++++--
 sound/soc/rockchip/rockchip_i2s.c                        | 11 +++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
@ 2014-11-19  3:07 Jianqun Xu
  2014-11-19  8:09 ` [PATCH v2 " Jianqun Xu
  0 siblings, 1 reply; 20+ messages in thread
From: Jianqun Xu @ 2014-11-19  3:07 UTC (permalink / raw)
  To: heiko, lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao
  Cc: Jianqun Xu, Sonny Rao

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 | 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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-12-03 23:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-02 14:49 [PATCH 0/2] rockchip: i2s: patches to add optional clock output from Jianqun Xu
2014-12-02 14:49 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out" Jianqun Xu
2014-12-02 17:57   ` Doug Anderson
2014-12-02 14:52 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
2014-12-02 17:54   ` Doug Anderson
2014-12-03  1:03     ` Jianqun
2014-12-03  5:18       ` Doug Anderson
2014-12-03 12:55         ` Mark Brown
2014-12-03  7:18 ` [PATCH v2 0/2] ASoC: rockchip: i2s: driver could output "i2s-clk-out" optionally Jianqun Xu
2014-12-03  7:18   ` [PATCH v2 1/2] ASoC: dt-bindings: rockchip-i2s: add an optional property "i2s_clk_out" Jianqun Xu
2014-12-03  7:18   ` [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
2014-12-03 19:20     ` Mark Brown
2014-12-03 19:38       ` Sonny Rao
2014-12-03 20:03         ` Mark Brown
2014-12-03 23:03           ` Sonny Rao
2014-12-03 23:22             ` [alsa-devel] " Dylan Reid
2014-12-03 23:52               ` Sonny Rao
  -- strict thread matches above, loose matches on Subject: below --
2014-11-19  3:07 [PATCH " Jianqun Xu
2014-11-19  8:09 ` [PATCH v2 " Jianqun Xu
2014-11-19 10:17   ` Heiko Stübner
2014-11-19 10:27   ` Kever Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).