2014-11-19 03:13:24

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH 0/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

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


2014-11-19 03:13:25

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH 1/2] ASoC: rockchip-i2s: dt: add i2s_clkout to list of clocks

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 <[email protected]>
---
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

2014-11-19 03:20:04

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

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 <[email protected]>
Signed-off-by: Jianqun Xu <[email protected]>
---
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

2014-11-19 03:57:39

by Sonny Rao

[permalink] [raw]
Subject: Re: [PATCH 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

Jay,

On Tue, Nov 18, 2014 at 7:07 PM, Jianqun Xu <[email protected]> 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 <[email protected]>
> Signed-off-by: Jianqun Xu <[email protected]>
> ---
> 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
>

2014-11-19 08:07:42

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out"

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 <[email protected]>
---
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

2014-11-19 08:09:44

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

Patch is from Sonny Rao <[email protected]>

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 <[email protected]>
---
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

2014-11-19 10:11:16

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] ASoC: rockchip-i2s: dt: add an optional property "i2s_clk_out"

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


Attachments:
(No filename) (483.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2014-11-19 10:14:23

by Heiko Stübner

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

Hi Jianqun,


Am Mittwoch, 19. November 2014, 16:09:27 schrieb Jianqun Xu:
> Patch is from Sonny Rao <[email protected]>
that line above should read exactly:
From: Sonny Rao <[email protected]>

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 <[email protected]>

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 <[email protected]>
Signed-off-by: Jianqun Xu <[email protected]>


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

2014-11-19 10:28:00

by Kever Yang

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] ASoC: rockchip: i2s: add support for grabbing output clock to codec

Hi Jay,

On 11/19/2014 04:09 PM, Jianqun Xu wrote:
> Patch is from Sonny Rao <[email protected]>
Here should be,

From: Sonny Rao <[email protected]>

- Kever