Re: [PATCH V2 1/3] ASoC: fsl_esai: spba clock is needed by esai device

2015-11-19 Thread Nicolin Chen
On Fri, Nov 20, 2015 at 02:17:51PM +0800, Shengjiu Wang wrote:

> diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt 
> b/Documentation/devicetree/bindings/sound/fsl,esai.txt
> index d3b6b5f..f1d5351 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt
> +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt
> @@ -27,6 +27,8 @@ Required properties:
> derive HCK, SCK and FS.
>   "fsys"The system clock derived from ahb clock used to
> derive HCK, SCK and FS.
> + "spba"The spba clock is needed when two spba master port
> +   is used.

I was expecting a little bit more detail like:

+   "spba"  The spba clock is required when ESAI is placed as
a bus slave of the Shared Peripheral Bus and when
two or more bus masters (CPU, DMA or DSP) try to
access it. This property is optional depending on
the SoC design.

> diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
> index 504e731..8749f53 100644
> --- a/sound/soc/fsl/fsl_esai.c
> +++ b/sound/soc/fsl/fsl_esai.c
> @@ -54,6 +54,7 @@ struct fsl_esai {
>   struct clk *coreclk;
>   struct clk *extalclk;
>   struct clk *fsysclk;
> + struct clk *spbaclk;

Please add one entry in the comment above for the new clock.

> @@ -819,6 +826,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
>   dev_warn(>dev, "failed to get fsys clock: %ld\n",
>   PTR_ERR(esai_priv->fsysclk));
>  
> + esai_priv->spbaclk = devm_clk_get(>dev, "spba");
> + if (IS_ERR(esai_priv->spbaclk))
> + dev_warn(>dev, "Cannot get spba clock: %ld\n",

It'd be better to write the warning following the previous one:
+   dev_warn(>dev, "failed to get spba clock: %ld\n",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 1/3] ASoC: fsl_esai: spba clock is needed by esai device

2015-11-19 Thread Shengjiu Wang
ESAI need to enable the spba clock, when sdma is using share peripheral
script. In this case, there is two spba master port is used, if don't
enable the clock, the spba bus will have arbitration issue, which may
cause read/write wrong data from/to ESAI registers.

Signed-off-by: Shengjiu Wang 
---
 Documentation/devicetree/bindings/sound/fsl,esai.txt |  2 ++
 sound/soc/fsl/fsl_esai.c | 12 
 2 files changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt 
b/Documentation/devicetree/bindings/sound/fsl,esai.txt
index d3b6b5f..f1d5351 100644
--- a/Documentation/devicetree/bindings/sound/fsl,esai.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt
@@ -27,6 +27,8 @@ Required properties:
  derive HCK, SCK and FS.
"fsys"The system clock derived from ahb clock used to
  derive HCK, SCK and FS.
+   "spba"The spba clock is needed when two spba master port
+ is used.
 
   - fsl,fifo-depth : The number of elements in the transmit and receive
  FIFOs. This number is the maximum allowed value for
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 504e731..8749f53 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -54,6 +54,7 @@ struct fsl_esai {
struct clk *coreclk;
struct clk *extalclk;
struct clk *fsysclk;
+   struct clk *spbaclk;
u32 fifo_depth;
u32 slot_width;
u32 slots;
@@ -469,6 +470,9 @@ static int fsl_esai_startup(struct snd_pcm_substream 
*substream,
ret = clk_prepare_enable(esai_priv->coreclk);
if (ret)
return ret;
+   ret = clk_prepare_enable(esai_priv->spbaclk);
+   if (ret)
+   goto err_spbaclk;
if (!IS_ERR(esai_priv->extalclk)) {
ret = clk_prepare_enable(esai_priv->extalclk);
if (ret)
@@ -499,6 +503,8 @@ err_fsysclk:
if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk);
 err_extalck:
+   clk_disable_unprepare(esai_priv->spbaclk);
+err_spbaclk:
clk_disable_unprepare(esai_priv->coreclk);
 
return ret;
@@ -564,6 +570,7 @@ static void fsl_esai_shutdown(struct snd_pcm_substream 
*substream,
clk_disable_unprepare(esai_priv->fsysclk);
if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk);
+   clk_disable_unprepare(esai_priv->spbaclk);
clk_disable_unprepare(esai_priv->coreclk);
 }
 
@@ -819,6 +826,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
dev_warn(>dev, "failed to get fsys clock: %ld\n",
PTR_ERR(esai_priv->fsysclk));
 
+   esai_priv->spbaclk = devm_clk_get(>dev, "spba");
+   if (IS_ERR(esai_priv->spbaclk))
+   dev_warn(>dev, "Cannot get spba clock: %ld\n",
+   PTR_ERR(esai_priv->spbaclk));
+
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(>dev, "no irq for node %s\n", pdev->name);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 1/3] ASoC: fsl_esai: spba clock is needed by esai device

2015-11-19 Thread Shengjiu Wang
ESAI need to enable the spba clock, when sdma is using share peripheral
script. In this case, there is two spba master port is used, if don't
enable the clock, the spba bus will have arbitration issue, which may
cause read/write wrong data from/to ESAI registers.

Signed-off-by: Shengjiu Wang 
---
 Documentation/devicetree/bindings/sound/fsl,esai.txt |  2 ++
 sound/soc/fsl/fsl_esai.c | 12 
 2 files changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt 
b/Documentation/devicetree/bindings/sound/fsl,esai.txt
index d3b6b5f..f1d5351 100644
--- a/Documentation/devicetree/bindings/sound/fsl,esai.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt
@@ -27,6 +27,8 @@ Required properties:
  derive HCK, SCK and FS.
"fsys"The system clock derived from ahb clock used to
  derive HCK, SCK and FS.
+   "spba"The spba clock is needed when two spba master port
+ is used.
 
   - fsl,fifo-depth : The number of elements in the transmit and receive
  FIFOs. This number is the maximum allowed value for
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 504e731..8749f53 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -54,6 +54,7 @@ struct fsl_esai {
struct clk *coreclk;
struct clk *extalclk;
struct clk *fsysclk;
+   struct clk *spbaclk;
u32 fifo_depth;
u32 slot_width;
u32 slots;
@@ -469,6 +470,9 @@ static int fsl_esai_startup(struct snd_pcm_substream 
*substream,
ret = clk_prepare_enable(esai_priv->coreclk);
if (ret)
return ret;
+   ret = clk_prepare_enable(esai_priv->spbaclk);
+   if (ret)
+   goto err_spbaclk;
if (!IS_ERR(esai_priv->extalclk)) {
ret = clk_prepare_enable(esai_priv->extalclk);
if (ret)
@@ -499,6 +503,8 @@ err_fsysclk:
if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk);
 err_extalck:
+   clk_disable_unprepare(esai_priv->spbaclk);
+err_spbaclk:
clk_disable_unprepare(esai_priv->coreclk);
 
return ret;
@@ -564,6 +570,7 @@ static void fsl_esai_shutdown(struct snd_pcm_substream 
*substream,
clk_disable_unprepare(esai_priv->fsysclk);
if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk);
+   clk_disable_unprepare(esai_priv->spbaclk);
clk_disable_unprepare(esai_priv->coreclk);
 }
 
@@ -819,6 +826,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
dev_warn(>dev, "failed to get fsys clock: %ld\n",
PTR_ERR(esai_priv->fsysclk));
 
+   esai_priv->spbaclk = devm_clk_get(>dev, "spba");
+   if (IS_ERR(esai_priv->spbaclk))
+   dev_warn(>dev, "Cannot get spba clock: %ld\n",
+   PTR_ERR(esai_priv->spbaclk));
+
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(>dev, "no irq for node %s\n", pdev->name);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 1/3] ASoC: fsl_esai: spba clock is needed by esai device

2015-11-19 Thread Nicolin Chen
On Fri, Nov 20, 2015 at 02:17:51PM +0800, Shengjiu Wang wrote:

> diff --git a/Documentation/devicetree/bindings/sound/fsl,esai.txt 
> b/Documentation/devicetree/bindings/sound/fsl,esai.txt
> index d3b6b5f..f1d5351 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,esai.txt
> +++ b/Documentation/devicetree/bindings/sound/fsl,esai.txt
> @@ -27,6 +27,8 @@ Required properties:
> derive HCK, SCK and FS.
>   "fsys"The system clock derived from ahb clock used to
> derive HCK, SCK and FS.
> + "spba"The spba clock is needed when two spba master port
> +   is used.

I was expecting a little bit more detail like:

+   "spba"  The spba clock is required when ESAI is placed as
a bus slave of the Shared Peripheral Bus and when
two or more bus masters (CPU, DMA or DSP) try to
access it. This property is optional depending on
the SoC design.

> diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
> index 504e731..8749f53 100644
> --- a/sound/soc/fsl/fsl_esai.c
> +++ b/sound/soc/fsl/fsl_esai.c
> @@ -54,6 +54,7 @@ struct fsl_esai {
>   struct clk *coreclk;
>   struct clk *extalclk;
>   struct clk *fsysclk;
> + struct clk *spbaclk;

Please add one entry in the comment above for the new clock.

> @@ -819,6 +826,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
>   dev_warn(>dev, "failed to get fsys clock: %ld\n",
>   PTR_ERR(esai_priv->fsysclk));
>  
> + esai_priv->spbaclk = devm_clk_get(>dev, "spba");
> + if (IS_ERR(esai_priv->spbaclk))
> + dev_warn(>dev, "Cannot get spba clock: %ld\n",

It'd be better to write the warning following the previous one:
+   dev_warn(>dev, "failed to get spba clock: %ld\n",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/