linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
@ 2014-11-19  3:06 Jianqun Xu
  2014-11-19  3:06 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks Jianqun Xu
  2014-11-19  3:07 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
  0 siblings, 2 replies; 14+ messages in thread
From: Jianqun Xu @ 2014-11-19  3:06 UTC (permalink / raw)
  To: heiko, lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao
  Cc: Jianqun Xu

Reference to Chapter 3 Clock & Reset Unit (CRU) of RK3288 TRM, i2s0_clkout has
two source clock, XIN24M_DIV2 for 12M and clk_i2s0 for more kinds of
frequencies, I2S0(i2s_clk) has only single source clock clk_i2s0.

i2s0_clkout: generate to output to outside of chip, generally for codec
I2S0(i2s_clk): generate for i2s controller inside of chip

Jianqun Xu (2):
  ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks
  ASoC: rockchip: i2s: add support for grabbing output clock to codec

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

-- 
1.9.1


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

* [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks
  2014-11-19  3:06 [PATCH 0/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
@ 2014-11-19  3:06 ` Jianqun Xu
  2014-11-19  8:07   ` [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out" Jianqun Xu
  2014-11-19  3:07 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
  1 sibling, 1 reply; 14+ messages in thread
From: Jianqun Xu @ 2014-11-19  3:06 UTC (permalink / raw)
  To: heiko, lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao
  Cc: Jianqun Xu

Add i2s_clkout property, which enables output clock to chip outside,
this is generally for audio codec outside.

Also add it to example.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 Documentation/devicetree/bindings/sound/rockchip-i2s.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
index 9b82c20..3d23b15 100644
--- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
@@ -21,6 +21,7 @@ Required properties:
 - clock-names: should contain followings:
    - "i2s_hclk": clock for I2S BUS
    - "i2s_clk" : clock for I2S controller
+   - "i2s_clko" : clock for codec outside of chip
 
 Example for rk3288 I2S controller:
 
@@ -32,6 +33,6 @@ i2s@ff890000 {
 	#size-cells = <0>;
 	dmas = <&pdma1 0>, <&pdma1 1>;
 	dma-names = "tx", "rx";
-	clock-names = "i2s_hclk", "i2s_clk";
-	clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
+	clock-names = "i2s_hclk", "i2s_clk", "i2s_clko";
+	clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>, <&cru SCLK_I2S0_CLKOUT>;
 };
-- 
1.9.1


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

* [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-11-19  3:06 [PATCH 0/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
  2014-11-19  3:06 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks Jianqun Xu
@ 2014-11-19  3:07 ` Jianqun Xu
  2014-11-19  3:57   ` Sonny Rao
  2014-11-19  8:09   ` [PATCH v2 " Jianqun Xu
  1 sibling, 2 replies; 14+ 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] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-11-19  3:07 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
@ 2014-11-19  3:57   ` Sonny Rao
  2014-11-19  8:09   ` [PATCH v2 " Jianqun Xu
  1 sibling, 0 replies; 14+ messages in thread
From: Sonny Rao @ 2014-11-19  3:57 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: Heiko Stübner, lgirdwood, broonie, perex, tiwai,
	linux-arm-kernel, linux-rockchip, alsa-devel, linux-kernel,
	Tao Huang

Jay,

On Tue, Nov 18, 2014 at 7:07 PM, Jianqun Xu <jay.xu@rock-chips.com> wrote:

Mostly FYI, but if you take someone else's patch, you should also
retain their authorship by saying:
From: <person>
at the top of the message. I don't really mind, but please keep it in
mind for the future, thanks.

> 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	[flat|nested] 14+ messages in thread

* [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out"
  2014-11-19  3:06 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks Jianqun Xu
@ 2014-11-19  8:07   ` Jianqun Xu
  2014-11-19 10:10     ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Jianqun Xu @ 2014-11-19  8:07 UTC (permalink / raw)
  To: heiko, lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao
  Cc: Jianqun Xu

Add an property "i2s_clk_out", which enables to output clock to outside
of rockchip SoCs. Let's make it optional since not each board needs it.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
changes since v1:
- make "i2s_clk_out" optional, suggested by Sonny

 Documentation/devicetree/bindings/sound/rockchip-i2s.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
index 9b82c20..6dedd0d 100644
--- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
@@ -22,6 +22,10 @@ Required properties:
    - "i2s_hclk": clock for I2S BUS
    - "i2s_clk" : clock for I2S controller
 
+Optional property:
+   - "i2s_clk_out" : clock output to outside of chip, usally as master clock for audio
+   codec chip
+
 Example for rk3288 I2S controller:
 
 i2s@ff890000 {
@@ -32,6 +36,6 @@ i2s@ff890000 {
 	#size-cells = <0>;
 	dmas = <&pdma1 0>, <&pdma1 1>;
 	dma-names = "tx", "rx";
-	clock-names = "i2s_hclk", "i2s_clk";
-	clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
+	clock-names = "i2s_hclk", "i2s_clk", "i2s_clk_out";
+	clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>, <&cru SCLK_I2S0_CLKOUT>;
 };
-- 
1.9.1



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

* [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-11-19  3:07 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
  2014-11-19  3:57   ` Sonny Rao
@ 2014-11-19  8:09   ` Jianqun Xu
  2014-11-19 10:17     ` Heiko Stübner
  2014-11-19 10:27     ` Kever Yang
  1 sibling, 2 replies; 14+ messages in thread
From: Jianqun Xu @ 2014-11-19  8:09 UTC (permalink / raw)
  To: heiko, lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao
  Cc: Jianqun Xu, Sonny Rao

Patch is 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>
---
changes since v1:
- modify commit message

 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] 14+ messages in thread

* Re: [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out"
  2014-11-19  8:07   ` [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out" Jianqun Xu
@ 2014-11-19 10:10     ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2014-11-19 10:10 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: heiko, lgirdwood, perex, tiwai, linux-arm-kernel, linux-rockchip,
	alsa-devel, linux-kernel, huangtao

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Wed, Nov 19, 2014 at 04:07:27PM +0800, Jianqun Xu wrote:
> Add an property "i2s_clk_out", which enables to output clock to outside
> of rockchip SoCs. Let's make it optional since not each board needs it.

Don't send new patches as individual followups to patches in the series,
repost the series.  It becomes very difficult to follow what the current
series is (which is the latest version of everything, what ordering, is
everything still in the current version of the series).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-11-19  8:09   ` [PATCH v2 " Jianqun Xu
@ 2014-11-19 10:17     ` Heiko Stübner
  2014-11-19 10:27     ` Kever Yang
  1 sibling, 0 replies; 14+ messages in thread
From: Heiko Stübner @ 2014-11-19 10:17 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: lgirdwood, broonie, perex, tiwai, linux-arm-kernel,
	linux-rockchip, alsa-devel, linux-kernel, huangtao, Sonny Rao

Hi Jianqun,


Am Mittwoch, 19. November 2014, 16:09:27 schrieb Jianqun Xu:
> Patch is from Sonny Rao <sonnyrao@chromium.org>
that line above should read exactly:
From: Sonny Rao <sonnyrao@chromium.org>

that way git will also set the author correctly when importing the patch mbox.

> 
> 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>

I think we you're submitting someone elses patch you'll need a Signed-off-by 
line for yourself too [which marks that you were allowed to submit it etc], so 
it should read something like

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>


> ---
> changes since v1:
> - modify commit message
> 
>  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;
> +	}

blank line here?

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


Heiko


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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-11-19  8:09   ` [PATCH v2 " Jianqun Xu
  2014-11-19 10:17     ` Heiko Stübner
@ 2014-11-19 10:27     ` Kever Yang
  1 sibling, 0 replies; 14+ messages in thread
From: Kever Yang @ 2014-11-19 10:27 UTC (permalink / raw)
  To: Jianqun Xu, heiko, lgirdwood, broonie, perex, tiwai,
	linux-arm-kernel, linux-rockchip, alsa-devel, linux-kernel,
	huangtao
  Cc: Sonny Rao

Hi Jay,

On 11/19/2014 04:09 PM, Jianqun Xu wrote:
> Patch is from Sonny Rao <sonnyrao@chromium.org>
Here should be,

From: Sonny Rao <sonnyrao@chromium.org>

- Kever


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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-12-03 20:03         ` Mark Brown
@ 2014-12-03 23:03           ` Sonny Rao
  0 siblings, 0 replies; 14+ messages in thread
From: Sonny Rao @ 2014-12-03 23:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jianqun Xu, Liam Girdwood, perex, tiwai, Heiko Stübner,
	linux-arm-kernel, alsa-devel, linux-kernel, devicetree,
	linux-rockchip

On Wed, Dec 3, 2014 at 12:03 PM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Dec 03, 2014 at 11:38:13AM -0800, Sonny Rao wrote:
>> On Wed, Dec 3, 2014 at 11:20 AM, Mark Brown <broonie@kernel.org> wrote:
>
>> > I would expect that the clock for the CODEC should be managed by the
>> > CODEC if at all possible - that seems more logical than having the CPU
>> > I2S controller request and manage it if it's a separate clock.  Why add
>> > this to the CPU side driver?
>
>> This output clock has a mux and can either be a fixed 12Mhz output or
>> can be derived from the same fractional divider which drives the i2s
>> block.   I thought it was simpler to keep them all the same, but need
>> to put ownership in the i2s in anticipation of the i2s driver setting
>> it's own clock rate.
>
>> If you think this is an implementation detail and this output clock
>> should just be owned by the codec driver, even though I'm guessing it
>> will just have to be the same as i2s, then I think we can drop this
>> and make sure simple card (or whatever other codec driver) claims this
>> clock.
>
> simple-card obviously isn't a CODEC driver...

Yeah, sorry.

> For generality I think
> the clock does need to be exposed to the CODEC driver, otherwise this
> will work differently to how other systems are working and we can't
> substitute in a different clock on the CODEC side so easily if it
> doesn't happen to use the output from the I2S block.

Ok, then I think what we will do is abandon this patch and I will send
something that adds this functionality to the particular codec that
I'm interested in -- max98090.

I'm a little tied up at the moment so I'm not going to send that for a
little while, but will come eventually.

Thanks for the advice!

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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-12-03 19:38       ` Sonny Rao
@ 2014-12-03 20:03         ` Mark Brown
  2014-12-03 23:03           ` Sonny Rao
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2014-12-03 20:03 UTC (permalink / raw)
  To: Sonny Rao
  Cc: Jianqun Xu, Liam Girdwood, perex, tiwai, Heiko Stübner,
	linux-arm-kernel, alsa-devel, linux-kernel, devicetree,
	linux-rockchip

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

On Wed, Dec 03, 2014 at 11:38:13AM -0800, Sonny Rao wrote:
> On Wed, Dec 3, 2014 at 11:20 AM, Mark Brown <broonie@kernel.org> wrote:

> > I would expect that the clock for the CODEC should be managed by the
> > CODEC if at all possible - that seems more logical than having the CPU
> > I2S controller request and manage it if it's a separate clock.  Why add
> > this to the CPU side driver?

> This output clock has a mux and can either be a fixed 12Mhz output or
> can be derived from the same fractional divider which drives the i2s
> block.   I thought it was simpler to keep them all the same, but need
> to put ownership in the i2s in anticipation of the i2s driver setting
> it's own clock rate.

> If you think this is an implementation detail and this output clock
> should just be owned by the codec driver, even though I'm guessing it
> will just have to be the same as i2s, then I think we can drop this
> and make sure simple card (or whatever other codec driver) claims this
> clock.

simple-card obviously isn't a CODEC driver...  For generality I think
the clock does need to be exposed to the CODEC driver, otherwise this
will work differently to how other systems are working and we can't
substitute in a different clock on the CODEC side so easily if it
doesn't happen to use the output from the I2S block.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  2014-12-03 19:20     ` Mark Brown
@ 2014-12-03 19:38       ` Sonny Rao
  2014-12-03 20:03         ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Sonny Rao @ 2014-12-03 19:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jianqun Xu, Liam Girdwood, perex, tiwai, Heiko Stübner,
	linux-arm-kernel, alsa-devel, linux-kernel, devicetree,
	linux-rockchip

On Wed, Dec 3, 2014 at 11:20 AM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Dec 03, 2014 at 03:18:38PM +0800, Jianqun Xu 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.
>
> I would expect that the clock for the CODEC should be managed by the
> CODEC if at all possible - that seems more logical than having the CPU
> I2S controller request and manage it if it's a separate clock.  Why add
> this to the CPU side driver?

It's a good question.  Right now the way I'm running this stuff we're
mostly setting all the i2s the clock rates from the codec driver, but
I think this isn't the correct way to go, and the i2s driver needs to
set it's rate based on the hw params, but that isn't happening (yet).

This output clock has a mux and can either be a fixed 12Mhz output or
can be derived from the same fractional divider which drives the i2s
block.   I thought it was simpler to keep them all the same, but need
to put ownership in the i2s in anticipation of the i2s driver setting
it's own clock rate.

If you think this is an implementation detail and this output clock
should just be owned by the codec driver, even though I'm guessing it
will just have to be the same as i2s, then I think we can drop this
and make sure simple card (or whatever other codec driver) claims this
clock.


>
> We've not always done this for older systems due to the lack of a usable
> clock API but that's starting to be addressed.

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

* Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2014-12-03 19:20 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: lgirdwood, perex, tiwai, sonnyrao, heiko, linux-arm-kernel,
	alsa-devel, linux-kernel, devicetree, linux-rockchip

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

On Wed, Dec 03, 2014 at 03:18:38PM +0800, Jianqun Xu 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.

I would expect that the clock for the CODEC should be managed by the
CODEC if at all possible - that seems more logical than having the CPU
I2S controller request and manage it if it's a separate clock.  Why add
this to the CPU side driver?

We've not always done this for older systems due to the lack of a usable
clock API but that's starting to be addressed.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec
  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   ` Jianqun Xu
  2014-12-03 19:20     ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Jianqun Xu @ 2014-12-03  7:18 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, sonnyrao, heiko
  Cc: linux-arm-kernel, alsa-devel, linux-kernel, devicetree,
	linux-rockchip, Jianqun Xu

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 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index c74ba37..fd144ac 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,9 @@ 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] 14+ messages in thread

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19  3:06 [PATCH 0/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
2014-11-19  3:06 ` [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks Jianqun Xu
2014-11-19  8:07   ` [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out" Jianqun Xu
2014-11-19 10:10     ` Mark Brown
2014-11-19  3:07 ` [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec Jianqun Xu
2014-11-19  3:57   ` Sonny Rao
2014-11-19  8:09   ` [PATCH v2 " Jianqun Xu
2014-11-19 10:17     ` Heiko Stübner
2014-11-19 10:27     ` Kever Yang
2014-12-02 14:49 [PATCH 0/2] rockchip: i2s: patches to add optional clock output from Jianqun Xu
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 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

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).