[07/10,v2] ASoC: rsnd: enable SRC setting via DT
diff mbox

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

Commit Message

Kuninori Morimoto June 23, 2014, 12:57 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>
---
v1 -> v2

 - src_node -> np on of_property_read_u32()

 .../devicetree/bindings/sound/renesas,rsnd.txt     |    2 +-
 sound/soc/sh/rcar/src.c                            |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

Comments

Mark Brown June 28, 2014, 1:40 p.m. UTC | #1
On Sun, Jun 22, 2014 at 05:57:42PM -0700, Kuninori Morimoto wrote:

>  SRC subnode properties:
> -no properties at this point
> +- convert-rate			: SRC convert rate if needed

It's not clear to me why this is something that we'd control in the
device tree.  Are there some systems which can't support this, if the
hardware can do it it's hard to see why someone wouldn't want to use it
(and why it wouldn't be a runtime decision anyway).
Kuninori Morimoto June 30, 2014, 12:41 a.m. UTC | #2
Hi Mark

Thank you for your feedback

> >  SRC subnode properties:
> > -no properties at this point
> > +- convert-rate			: SRC convert rate if needed
> 
> It's not clear to me why this is something that we'd control in the
> device tree.  Are there some systems which can't support this, if the
> hardware can do it it's hard to see why someone wouldn't want to use it
> (and why it wouldn't be a runtime decision anyway).

This is because we might have special codec or
very simple DA/AD converter which can accept only 1 rate
The image is like this.
(This image indicates codec accept 48kHz only)

48kHz   --->      48kHz
44.1kHz ---> [SRC] ---> [codec]
96kHz   --->

Then, this codec shouldn't return error
when it gets rate other than 48kHz on
snd_soc_dai_ops :: hw_params.

I can send v3 patch which has above explain
if you can accept this.

Now, this patch-set is...

o : accepted
x : this patch
- : not accepted

o ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
o ASoC: fsi: add fsi_pointer_update() for common pointer method
o ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
o ASoC: rsnd: SSI + DMA can select BUSIF
o ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
o ASoC: rsnd: enable DVC when capture
x ASoC: rsnd: enable SRC setting via DT
- ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
- ASoC: rsnd: DMA start address is properly used for each DMAC
- ASoC: rsnd: add DT support to DVC

Can you please skit "x" patch (= ASoC: rsnd: enable SRC setting via DT),
and consider about last "-" patches ?
Because "x" is independent patch, no relationship to "-" patches.

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..7f3c7d7 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(np, "convert-rate",
+				     &src_info->convert_rate);
+
+		i++;
+	}
+
 rsnd_of_parse_src_end:
 	of_node_put(src_node);
 }