[09/12] ASoC: rsnd: enable SRC setting via DT
diff mbox

Message ID 87zjhay4s6.wl%kuninori.morimoto.gx@renesas.com
State New, archived
Headers show

Commit Message

Kuninori Morimoto June 18, 2014, 8:56 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

some special board wants to exchange sampling rate by using SRC.
This patch enables its settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |    2 +-
 sound/soc/sh/rcar/src.c                            |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

Comments

Sergei Shtylyov June 18, 2014, 2:20 p.m. UTC | #1
Hello.

On 06/18/2014 12:56 PM, Kuninori Morimoto wrote:

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

> some special board wants to exchange sampling rate by using SRC.
> This patch enables its settings.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

[...]

> diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
> index 4d39505..93a5e58 100644
> --- a/sound/soc/sh/rcar/src.c
> +++ b/sound/soc/sh/rcar/src.c
[...]
> @@ -640,6 +640,16 @@ static void rsnd_of_parse_src(struct platform_device *pdev,
>   	info->src_info		= src_info;
>   	info->src_info_nr	= nr;
>
> +	i = 0;
> +	for_each_child_of_node(src_node, np) {
> +		src_info = info->src_info + i;
> +
> +		of_property_read_u32(src_node, "convert-rate",

    Are you sure it's 'src_node' here, not 'np'?

> +				     &src_info->convert_rate);
> +
> +		i++;
> +	}
> +

WBR, Sergei
Kuninori Morimoto June 19, 2014, 12:54 a.m. UTC | #2
Hi Sergei

> > @@ -640,6 +640,16 @@ static void rsnd_of_parse_src(struct platform_device *pdev,
> >   	info->src_info		= src_info;
> >   	info->src_info_nr	= nr;
> >
> > +	i = 0;
> > +	for_each_child_of_node(src_node, np) {
> > +		src_info = info->src_info + i;
> > +
> > +		of_property_read_u32(src_node, "convert-rate",
> 
>     Are you sure it's 'src_node' here, not 'np'?

Grr..
Nice catch !
Thank you for pointing it.
I will fix it in v2

Best regards
---
Kuninori Morimoto

Patch
diff mbox

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 41a120c..1d88d42 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -24,7 +24,7 @@  SSI subnode properties:
 - no-busif			: BUSIF is not ussed when [mem -> SSI] via DMA case
 
 SRC subnode properties:
-no properties at this point
+- convert-rate			: SRC convert rate if needed
 
 DAI subnode properties:
 - playback			: list of playback modules
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 4d39505..93a5e58 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -612,11 +612,11 @@  static void rsnd_of_parse_src(struct platform_device *pdev,
 			      const struct rsnd_of_data *of_data,
 			      struct rsnd_priv *priv)
 {
-	struct device_node *src_node;
+	struct device_node *src_node, *np;
 	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
 	struct rsnd_src_platform_info *src_info;
 	struct device *dev = &pdev->dev;
-	int nr;
+	int nr, i;
 
 	if (!of_data)
 		return;
@@ -640,6 +640,16 @@  static void rsnd_of_parse_src(struct platform_device *pdev,
 	info->src_info		= src_info;
 	info->src_info_nr	= nr;
 
+	i = 0;
+	for_each_child_of_node(src_node, np) {
+		src_info = info->src_info + i;
+
+		of_property_read_u32(src_node, "convert-rate",
+				     &src_info->convert_rate);
+
+		i++;
+	}
+
 rsnd_of_parse_src_end:
 	of_node_put(src_node);
 }