All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support
@ 2015-07-15  7:06 Kuninori Morimoto
  2015-07-15  7:07 ` [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix() Kuninori Morimoto
                   ` (35 more replies)
  0 siblings, 36 replies; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:06 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon


Hi Mark, Simon

These patches add CTU/MIX prototype support on Renesas sound card driver.
It needs DPCM feature, so it is assuming to be used via rsrc-card sound card.
These CTU/MIX is still prototype support. This Mixer works well if sound A and B
are using same bit length, same sampling rate.

 1) -  2) adds audio prefix support on DT which is needed on DPCM
 3) - 29) cleanup/tidyup/workaround/prepare patches for CTU/MIX support
30) - 31) CTU/MIX support on driver
32) - 35) CTU/MIX support on SoC

Simon, This time I didn't Cc:ed to SH-ML, since 32) - 35) need
Document update (?). It is done on 30) - 31).
I can post 32) - 35) if Mark accepted 1) - 31)

Kuninori Morimoto (35):
       1) ASoC: core: add snd_soc_of_parse_audio_prefix()
       2) ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing
       3) ASoC: rsnd: remove unnecessary 'out of memory' message from SSI
       4) ASoC: rsnd: remove unnecessary 'out of memory' message from SRC
       5) ASoC: rsnd: remove unnecessary 'out of memory' message from DVC
       6) ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN
       7) ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE
       8) ASoC: rsnd: fixup each module counter on __rsnd_mod_call()
       9) ASoC: rsnd: add workaround for SRC sync convert + DVC
      10) ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL
      11) ASoC: rsnd: move DVC specific macro into dvc.c
      12) ASoC: rsnd: move SRC specific macro into src.c
      13) ASoC: rsnd: dvc: make sure DVC soft reset
      14) ASoC: rsnd: src: make sure SRC soft reset
      15) ASoC: rsnd: enable module multi connection
      16) ASoC: rsnd: rename rsnd_path_parse/break() into add/remove
      17) ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting
      18) ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()
      19) ASoC: rsnd: add rsnd_src_initialize_lock/unlock()
      20) ASoC: rsnd: tidyup ADINR function name
      21) ASoC: rsnd: add rsnd_get_adinr_chan()
      22) ASoC: rsnd: tidyup data align position
      23) ASoC: rsnd: show debug message for SSI/SRC/DVC connection
      24) ASoC: rsnd: tidyup rsnd_dma_ops definition place
      25) ASoC: rsnd: check the Gen1 at the beginning of DVC probe
      26) ASoC: rsnd: dma: add DMA name on .ops
      27) ASoC: rsnd: add rsnd_io_to_mod()
      28) ASoC: rsnd: tidyup SRC position on each code
      29) ASoC: rsnd: update Audio DMA path search method
      30) ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support
      31) ASoC: rsnd: add MIX (Mixer) support
      32) ARM: shmobile: r8a7790: Add Audio CTU support on DTSI
      33) ARM: shmobile: r8a7790: Add Audio MIX support on DTSI
      34) ARM: shmobile: r8a7791: Add Audio CTU support on DTSI
      35) ARM: shmobile: r8a7791: Add Audio MIX support on DTSI

 Documentation/devicetree/bindings/sound/renesas,rsnd.txt      |  22 +++++++++++
 Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt |   7 ++++
 arch/arm/boot/dts/r8a7790.dtsi                                |  23 ++++++++++++
 arch/arm/boot/dts/r8a7791.dtsi                                |  23 ++++++++++++
 include/dt-bindings/clock/r8a7790-clock.h                     |   2 +
 include/dt-bindings/clock/r8a7791-clock.h                     |   2 +
 include/sound/rcar_snd.h                                      |  14 +++++++
 include/sound/soc.h                                           |   4 ++
 sound/soc/sh/rcar/Makefile                                    |   2 +-
 sound/soc/sh/rcar/core.c                                      | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
 sound/soc/sh/rcar/ctu.c                                       | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/sh/rcar/dma.c                                       | 126 ++++++++++++++++++++++++++++++++++++++++++--------------------
 sound/soc/sh/rcar/dvc.c                                       |  73 ++++++++++++++++--------------------
 sound/soc/sh/rcar/gen.c                                       |  17 ++++++++-
 sound/soc/sh/rcar/mix.c                                       | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h                                      | 107 ++++++++++++++++++++++++++++++++++++----------------
 sound/soc/sh/rcar/rsrc-card.c                                 |  22 +++++++++--
 sound/soc/sh/rcar/src.c                                       | 117 +++++++++++++++++++++++++++++++--------------------------
 sound/soc/sh/rcar/ssi.c                                       |   4 +-
 sound/soc/soc-core.c                                          |  20 ++++++++++
 20 files changed, 952 insertions(+), 198 deletions(-)


Best regards
---
Kuninori Morimoto

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

* [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
@ 2015-07-15  7:07 ` Kuninori Morimoto
  2015-07-16 21:01   ` Applied "ASoC: core: add snd_soc_of_parse_audio_prefix()" to the asoc tree Mark Brown
  2015-07-15  7:08 ` [PATCH 02/35] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing Kuninori Morimoto
                   ` (34 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:07 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current ASoC can add name_prefix for DAPM, and it is necessary for
route settings. This patch adds snd_soc_of_parse_audio_prefix() for
this purpose. It will be used with snd_soc_of_parse_audio_routing().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 include/sound/soc.h  |  4 ++++
 sound/soc/soc-core.c | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 93df8bf..75cd19c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1604,6 +1604,10 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 int snd_soc_of_parse_tdm_slot(struct device_node *np,
 			      unsigned int *slots,
 			      unsigned int *slot_width);
+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+				   struct snd_soc_codec_conf *codec_conf,
+				   struct device_node *of_node,
+				   const char *propname);
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a4a5c0..fd15d54 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3303,6 +3303,26 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot);
 
+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+				   struct snd_soc_codec_conf *codec_conf,
+				   struct device_node *of_node,
+				   const char *propname)
+{
+	struct device_node *np = card->dev->of_node;
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(np, propname, &str);
+	if (ret < 0) {
+		/* no prefix is not error */
+		return;
+	}
+
+	codec_conf->of_node	= of_node;
+	codec_conf->name_prefix	= str;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix);
+
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname)
 {
-- 
1.9.1

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

* [PATCH 02/35] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
  2015-07-15  7:07 ` [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix() Kuninori Morimoto
@ 2015-07-15  7:08 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing" to the asoc tree Mark Brown
  2015-07-15  7:08 ` [PATCH 03/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SSI Kuninori Morimoto
                   ` (33 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

using common audio routing path method makes sense.
Let's use snd_soc_of_parse_audio_route/prefix.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 .../bindings/sound/renesas,rsrc-card.txt           |  7 +++++++
 sound/soc/sh/rcar/rsrc-card.c                      | 22 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index c641550..962748a 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -6,6 +6,7 @@ Required properties:
 
 - compatible				: "renesas,rsrc-card,<board>"
 					  Examples with soctypes are:
+					    - "renesas,rsrc-card"
 					    - "renesas,rsrc-card,lager"
 					    - "renesas,rsrc-card,koelsch"
 Optional properties:
@@ -29,6 +30,12 @@ Optional subnode properties:
 - frame-inversion			: bool property. Add this if the
 					  dai-link uses frame clock inversion.
 - convert-rate				: platform specified sampling rate convert
+- audio-prefix				: see audio-routing
+- audio-routing				: A list of the connections between audio components.
+					  Each entry is a pair of strings, the first being the connection's sink,
+					  the second being the connection's source. Valid names for sources.
+					  use audio-prefix if some components is using same sink/sources naming.
+					  it can be used if compatible was "renesas,rsrc-card";
 
 Required CPU/CODEC subnodes properties:
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 84e9357..d61db9c 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -41,6 +41,7 @@ static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
 static const struct of_device_id rsrc_card_of_match[] = {
 	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
+	{ .compatible = "renesas,rsrc-card", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
@@ -242,8 +243,15 @@ static int rsrc_card_parse_links(struct device_node *np,
 		snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
 
 		/* additional name prefix */
-		priv->codec_conf.of_node	= dai_link->codec_of_node;
-		priv->codec_conf.name_prefix	= of_data->prefix;
+		if (of_data) {
+			priv->codec_conf.of_node = dai_link->codec_of_node;
+			priv->codec_conf.name_prefix = of_data->prefix;
+		} else {
+			snd_soc_of_parse_audio_prefix(&priv->snd_card,
+						      &priv->codec_conf,
+						      dai_link->codec_of_node,
+						      "audio-prefix");
+		}
 
 		/* set dai_name */
 		snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
@@ -361,8 +369,14 @@ static int rsrc_card_parse_of(struct device_node *node,
 	priv->snd_card.num_links		= num;
 	priv->snd_card.codec_conf		= &priv->codec_conf;
 	priv->snd_card.num_configs		= 1;
-	priv->snd_card.of_dapm_routes		= of_data->routes;
-	priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+
+	if (of_data) {
+		priv->snd_card.of_dapm_routes		= of_data->routes;
+		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+	} else {
+		snd_soc_of_parse_audio_routing(&priv->snd_card,
+					       "audio-routing");
+	}
 
 	/* Parse the card name from DT */
 	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-- 
1.9.1

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

* [PATCH 03/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SSI
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
  2015-07-15  7:07 ` [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix() Kuninori Morimoto
  2015-07-15  7:08 ` [PATCH 02/35] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing Kuninori Morimoto
@ 2015-07-15  7:08 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SSI" to the asoc tree Mark Brown
  2015-07-15  7:08 ` [PATCH 04/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SRC Kuninori Morimoto
                   ` (32 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/ssi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2fbe59f..d45b9a7 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -770,10 +770,8 @@ int rsnd_ssi_probe(struct platform_device *pdev,
 	 */
 	nr	= info->ssi_info_nr;
 	ssi	= devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL);
-	if (!ssi) {
-		dev_err(dev, "SSI allocate failed\n");
+	if (!ssi)
 		return -ENOMEM;
-	}
 
 	priv->ssi	= ssi;
 	priv->ssi_nr	= nr;
-- 
1.9.1

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

* [PATCH 04/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SRC
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2015-07-15  7:08 ` [PATCH 03/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SSI Kuninori Morimoto
@ 2015-07-15  7:08 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SRC" to the asoc tree Mark Brown
  2015-07-15  7:09 ` [PATCH 05/35] ASoC: rsnd: remove unnecessary 'out of memory' message from DVC Kuninori Morimoto
                   ` (31 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/src.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index c61c171..37927ca 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -1047,10 +1047,8 @@ int rsnd_src_probe(struct platform_device *pdev,
 		return 0;
 
 	src	= devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL);
-	if (!src) {
-		dev_err(dev, "SRC allocate failed\n");
+	if (!src)
 		return -ENOMEM;
-	}
 
 	priv->src_nr	= nr;
 	priv->src	= src;
-- 
1.9.1

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

* [PATCH 05/35] ASoC: rsnd: remove unnecessary 'out of memory' message from DVC
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2015-07-15  7:08 ` [PATCH 04/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SRC Kuninori Morimoto
@ 2015-07-15  7:09 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from DVC" to the asoc tree Mark Brown
  2015-07-15  7:09 ` [PATCH 06/35] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN Kuninori Morimoto
                   ` (30 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dvc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 36fc020..dbf0da6 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -354,10 +354,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	}
 
 	dvc	= devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
-	if (!dvc) {
-		dev_err(dev, "CMD allocate failed\n");
+	if (!dvc)
 		return -ENOMEM;
-	}
 
 	priv->dvc_nr	= nr;
 	priv->dvc	= dvc;
-- 
1.9.1

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

* [PATCH 06/35] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2015-07-15  7:09 ` [PATCH 05/35] ASoC: rsnd: remove unnecessary 'out of memory' message from DVC Kuninori Morimoto
@ 2015-07-15  7:09 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN" to the asoc tree Mark Brown
  2015-07-15  7:09 ` [PATCH 07/35] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE Kuninori Morimoto
                   ` (29 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

based on datasheet

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/gen.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 48f704b..9dc1968 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -216,7 +216,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		/* FIXME: it needs SSI_MODE2/3 in the future */
 		RSND_GEN_M_REG(SSI_BUSIF_MODE,	0x0,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
-		RSND_GEN_M_REG(BUSIF_DALIGN,	0x8,	0x80),
+		RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8,	0x80),
 		RSND_GEN_M_REG(SSI_CTRL,	0x10,	0x80),
 		RSND_GEN_M_REG(INT_ENABLE,	0x18,	0x80),
 	};
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f729646..f49b0cb 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -136,7 +136,7 @@ enum rsnd_reg {
 #define RSND_REG_AUDIO_CLK_SEL2		RSND_REG_SHARE19
 #define RSND_REG_CMD_CTRL		RSND_REG_SHARE20
 #define RSND_REG_CMDOUT_TIMSEL		RSND_REG_SHARE21
-#define RSND_REG_BUSIF_DALIGN		RSND_REG_SHARE22
+#define RSND_REG_SSI_BUSIF_DALIGN	RSND_REG_SHARE22
 #define RSND_REG_DVC_VRCTR		RSND_REG_SHARE23
 #define RSND_REG_DVC_VRPDR		RSND_REG_SHARE24
 #define RSND_REG_DVC_VRDBR		RSND_REG_SHARE25
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 37927ca..3f6f4df 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 			val |= 0x76543210 & ~mask;
 			break;
 		}
-		rsnd_mod_write(ssi_mod, BUSIF_DALIGN, val);
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_DALIGN, val);
 
 	}
 
-- 
1.9.1

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

* [PATCH 07/35] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2015-07-15  7:09 ` [PATCH 06/35] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN Kuninori Morimoto
@ 2015-07-15  7:09 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE" to the asoc tree Mark Brown
  2015-07-15  7:10 ` [PATCH 08/35] ASoC: rsnd: fixup each module counter on __rsnd_mod_call() Kuninori Morimoto
                   ` (28 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

based on datasheet

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/gen.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 9 ++++-----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 9dc1968..5d3592df 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -218,7 +218,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8,	0x80),
 		RSND_GEN_M_REG(SSI_CTRL,	0x10,	0x80),
-		RSND_GEN_M_REG(INT_ENABLE,	0x18,	0x80),
+		RSND_GEN_M_REG(SSI_INT_ENABLE,	0x18,	0x80),
 	};
 	struct rsnd_regmap_field_conf conf_scu[] = {
 		RSND_GEN_M_REG(SRC_BUSIF_MODE,	0x0,	0x20),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f49b0cb..9ecd151 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -119,7 +119,7 @@ enum rsnd_reg {
 #define RSND_REG_SSI_CTRL		RSND_REG_SHARE02
 #define RSND_REG_SSI_BUSIF_MODE		RSND_REG_SHARE03
 #define RSND_REG_SSI_BUSIF_ADINR	RSND_REG_SHARE04
-#define RSND_REG_INT_ENABLE		RSND_REG_SHARE05
+#define RSND_REG_SSI_INT_ENABLE		RSND_REG_SHARE05
 #define RSND_REG_SRC_BSDSR		RSND_REG_SHARE06
 #define RSND_REG_SRC_BSISR		RSND_REG_SHARE07
 #define RSND_REG_DIV_EN			RSND_REG_SHARE08
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 3f6f4df..9e11f73 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -215,10 +215,9 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod)
 		return 0;
 
 	/* enable SSI interrupt if Gen2 */
-	if (rsnd_ssi_is_dma_mode(ssi_mod))
-		rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0e000000);
-	else
-		rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
+	rsnd_mod_write(ssi_mod, SSI_INT_ENABLE,
+		       rsnd_ssi_is_dma_mode(ssi_mod) ?
+		       0x0e000000 : 0x0f000000);
 
 	return 0;
 }
@@ -231,7 +230,7 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod)
 		return 0;
 
 	/* disable SSI interrupt if Gen2 */
-	rsnd_mod_write(ssi_mod, INT_ENABLE, 0x00000000);
+	rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, 0x00000000);
 
 	return 0;
 }
-- 
1.9.1

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

* [PATCH 08/35] ASoC: rsnd: fixup each module counter on __rsnd_mod_call()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2015-07-15  7:09 ` [PATCH 07/35] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE Kuninori Morimoto
@ 2015-07-15  7:10 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: fixup each module counter on __rsnd_mod_call()" to the asoc tree Mark Brown
  2015-07-15  7:10 ` [PATCH 09/35] ASoC: rsnd: add workaround for SRC sync convert + DVC Kuninori Morimoto
                   ` (27 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

'5451ea443b ("ASoC: rsnd: count each mod (SSI/SRC/DVC)")' counts each
module's callback status, but counts 1st callback only.
This patch fixup it. Otherwise, multi-called function will be trouble

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f1e5920..d44bfb7 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -242,9 +242,9 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	if (val == __rsnd_mod_call_##func) {				\
 		called = 1;						\
 		ret = (mod)->ops->func(mod, io, param);			\
-		mod->status = (mod->status & ~mask) +			\
-			(add << __rsnd_mod_shift_##func);		\
 	}								\
+	mod->status = (mod->status & ~mask) +				\
+		(add << __rsnd_mod_shift_##func);			\
 	dev_dbg(dev, "%s[%d] 0x%08x %s\n",				\
 		rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status,	\
 		called ? #func : "");					\
-- 
1.9.1

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

* [PATCH 09/35] ASoC: rsnd: add workaround for SRC sync convert + DVC
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2015-07-15  7:10 ` [PATCH 08/35] ASoC: rsnd: fixup each module counter on __rsnd_mod_call() Kuninori Morimoto
@ 2015-07-15  7:10 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: add workaround for SRC sync convert + DVC" to the asoc tree Mark Brown
  2015-07-15  7:10 ` [PATCH 10/35] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL Kuninori Morimoto
                   ` (26 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

We couldn't use SRC sync convert mode together with DVC,
but we can use workaround for it.
This patch adds workaround and can use SRC sync convert + DVC

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/src.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 9e11f73..38d0aba 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -616,6 +616,14 @@ static void rsnd_src_irq_ctrol_gen2(struct rsnd_mod *mod, int enable)
 		int_val = 0;
 	}
 
+	/*
+	 * WORKAROUND
+	 *
+	 * ignore over flow error when rsnd_enable_sync_convert()
+	 */
+	if (rsnd_enable_sync_convert(src))
+		sys_int_val = sys_int_val & 0xffff;
+
 	rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
 	rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
 	rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
@@ -631,11 +639,22 @@ static void rsnd_src_error_clear_gen2(struct rsnd_mod *mod)
 
 static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
 {
-	u32 val = OUF_SRC(rsnd_mod_id(mod));
+	struct rsnd_src *src = rsnd_mod_to_src(mod);
+	u32 val0, val1;
 	bool ret = false;
 
-	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val) ||
-	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val)) {
+	val0 = val1 = OUF_SRC(rsnd_mod_id(mod));
+
+	/*
+	 * WORKAROUND
+	 *
+	 * ignore over flow error when rsnd_enable_sync_convert()
+	 */
+	if (rsnd_enable_sync_convert(src))
+		val0 = val0 & 0xffff;
+
+	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val0) ||
+	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val1)) {
 		struct rsnd_src *src = rsnd_mod_to_src(mod);
 
 		src->err++;
@@ -651,7 +670,16 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
 static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
 				struct rsnd_dai_stream *io)
 {
-	u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11;
+	struct rsnd_src *src = rsnd_mod_to_src(mod);
+	u32 val;
+
+	/*
+	 * WORKAROUND
+	 *
+	 * Enable SRC output if you want to use sync convert together with DVC
+	 */
+	val = (rsnd_io_to_mod_dvc(io) && !rsnd_enable_sync_convert(src)) ?
+		0x01 : 0x11;
 
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
@@ -921,13 +949,6 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
 		return 0;
 
 	/*
-	 * We can't use SRC sync convert
-	 * if it has DVC
-	 */
-	if (rsnd_io_to_mod_dvc(io))
-		return 0;
-
-	/*
 	 * enable sync convert
 	 */
 	ret = rsnd_kctrl_new_s(mod, io, rtd,
-- 
1.9.1

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

* [PATCH 10/35] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2015-07-15  7:10 ` [PATCH 09/35] ASoC: rsnd: add workaround for SRC sync convert + DVC Kuninori Morimoto
@ 2015-07-15  7:10 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL" to the asoc tree Mark Brown
  2015-07-15  7:11 ` [PATCH 11/35] ASoC: rsnd: move DVC specific macro into dvc.c Kuninori Morimoto
                   ` (25 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

enabling to use same method for exception case is useful.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/rsnd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 9ecd151..46eb4da 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -316,7 +316,7 @@ struct rsnd_mod {
 
 #define rsnd_mod_to_priv(mod) ((mod)->priv)
 #define rsnd_mod_to_dma(mod) (&(mod)->dma)
-#define rsnd_mod_id(mod) ((mod)->id)
+#define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1)
 #define rsnd_mod_hw_start(mod)	clk_enable((mod)->clk)
 #define rsnd_mod_hw_stop(mod)	clk_disable((mod)->clk)
 
-- 
1.9.1

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

* [PATCH 11/35] ASoC: rsnd: move DVC specific macro into dvc.c
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2015-07-15  7:10 ` [PATCH 10/35] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL Kuninori Morimoto
@ 2015-07-15  7:11 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: move DVC specific macro into dvc.c" to the asoc tree Mark Brown
  2015-07-15  7:11 ` [PATCH 12/35] ASoC: rsnd: move SRC specific macro into src.c Kuninori Morimoto
                   ` (24 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

rsnd_dvc_nr() is used only from dvc.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dvc.c  | 1 +
 sound/soc/sh/rcar/rsnd.h | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index dbf0da6..8a61aa3 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -24,6 +24,7 @@ struct rsnd_dvc {
 	struct rsnd_kctrl_cfg_s rdown;	/* Ramp Rate Down */
 };
 
+#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
 #define rsnd_dvc_of_node(priv) \
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,dvc")
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 46eb4da..8f793f0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -579,7 +579,4 @@ void rsnd_dvc_remove(struct platform_device *pdev,
 		     struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
 
-#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
-
-
 #endif
-- 
1.9.1

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

* [PATCH 12/35] ASoC: rsnd: move SRC specific macro into src.c
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2015-07-15  7:11 ` [PATCH 11/35] ASoC: rsnd: move DVC specific macro into dvc.c Kuninori Morimoto
@ 2015-07-15  7:11 ` Kuninori Morimoto
  2015-07-16 21:11   ` Applied "ASoC: rsnd: move SRC specific macro into src.c" to the asoc tree Mark Brown
  2015-07-15  7:12 ` [PATCH 13/35] ASoC: rsnd: dvc: make sure DVC soft reset Kuninori Morimoto
                   ` (23 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

rsnd_src_nr() is used only from src.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/rsnd.h | 2 --
 sound/soc/sh/rcar/src.c  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 8f793f0..c8d2029 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -554,8 +554,6 @@ int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
 int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
-#define rsnd_src_nr(priv) ((priv)->src_nr)
-
 /*
  *	R-Car SSI
  */
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 38d0aba..0b06ac8 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -30,6 +30,7 @@ struct rsnd_src {
 
 #define RSND_SRC_NAME_SIZE 16
 
+#define rsnd_src_nr(priv) ((priv)->src_nr)
 #define rsnd_enable_sync_convert(src) ((src)->sen.val)
 #define rsnd_src_of_node(priv) \
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src")
-- 
1.9.1

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

* [PATCH 13/35] ASoC: rsnd: dvc: make sure DVC soft reset
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2015-07-15  7:11 ` [PATCH 12/35] ASoC: rsnd: move SRC specific macro into src.c Kuninori Morimoto
@ 2015-07-15  7:12 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: dvc: make sure DVC soft reset" to the asoc tree Mark Brown
  2015-07-15  7:12 ` [PATCH 14/35] ASoC: rsnd: src: make sure SRC soft reset Kuninori Morimoto
                   ` (22 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxRSR (Software reset Register) is one
of them. These xxxRSR need be set to 1 to 0 when software reset.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_dvc_soft_reset() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dvc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 8a61aa3..24d0763 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -64,6 +64,12 @@ static const char * const dvc_ramp_rate[] = {
 	"0.125 dB/8192 steps",	 /* 10111 */
 };
 
+static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, DVC_SWRSR, 0);
+	rsnd_mod_write(mod, DVC_SWRSR, 1);
+}
+
 static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
 				   struct rsnd_mod *mod)
 {
@@ -160,15 +166,14 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
 
 	rsnd_mod_hw_start(dvc_mod);
 
+	rsnd_dvc_soft_reset(dvc_mod);
+
 	/*
 	 * fixme
 	 * it doesn't support CTU/MIX
 	 */
 	rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
 
-	rsnd_mod_write(dvc_mod, DVC_SWRSR, 0);
-	rsnd_mod_write(dvc_mod, DVC_SWRSR, 1);
-
 	rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
 
 	rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
-- 
1.9.1

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

* [PATCH 14/35] ASoC: rsnd: src: make sure SRC soft reset
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (12 preceding siblings ...)
  2015-07-15  7:12 ` [PATCH 13/35] ASoC: rsnd: dvc: make sure DVC soft reset Kuninori Morimoto
@ 2015-07-15  7:12 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: src: make sure SRC soft reset" to the asoc tree Mark Brown
  2015-07-15  7:12 ` [PATCH 15/35] ASoC: rsnd: enable module multi connection Kuninori Morimoto
                   ` (21 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxRSR (Software reset Register) is one
of them. These xxxRSR need be set to 1 to 0 when software reset.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_soft_reset() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/src.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 0b06ac8..74ab644 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -118,6 +118,12 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
+static void rsnd_src_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, SRC_SWRSR, 0);
+	rsnd_mod_write(mod, SRC_SWRSR, 1);
+}
+
 static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
 					 struct rsnd_mod *mod)
 {
@@ -294,10 +300,6 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
 	if (convert_rate)
 		fsrate = 0x0400000 / convert_rate * runtime->rate;
 
-	/* set/clear soft reset */
-	rsnd_mod_write(mod, SRC_SWRSR, 0);
-	rsnd_mod_write(mod, SRC_SWRSR, 1);
-
 	/* Set channel number and output bit length */
 	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
 
@@ -358,6 +360,8 @@ static int rsnd_src_init(struct rsnd_mod *mod,
 
 	rsnd_mod_hw_start(mod);
 
+	rsnd_src_soft_reset(mod);
+
 	src->err = 0;
 
 	/* reset sync convert_rate */
-- 
1.9.1

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

* [PATCH 15/35] ASoC: rsnd: enable module multi connection
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (13 preceding siblings ...)
  2015-07-15  7:12 ` [PATCH 14/35] ASoC: rsnd: src: make sure SRC soft reset Kuninori Morimoto
@ 2015-07-15  7:12 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: enable module multi connection" to the asoc tree Mark Brown
  2015-07-15  7:12 ` [PATCH 16/35] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove Kuninori Morimoto
                   ` (20 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

'8a4e379b54f8("ASoC: rsnd: remove io from rsnd_mod")' removed mod/io
relationship. rsnd_dai_connect() mod/io check is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index d44bfb7..ff4f15a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -277,16 +277,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
 	if (!mod)
 		return -EIO;
 
-	if (io->mod[mod->type]) {
-		struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-		struct device *dev = rsnd_priv_to_dev(priv);
-
-		dev_err(dev, "%s[%d] is not empty\n",
-			rsnd_mod_name(mod),
-			rsnd_mod_id(mod));
-		return -EIO;
-	}
-
 	io->mod[mod->type] = mod;
 
 	return 0;
-- 
1.9.1

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

* [PATCH 16/35] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (14 preceding siblings ...)
  2015-07-15  7:12 ` [PATCH 15/35] ASoC: rsnd: enable module multi connection Kuninori Morimoto
@ 2015-07-15  7:12 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: rename rsnd_path_parse/break() into add/remove" to the asoc tree Mark Brown
  2015-07-15  7:13 ` [PATCH 17/35] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting Kuninori Morimoto
                   ` (19 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

parse/break is a little ambiguous/confusable name for rsnd module path.
Especially for CTU/MIX support. It was renamed to add/remove

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index ff4f15a..93fed50 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -507,7 +507,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	.set_fmt	= rsnd_soc_dai_set_fmt,
 };
 
-#define rsnd_path_parse(priv, io, type)				\
+#define rsnd_path_add(priv, io, type)				\
 ({								\
 	struct rsnd_mod *mod;					\
 	int ret = 0;						\
@@ -523,7 +523,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	ret;							\
 })
 
-#define rsnd_path_break(priv, io, type)				\
+#define rsnd_path_remove(priv, io, type)			\
 {								\
 	struct rsnd_mod *mod;					\
 	int id = -1;						\
@@ -555,17 +555,17 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	 */
 
 	/* SRC */
-	ret = rsnd_path_parse(priv, io, src);
+	ret = rsnd_path_add(priv, io, src);
 	if (ret < 0)
 		return ret;
 
 	/* SSI */
-	ret = rsnd_path_parse(priv, io, ssi);
+	ret = rsnd_path_add(priv, io, ssi);
 	if (ret < 0)
 		return ret;
 
 	/* DVC */
-	ret = rsnd_path_parse(priv, io, dvc);
+	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
 		return ret;
 
@@ -1023,8 +1023,8 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
 		/*
 		 * remove SRC/DVC from DAI,
 		 */
-		rsnd_path_break(priv, io, src);
-		rsnd_path_break(priv, io, dvc);
+		rsnd_path_remove(priv, io, src);
+		rsnd_path_remove(priv, io, dvc);
 
 		/*
 		 * fallback
-- 
1.9.1

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

* [PATCH 17/35] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (15 preceding siblings ...)
  2015-07-15  7:12 ` [PATCH 16/35] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove Kuninori Morimoto
@ 2015-07-15  7:13 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting" to the asoc tree Mark Brown
  2015-07-15  7:13 ` [PATCH 18/35] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock() Kuninori Morimoto
                   ` (18 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current sound data route settings is done in dvc.c, and it doesn't care
about CTU/MIX at this poinnt, but we need to care about these.
OTOH, rsnd driver already has rsnd_path_xxx() functions for data path which
are good match for CTU/MIX/DVC path selectio.
This patch adds new rsnd_path_parse() to select sound data route which will
care about CTU/MIX/DVC path.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
 sound/soc/sh/rcar/dvc.c  | 40 +++++++++-------------------------------
 sound/soc/sh/rcar/rsnd.h |  2 ++
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 93fed50..cb82067 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -537,6 +537,28 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	}							\
 }
 
+void rsnd_path_parse(struct rsnd_priv *priv,
+		     struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
+	int src_id = rsnd_mod_id(src);
+	u32 path[] = {
+		[0] = 0x30000,
+		[1] = 0x30001,
+		[2] = 0x40000,
+		[3] = 0x10000,
+		[4] = 0x20000,
+		[5] = 0x40100
+	};
+
+	/* Gen1 is not supported */
+	if (rsnd_is_gen1(priv))
+		return;
+
+	rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
+}
+
 static int rsnd_path_init(struct rsnd_priv *priv,
 			  struct rsnd_dai *rdai,
 			  struct rsnd_dai_stream *io)
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 24d0763..9392507 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -142,48 +142,26 @@ static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
 	return 0;
 }
 
-static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
+static int rsnd_dvc_init(struct rsnd_mod *mod,
 			 struct rsnd_dai_stream *io,
 			 struct rsnd_priv *priv)
 {
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
-	struct device *dev = rsnd_priv_to_dev(priv);
-	int dvc_id = rsnd_mod_id(dvc_mod);
-	int src_id = rsnd_mod_id(src_mod);
-	u32 route[] = {
-		[0] = 0x30000,
-		[1] = 0x30001,
-		[2] = 0x40000,
-		[3] = 0x10000,
-		[4] = 0x20000,
-		[5] = 0x40100
-	};
-
-	if (src_id >= ARRAY_SIZE(route)) {
-		dev_err(dev, "DVC%d isn't connected to SRC%d\n", dvc_id, src_id);
-		return -EINVAL;
-	}
-
-	rsnd_mod_hw_start(dvc_mod);
+	rsnd_mod_hw_start(mod);
 
-	rsnd_dvc_soft_reset(dvc_mod);
+	rsnd_dvc_soft_reset(mod);
 
-	/*
-	 * fixme
-	 * it doesn't support CTU/MIX
-	 */
-	rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
+	rsnd_path_parse(priv, io);
 
-	rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
+	rsnd_mod_write(mod, DVC_DVUIR, 1);
 
-	rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
+	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
 
 	/* ch0/ch1 Volume */
-	rsnd_dvc_volume_update(io, dvc_mod);
+	rsnd_dvc_volume_update(io, mod);
 
-	rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
+	rsnd_mod_write(mod, DVC_DVUIR, 0);
 
-	rsnd_adg_set_cmd_timsel_gen2(dvc_mod, io);
+	rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
 	return 0;
 }
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c8d2029..6a87757 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -170,6 +170,8 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+void rsnd_path_parse(struct rsnd_priv *priv,
+		     struct rsnd_dai_stream *io);
 
 /*
  *	R-Car DMA
-- 
1.9.1

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

* [PATCH 18/35] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (16 preceding siblings ...)
  2015-07-15  7:13 ` [PATCH 17/35] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting Kuninori Morimoto
@ 2015-07-15  7:13 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()" to the asoc tree Mark Brown
  2015-07-15  7:13 ` [PATCH 19/35] ASoC: rsnd: add rsnd_src_initialize_lock/unlock() Kuninori Morimoto
                   ` (17 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxIR (Initialization Register) is one
of them. These xxxIR need be set to 1 during initialization.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_dvc_initialize_lock/unlock() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dvc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 9392507..343d446 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -70,6 +70,13 @@ static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
 	rsnd_mod_write(mod, DVC_SWRSR, 1);
 }
 
+#define rsnd_dvc_initialize_lock(mod)	__rsnd_dvc_initialize_lock(mod, 1)
+#define rsnd_dvc_initialize_unlock(mod)	__rsnd_dvc_initialize_lock(mod, 0)
+static void __rsnd_dvc_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, DVC_DVUIR, enable);
+}
+
 static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
 				   struct rsnd_mod *mod)
 {
@@ -150,17 +157,15 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
 
 	rsnd_dvc_soft_reset(mod);
 
-	rsnd_path_parse(priv, io);
+	rsnd_dvc_initialize_lock(mod);
 
-	rsnd_mod_write(mod, DVC_DVUIR, 1);
+	rsnd_path_parse(priv, io);
 
 	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
 
 	/* ch0/ch1 Volume */
 	rsnd_dvc_volume_update(io, mod);
 
-	rsnd_mod_write(mod, DVC_DVUIR, 0);
-
 	rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
 	return 0;
@@ -179,6 +184,8 @@ static int rsnd_dvc_start(struct rsnd_mod *mod,
 			  struct rsnd_dai_stream *io,
 			  struct rsnd_priv *priv)
 {
+	rsnd_dvc_initialize_unlock(mod);
+
 	rsnd_mod_write(mod, CMD_CTRL, 0x10);
 
 	return 0;
-- 
1.9.1

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

* [PATCH 19/35] ASoC: rsnd: add rsnd_src_initialize_lock/unlock()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (17 preceding siblings ...)
  2015-07-15  7:13 ` [PATCH 18/35] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock() Kuninori Morimoto
@ 2015-07-15  7:13 ` Kuninori Morimoto
  2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_src_initialize_lock/unlock()" to the asoc tree Mark Brown
  2015-07-15  7:14 ` [PATCH 20/35] ASoC: rsnd: tidyup ADINR function name Kuninori Morimoto
                   ` (16 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:13 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxIR (Initialization Register) is one
of them. These xxxIR need be set to 1 during initialization.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_initialize_lock/unlock() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/src.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 74ab644..b3d965e 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -124,6 +124,14 @@ static void rsnd_src_soft_reset(struct rsnd_mod *mod)
 	rsnd_mod_write(mod, SRC_SWRSR, 1);
 }
 
+
+#define rsnd_src_initialize_lock(mod)	__rsnd_src_initialize_lock(mod, 1)
+#define rsnd_src_initialize_unlock(mod)	__rsnd_src_initialize_lock(mod, 0)
+static void __rsnd_src_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, SRC_SRCIR, enable);
+}
+
 static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
 					 struct rsnd_mod *mod)
 {
@@ -362,17 +370,13 @@ static int rsnd_src_init(struct rsnd_mod *mod,
 
 	rsnd_src_soft_reset(mod);
 
+	rsnd_src_initialize_lock(mod);
+
 	src->err = 0;
 
 	/* reset sync convert_rate */
 	src->sync.val = 0;
 
-	/*
-	 * Initialize the operation of the SRC internal circuits
-	 * see rsnd_src_start()
-	 */
-	rsnd_mod_write(mod, SRC_SRCIR, 1);
-
 	return 0;
 }
 
@@ -399,11 +403,7 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
 
 static int rsnd_src_start(struct rsnd_mod *mod)
 {
-	/*
-	 * Cancel the initialization and operate the SRC function
-	 * see rsnd_src_init()
-	 */
-	rsnd_mod_write(mod, SRC_SRCIR, 0);
+	rsnd_src_initialize_unlock(mod);
 
 	return 0;
 }
-- 
1.9.1

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

* [PATCH 20/35] ASoC: rsnd: tidyup ADINR function name
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (18 preceding siblings ...)
  2015-07-15  7:13 ` [PATCH 19/35] ASoC: rsnd: add rsnd_src_initialize_lock/unlock() Kuninori Morimoto
@ 2015-07-15  7:14 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup ADINR function name" to the asoc tree Mark Brown
  2015-07-15  7:14 ` [PATCH 21/35] ASoC: rsnd: add rsnd_get_adinr_chan() Kuninori Morimoto
                   ` (15 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Renesas sound IP (= SSIU/SRC/CTU/MIX/DVC) have ADINR
(= Audio Information Register), but some of them (= SSIU/SRC/DVC)
are for audio data bits, some of them (= CTU/MIX) are for audio data
channels.
Current rsnd driver is supporting SSIU/SRC/DVC, and these ADINR were
for bits. This patch rename rsnd_get_adinr() to rsnd_get_adinr_bit(),
and we will have rsnd_get_adinr_chan() for CTU/MIX.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 4 ++--
 sound/soc/sh/rcar/dvc.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index cb82067..0ca6d02 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -203,9 +203,9 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 }
 
 /*
- *	settting function
+ *	ADINR function
  */
-u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 {
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 343d446..d06e4ee 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -161,7 +161,7 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
 
 	rsnd_path_parse(priv, io);
 
-	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
+	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr_bit(mod, io));
 
 	/* ch0/ch1 Volume */
 	rsnd_dvc_volume_update(io, mod);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 6a87757..224a4a9 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -169,7 +169,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 		enum rsnd_reg reg, u32 data);
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
-u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index b3d965e..c45da61 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 		u32 mask = ~0;
 
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
-			       rsnd_get_adinr(ssi_mod, io));
+			       rsnd_get_adinr_bit(ssi_mod, io));
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
 		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
 
@@ -309,7 +309,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
 		fsrate = 0x0400000 / convert_rate * runtime->rate;
 
 	/* Set channel number and output bit length */
-	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
+	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr_bit(mod, io));
 
 	/* Enable the initial value of IFS */
 	if (fsrate) {
-- 
1.9.1

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

* [PATCH 21/35] ASoC: rsnd: add rsnd_get_adinr_chan()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (19 preceding siblings ...)
  2015-07-15  7:14 ` [PATCH 20/35] ASoC: rsnd: tidyup ADINR function name Kuninori Morimoto
@ 2015-07-15  7:14 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: add rsnd_get_adinr_chan()" to the asoc tree Mark Brown
  2015-07-15  7:14 ` [PATCH 22/35] ASoC: rsnd: tidyup data align position Kuninori Morimoto
                   ` (14 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current rsnd driver has rsnd_get_adinr_bit() to get bit settings for
ADINR (= Audio Information Register) of SSIU/SRC/DVC.
This patch adds rsnd_get_adinr_chan() to get channel settings for
ADINR (= Audio Information Register) of CTU/MIX.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0ca6d02..a3637b9 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -227,6 +227,28 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	return adinr;
 }
 
+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+{
+	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	u32 chan = runtime->channels;
+
+	switch (chan) {
+	case 1:
+	case 2:
+	case 4:
+	case 6:
+	case 8:
+		break;
+	default:
+		dev_warn(dev, "not supported channel\n");
+		chan = 0;
+		break;
+	}
+
+	return chan;
+}
 /*
  *	rsnd_dai functions
  */
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 224a4a9..1296b35 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -170,6 +170,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
-- 
1.9.1

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

* [PATCH 22/35] ASoC: rsnd: tidyup data align position
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (20 preceding siblings ...)
  2015-07-15  7:14 ` [PATCH 21/35] ASoC: rsnd: add rsnd_get_adinr_chan() Kuninori Morimoto
@ 2015-07-15  7:14 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup data align position" to the asoc tree Mark Brown
  2015-07-15  7:15 ` [PATCH 23/35] ASoC: rsnd: show debug message for SSI/SRC/DVC connection Kuninori Morimoto
                   ` (13 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:14 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Sound L/R order of SSI is different from Linux sound data order.
So current rsnd driver is using DALIGN (= data align) to exchange data
align on SSIU. OTOH, CMD/SRC/SSIU have DALIGN register. Now inverted
sound volume will be exchanged if user used volume control on DVC.
Because SSIU which exchanges data align is located after DVC.

	MEM -> SRC -> DVC -> SSI

This patch exchanges data align SRC if possible

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 36 ++++++++++++++++++++++++++++++++++++
 sound/soc/sh/rcar/gen.c  |  1 +
 sound/soc/sh/rcar/rsnd.h |  3 +++
 sound/soc/sh/rcar/src.c  | 20 +++++---------------
 4 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index a3637b9..0f9323f 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -249,6 +249,42 @@ u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 
 	return chan;
 }
+
+/*
+ *	DALIGN function
+ */
+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
+	struct rsnd_mod *target = src ? src : ssi;
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	u32 val = 0x76543210;
+	u32 mask = ~0;
+
+	mask <<= runtime->channels * 4;
+	val = val & mask;
+
+	switch (runtime->sample_bits) {
+	case 16:
+		val |= 0x67452301 & ~mask;
+		break;
+	case 32:
+		val |= 0x76543210 & ~mask;
+		break;
+	}
+
+	/*
+	 * exchange channeles on SRC if possible,
+	 * otherwise, R/L volume settings on DVC
+	 * changes inverted channels
+	 */
+	if (mod == target)
+		return val;
+	else
+		return 0x76543210;
+}
+
 /*
  *	rsnd_dai functions
  */
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 5d3592df..a2d5df4 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -222,6 +222,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 	};
 	struct rsnd_regmap_field_conf conf_scu[] = {
 		RSND_GEN_M_REG(SRC_BUSIF_MODE,	0x0,	0x20),
+		RSND_GEN_M_REG(SRC_BUSIF_DALIGN,0x8,	0x20),
 		RSND_GEN_M_REG(SRC_ROUTE_MODE0,	0xc,	0x20),
 		RSND_GEN_M_REG(SRC_CTRL,	0x10,	0x20),
 		RSND_GEN_M_REG(SRC_INT_ENABLE0,	0x18,	0x20),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 1296b35..6c10a8b 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -99,6 +99,7 @@ enum rsnd_reg {
 	RSND_REG_SHARE26,
 	RSND_REG_SHARE27,
 	RSND_REG_SHARE28,
+	RSND_REG_SHARE29,
 
 	RSND_REG_MAX,
 };
@@ -143,6 +144,7 @@ enum rsnd_reg {
 #define RSND_REG_SCU_SYS_STATUS1	RSND_REG_SHARE26
 #define RSND_REG_SCU_SYS_INT_EN1	RSND_REG_SHARE27
 #define RSND_REG_SRC_INT_ENABLE0	RSND_REG_SHARE28
+#define RSND_REG_SRC_BUSIF_DALIGN	RSND_REG_SHARE29
 
 struct rsnd_of_data;
 struct rsnd_priv;
@@ -171,6 +173,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index c45da61..89a18e1 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -148,7 +148,6 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 			int use_busif)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
@@ -185,27 +184,14 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 	 * DMA settings for SSIU
 	 */
 	if (use_busif) {
-		u32 val = 0x76543210;
-		u32 mask = ~0;
+		u32 val = rsnd_get_dalign(ssi_mod, io);
 
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
 			       rsnd_get_adinr_bit(ssi_mod, io));
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
 		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
 
-		mask <<= runtime->channels * 4;
-		val = val & mask;
-
-		switch (runtime->sample_bits) {
-		case 16:
-			val |= 0x67452301 & ~mask;
-			break;
-		case 32:
-			val |= 0x76543210 & ~mask;
-			break;
-		}
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_DALIGN, val);
-
 	}
 
 	return 0;
@@ -678,6 +664,10 @@ static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 	u32 val;
 
+	val = rsnd_get_dalign(mod, io);
+
+	rsnd_mod_write(mod, SRC_BUSIF_DALIGN, val);
+
 	/*
 	 * WORKAROUND
 	 *
-- 
1.9.1

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

* [PATCH 23/35] ASoC: rsnd: show debug message for SSI/SRC/DVC connection
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (21 preceding siblings ...)
  2015-07-15  7:14 ` [PATCH 22/35] ASoC: rsnd: tidyup data align position Kuninori Morimoto
@ 2015-07-15  7:15 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: show debug message for SSI/SRC/DVC connection" to the asoc tree Mark Brown
  2015-07-15  7:15 ` [PATCH 24/35] ASoC: rsnd: tidyup rsnd_dma_ops definition place Kuninori Morimoto
                   ` (12 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

It can help for connection debug

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0f9323f..8919afa 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -332,11 +332,18 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 static int rsnd_dai_connect(struct rsnd_mod *mod,
 			    struct rsnd_dai_stream *io)
 {
+	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct device *dev = rsnd_priv_to_dev(priv);
+
 	if (!mod)
 		return -EIO;
 
 	io->mod[mod->type] = mod;
 
+	dev_dbg(dev, "%s[%d] is connected to io (%s)\n",
+		rsnd_mod_name(mod), rsnd_mod_id(mod),
+		rsnd_io_is_play(io) ? "Playback" : "Capture");
+
 	return 0;
 }
 
-- 
1.9.1

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

* [PATCH 24/35] ASoC: rsnd: tidyup rsnd_dma_ops definition place
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (22 preceding siblings ...)
  2015-07-15  7:15 ` [PATCH 23/35] ASoC: rsnd: show debug message for SSI/SRC/DVC connection Kuninori Morimoto
@ 2015-07-15  7:15 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup rsnd_dma_ops definition place" to the asoc tree Mark Brown
  2015-07-15  7:15 ` [PATCH 25/35] ASoC: rsnd: check the Gen1 at the beginning of DVC probe Kuninori Morimoto
                   ` (11 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

rsnd_dma_ops is used only from dma.c, rsnd.h doesn't need it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dma.c  | 8 ++++++++
 sound/soc/sh/rcar/rsnd.h | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index d306e29..9431061 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -27,6 +27,14 @@ struct rsnd_dma_ctrl {
 	int dmapp_num;
 };
 
+struct rsnd_dma_ops {
+	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
+		    struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
+	void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+};
+
 #define rsnd_priv_to_dmac(p)	((struct rsnd_dma_ctrl *)(p)->dma)
 
 /*
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 6c10a8b..705e66f 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -181,13 +181,6 @@ void rsnd_path_parse(struct rsnd_priv *priv,
  *	R-Car DMA
  */
 struct rsnd_dma;
-struct rsnd_dma_ops {
-	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
-		    struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
-	void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-};
 
 struct rsnd_dmaen {
 	struct dma_chan		*chan;
-- 
1.9.1

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

* [PATCH 25/35] ASoC: rsnd: check the Gen1 at the beginning of DVC probe
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (23 preceding siblings ...)
  2015-07-15  7:15 ` [PATCH 24/35] ASoC: rsnd: tidyup rsnd_dma_ops definition place Kuninori Morimoto
@ 2015-07-15  7:15 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: check the Gen1 at the beginning of DVC probe" to the asoc tree Mark Brown
  2015-07-15  7:16 ` [PATCH 26/35] ASoC: rsnd: dma: add DMA name on .ops Kuninori Morimoto
                   ` (10 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

DVC doesn't support Gen1, check it beginning of probe

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dvc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index d06e4ee..5779638 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -332,18 +332,18 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr, ret;
 
-	rsnd_of_parse_dvc(pdev, of_data, priv);
-
-	nr = info->dvc_info_nr;
-	if (!nr)
-		return 0;
-
 	/* This driver doesn't support Gen1 at this point */
 	if (rsnd_is_gen1(priv)) {
 		dev_warn(dev, "CMD is not supported on Gen1\n");
 		return -EINVAL;
 	}
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
+	nr = info->dvc_info_nr;
+	if (!nr)
+		return 0;
+
 	dvc	= devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
 	if (!dvc)
 		return -ENOMEM;
-- 
1.9.1

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

* [PATCH 26/35] ASoC: rsnd: dma: add DMA name on .ops
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (24 preceding siblings ...)
  2015-07-15  7:15 ` [PATCH 25/35] ASoC: rsnd: check the Gen1 at the beginning of DVC probe Kuninori Morimoto
@ 2015-07-15  7:16 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: dma: add DMA name on .ops" to the asoc tree Mark Brown
  2015-07-15  7:16 ` [PATCH 27/35] ASoC: rsnd: add rsnd_io_to_mod() Kuninori Morimoto
                   ` (9 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current rsnd driver is using Audio DMAC (via DMAEngine) and
Audio DMAC peri peri (via original method), and usage of these DMAC
are different. Indicates its naming is useful for debugging.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dma.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 9431061..a175863 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -28,6 +28,7 @@ struct rsnd_dma_ctrl {
 };
 
 struct rsnd_dma_ops {
+	char *name;
 	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
 	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
 	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
@@ -190,7 +191,8 @@ static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
 	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
-	dev_dbg(dev, "dma : %pad -> %pad\n",
+	dev_dbg(dev, "%s %pad -> %pad\n",
+		dma->ops->name,
 		&cfg.src_addr, &cfg.dst_addr);
 
 	ret = dmaengine_slave_config(dmaen->chan, &cfg);
@@ -223,6 +225,7 @@ static void rsnd_dmaen_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
 }
 
 static struct rsnd_dma_ops rsnd_dmaen_ops = {
+	.name	= "audmac",
 	.start	= rsnd_dmaen_start,
 	.stop	= rsnd_dmaen_stop,
 	.init	= rsnd_dmaen_init,
@@ -368,6 +371,7 @@ static int rsnd_dmapp_init(struct rsnd_dai_stream *io,
 }
 
 static struct rsnd_dma_ops rsnd_dmapp_ops = {
+	.name	= "audmac-pp",
 	.start	= rsnd_dmapp_start,
 	.stop	= rsnd_dmapp_stop,
 	.init	= rsnd_dmapp_init,
@@ -580,6 +584,7 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 	struct rsnd_mod *mod_to;
 	struct rsnd_priv *priv = rsnd_io_to_priv(io);
 	struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
 	int is_play = rsnd_io_is_play(io);
 
 	/*
@@ -606,6 +611,11 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 	if (rsnd_is_gen1(priv))
 		dma->ops = &rsnd_dmaen_ops;
 
+	dev_dbg(dev, "%s %s[%d] -> %s[%d]\n",
+		dma->ops->name,
+		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
+		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
+
 	return dma->ops->init(io, dma, id, mod_from, mod_to);
 }
 
-- 
1.9.1

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

* [PATCH 27/35] ASoC: rsnd: add rsnd_io_to_mod()
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (25 preceding siblings ...)
  2015-07-15  7:16 ` [PATCH 26/35] ASoC: rsnd: dma: add DMA name on .ops Kuninori Morimoto
@ 2015-07-15  7:16 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: add rsnd_io_to_mod()" to the asoc tree Mark Brown
  2015-07-15  7:16 ` [PATCH 28/35] ASoC: rsnd: tidyup SRC position on each code Kuninori Morimoto
                   ` (8 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Sometimes we would like to get each module directly, especially data path
searching. this patch adds rsnd_io_to_mod() macro, and existing
rsnd_io_to_mod_xxx() use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/rsnd.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 705e66f..5f5b8b1 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -348,9 +348,10 @@ struct rsnd_dai_stream {
 	int byte_per_period;
 	int next_period_byte;
 };
-#define rsnd_io_to_mod_ssi(io)	((io)->mod[RSND_MOD_SSI])
-#define rsnd_io_to_mod_src(io)	((io)->mod[RSND_MOD_SRC])
-#define rsnd_io_to_mod_dvc(io)	((io)->mod[RSND_MOD_DVC])
+#define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
+#define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
+#define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
+#define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
 #define rsnd_io_is_play(io)	(&rsnd_io_to_rdai(io)->playback == io)
-- 
1.9.1

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

* [PATCH 28/35] ASoC: rsnd: tidyup SRC position on each code
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (26 preceding siblings ...)
  2015-07-15  7:16 ` [PATCH 27/35] ASoC: rsnd: add rsnd_io_to_mod() Kuninori Morimoto
@ 2015-07-15  7:16 ` Kuninori Morimoto
  2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup SRC position on each code" to the asoc tree Mark Brown
  2015-07-15  7:16 ` [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method Kuninori Morimoto
                   ` (7 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

This is cleanup for CTU/MIX support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/Makefile |  2 +-
 sound/soc/sh/rcar/core.c   |  8 ++++----
 sound/soc/sh/rcar/rsnd.h   | 38 +++++++++++++++++++-------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index f1b4451..3a274fd 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o src.o adg.o ssi.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 8919afa..e20d8ea 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -641,13 +641,13 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	 * using fixed path.
 	 */
 
-	/* SRC */
-	ret = rsnd_path_add(priv, io, src);
+	/* SSI */
+	ret = rsnd_path_add(priv, io, ssi);
 	if (ret < 0)
 		return ret;
 
-	/* SSI */
-	ret = rsnd_path_add(priv, io, ssi);
+	/* SRC */
+	ret = rsnd_path_add(priv, io, src);
 	if (ret < 0)
 		return ret;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 5f5b8b1..7fee207 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -441,12 +441,6 @@ struct rsnd_priv {
 	void *gen;
 
 	/*
-	 * below value will be filled on rsnd_src_probe()
-	 */
-	void *src;
-	int src_nr;
-
-	/*
 	 * below value will be filled on rsnd_adg_probe()
 	 */
 	void *adg;
@@ -463,6 +457,12 @@ struct rsnd_priv {
 	int ssi_nr;
 
 	/*
+	 * below value will be filled on rsnd_src_probe()
+	 */
+	void *src;
+	int src_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -535,6 +535,19 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
 		     u32 max);
 
 /*
+ *	R-Car SSI
+ */
+int rsnd_ssi_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+void rsnd_ssi_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
+int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
+int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
+int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
+
+/*
  *	R-Car SRC
  */
 int rsnd_src_probe(struct platform_device *pdev,
@@ -555,19 +568,6 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
 /*
- *	R-Car SSI
- */
-int rsnd_ssi_probe(struct platform_device *pdev,
-		   const struct rsnd_of_data *of_data,
-		   struct rsnd_priv *priv);
-void rsnd_ssi_remove(struct platform_device *pdev,
-		     struct rsnd_priv *priv);
-struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
-int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
-int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
-int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
-
-/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
1.9.1

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

* [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (27 preceding siblings ...)
  2015-07-15  7:16 ` [PATCH 28/35] ASoC: rsnd: tidyup SRC position on each code Kuninori Morimoto
@ 2015-07-15  7:16 ` Kuninori Morimoto
  2015-07-17 18:26   ` Applied "ASoC: rsnd: update Audio DMA path search method" to the asoc tree Mark Brown
  2015-07-15  7:17 ` [PATCH 30/35] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support Kuninori Morimoto
                   ` (6 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:16 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Current rsnd driver is assuming Audio DMAC / Audio DMAC peri peri
are used from SSI/SSIU/SRC/DVC. But we will add CTU/MIX to this driver.
Then, current DMA path searching method is not understandable, and good
enough for this purpose. This patch update DMA path search method, more
simply.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 sound/soc/sh/rcar/dma.c | 88 +++++++++++++++++++++++++++++--------------------
 1 file changed, 53 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index a175863..23282f4 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -494,7 +494,7 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
 	return rsnd_gen2_dma_addr(io, mod, is_play, is_from);
 }
 
-#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
+#define MOD_MAX (RSND_MOD_MAX + 1) /* +Memory */
 static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			     struct rsnd_dai_stream *io,
 			     int is_play,
@@ -506,53 +506,71 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
-	int i, index;
+	struct rsnd_mod *mod_start, *mod_end;
+	struct rsnd_priv *priv = rsnd_mod_to_priv(this);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	int nr, i;
 
+	if (!ssi)
+		return;
 
-	for (i = 0; i < MOD_MAX; i++)
+	nr = 0;
+	for (i = 0; i < MOD_MAX; i++) {
 		mod[i] = NULL;
+		nr += !!rsnd_io_to_mod(io, i);
+	}
 
 	/*
-	 * in play case...
+	 * [S] -*-> [E]
+	 * [S] -*-> SRC -o-> [E]
+	 * [S] -*-> SRC -> DVC -o-> [E]
+	 * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E]
+	 *
+	 * playback	[S] = mem
+	 *		[E] = SSI
 	 *
-	 * src -> dst
+	 * capture	[S] = SSI
+	 *		[E] = mem
 	 *
-	 * mem -> SSI
-	 * mem -> SRC -> SSI
-	 * mem -> SRC -> DVC -> SSI
+	 * -*->		Audio DMAC
+	 * -o->		Audio DMAC peri peri
 	 */
-	mod[0] = NULL; /* for "mem" */
-	index = 1;
-	for (i = 1; i < MOD_MAX; i++) {
-		if (!src) {
-			mod[i] = ssi;
-		} else if (!dvc) {
-			mod[i] = src;
-			src = NULL;
-		} else {
-			if ((!is_play) && (this == src))
-				this = dvc;
+	mod_start	= (is_play) ? NULL : ssi;
+	mod_end		= (is_play) ? ssi  : NULL;
 
-			mod[i] = (is_play) ? src : dvc;
-			i++;
-			mod[i] = (is_play) ? dvc : src;
+	mod[0] = mod_start;
+	for (i = 1; i < nr; i++) {
+		if (src) {
+			mod[i] = src;
 			src = NULL;
+		} else if (dvc) {
+			mod[i] = dvc;
 			dvc = NULL;
 		}
-
-		if (mod[i] == this)
-			index = i;
-
-		if (mod[i] == ssi)
-			break;
 	}
+	mod[i] = mod_end;
 
-	if (is_play) {
-		*mod_from = mod[index - 1];
-		*mod_to   = mod[index];
+	/*
+	 *		| SSI | SRC |
+	 * -------------+-----+-----+
+	 *  is_play	|  o  |  *  |
+	 * !is_play	|  *  |  o  |
+	 */
+	if ((this == ssi) == (is_play)) {
+		*mod_from	= mod[nr - 1];
+		*mod_to		= mod[nr];
 	} else {
-		*mod_from = mod[index];
-		*mod_to   = mod[index - 1];
+		*mod_from	= mod[0];
+		*mod_to		= mod[1];
+	}
+
+	dev_dbg(dev, "module connection (this is %s[%d])\n",
+		rsnd_mod_name(this), rsnd_mod_id(this));
+	for (i = 0; i <= nr; i++) {
+		dev_dbg(dev, "  %s[%d]%s\n",
+		       rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]),
+		       (mod[i] == *mod_from) ? " from" :
+		       (mod[i] == *mod_to)   ? " to" : "");
 	}
 }
 
@@ -580,8 +598,8 @@ void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
 
 int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 {
-	struct rsnd_mod *mod_from;
-	struct rsnd_mod *mod_to;
+	struct rsnd_mod *mod_from = NULL;
+	struct rsnd_mod *mod_to = NULL;
 	struct rsnd_priv *priv = rsnd_io_to_priv(io);
 	struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-- 
1.9.1

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

* [PATCH 30/35] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (28 preceding siblings ...)
  2015-07-15  7:16 ` [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method Kuninori Morimoto
@ 2015-07-15  7:17 ` Kuninori Morimoto
  2015-07-17 18:26   ` Applied "ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support" to the asoc tree Mark Brown
  2015-07-15  7:17 ` [PATCH 31/35] ASoC: rsnd: add MIX (Mixer) support Kuninori Morimoto
                   ` (5 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

This patch adds CTU (Channel Transfer Unit) support for rsnd driver.
But, it does nothing to data at this point, but is required for MIX
support.

CTU design is a little different from other IPs (CTU0 is including
CTU00 - CTU03, and CTU1 is including CTU10 - CTU13, these have different
register mapping) We need to care about it on this driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |  14 ++
 include/sound/rcar_snd.h                           |   7 +
 sound/soc/sh/rcar/Makefile                         |   2 +-
 sound/soc/sh/rcar/core.c                           |  12 +-
 sound/soc/sh/rcar/ctu.c                            | 171 +++++++++++++++++++++
 sound/soc/sh/rcar/dma.c                            |  13 +-
 sound/soc/sh/rcar/gen.c                            |   2 +
 sound/soc/sh/rcar/rsnd.h                           |  21 +++
 8 files changed, 236 insertions(+), 6 deletions(-)
 create mode 100644 sound/soc/sh/rcar/ctu.c

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index b6b3a78..278607d 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -18,6 +18,9 @@ Required properties:
 - rcar_sound,src		: Should contain SRC feature.
 				  The number of SRC subnode should be same as HW.
 				  see below for detail.
+- rcar_sound,ctu		: Should contain CTU feature.
+				  The number of CTU subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dvc		: Should contain DVC feature.
 				  The number of DVC subnode should be same as HW.
 				  see below for detail.
@@ -90,6 +93,17 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 
+	rcar_sound,ctu {
+		ctu00: ctu@0 { };
+		ctu01: ctu@1 { };
+		ctu02: ctu@2 { };
+		ctu03: ctu@3 { };
+		ctu10: ctu@4 { };
+		ctu11: ctu@5 { };
+		ctu12: ctu@6 { };
+		ctu13: ctu@7 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 {
 			interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 4cecd0c..8f93030 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -61,6 +61,10 @@ struct rsnd_src_platform_info {
 /*
  * flags
  */
+struct rsnd_ctu_platform_info {
+	u32 flags;
+};
+
 struct rsnd_dvc_platform_info {
 	u32 flags;
 };
@@ -68,6 +72,7 @@ struct rsnd_dvc_platform_info {
 struct rsnd_dai_path_info {
 	struct rsnd_ssi_platform_info *ssi;
 	struct rsnd_src_platform_info *src;
+	struct rsnd_ctu_platform_info *ctu;
 	struct rsnd_dvc_platform_info *dvc;
 };
 
@@ -93,6 +98,8 @@ struct rcar_snd_info {
 	int ssi_info_nr;
 	struct rsnd_src_platform_info *src_info;
 	int src_info_nr;
+	struct rsnd_ctu_platform_info *ctu_info;
+	int ctu_info_nr;
 	struct rsnd_dvc_platform_info *dvc_info;
 	int dvc_info_nr;
 	struct rsnd_dai_platform_info *dai_info;
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index 3a274fd..7c4730a 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index e20d8ea..63ae7bb 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -651,6 +651,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	if (ret < 0)
 		return ret;
 
+	/* CTU */
+	ret = rsnd_path_add(priv, io, ctu);
+	if (ret < 0)
+		return ret;
+
 	/* DVC */
 	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
@@ -666,13 +671,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	struct device_node *dai_node,	*dai_np;
 	struct device_node *ssi_node,	*ssi_np;
 	struct device_node *src_node,	*src_np;
+	struct device_node *ctu_node,	*ctu_np;
 	struct device_node *dvc_node,	*dvc_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_platform_info *dai_info;
 	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
 	struct device *dev = &pdev->dev;
 	int nr, i;
-	int dai_i, ssi_i, src_i, dvc_i;
+	int dai_i, ssi_i, src_i, ctu_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -698,6 +704,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 
 	ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
 	src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
+	ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
 	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
@@ -734,6 +741,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(ctu);
 			mod_parse(dvc);
 
 			of_node_put(playback);
@@ -1146,6 +1154,7 @@ static int rsnd_probe(struct platform_device *pdev)
 		rsnd_dma_probe,
 		rsnd_ssi_probe,
 		rsnd_src_probe,
+		rsnd_ctu_probe,
 		rsnd_dvc_probe,
 		rsnd_adg_probe,
 		rsnd_dai_probe,
@@ -1241,6 +1250,7 @@ static int rsnd_remove(struct platform_device *pdev)
 			      struct rsnd_priv *priv) = {
 		rsnd_ssi_remove,
 		rsnd_src_remove,
+		rsnd_ctu_remove,
 		rsnd_dvc_remove,
 	};
 	int ret = 0, i;
diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
new file mode 100644
index 0000000..05edd20
--- /dev/null
+++ b/sound/soc/sh/rcar/ctu.c
@@ -0,0 +1,171 @@
+/*
+ * ctu.c
+ *
+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include "rsnd.h"
+
+#define CTU_NAME_SIZE	16
+#define CTU_NAME "ctu"
+
+struct rsnd_ctu {
+	struct rsnd_ctu_platform_info *info; /* rcar_snd.h */
+	struct rsnd_mod mod;
+};
+
+#define rsnd_ctu_nr(priv) ((priv)->ctu_nr)
+#define for_each_rsnd_ctu(pos, priv, i)					\
+	for ((i) = 0;							\
+	     ((i) < rsnd_ctu_nr(priv)) &&				\
+		     ((pos) = (struct rsnd_ctu *)(priv)->ctu + i);	\
+	     i++)
+
+#define rsnd_ctu_initialize_lock(mod)	__rsnd_ctu_initialize_lock(mod, 1)
+#define rsnd_ctu_initialize_unlock(mod)	__rsnd_ctu_initialize_lock(mod, 0)
+static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, CTU_CTUIR, enable);
+}
+
+static int rsnd_ctu_init(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_start(mod);
+
+	rsnd_ctu_initialize_lock(mod);
+
+	rsnd_mod_write(mod, CTU_ADINR, rsnd_get_adinr_chan(mod, io));
+
+	rsnd_ctu_initialize_unlock(mod);
+
+	return 0;
+}
+
+static int rsnd_ctu_quit(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_stop(mod);
+
+	return 0;
+}
+
+static struct rsnd_mod_ops rsnd_ctu_ops = {
+	.name		= CTU_NAME,
+	.init		= rsnd_ctu_init,
+	.quit		= rsnd_ctu_quit,
+};
+
+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
+{
+	if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv)))
+		id = 0;
+
+	return &((struct rsnd_ctu *)(priv->ctu) + id)->mod;
+}
+
+void rsnd_of_parse_ctu(struct platform_device *pdev,
+		       const struct rsnd_of_data *of_data,
+		       struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_ctu_platform_info *ctu_info;
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = &pdev->dev;
+	int nr;
+
+	if (!of_data)
+		return;
+
+	node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_ctu_end;
+
+	ctu_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_ctu_platform_info) * nr,
+				GFP_KERNEL);
+	if (!ctu_info) {
+		dev_err(dev, "ctu info allocation error\n");
+		goto rsnd_of_parse_ctu_end;
+	}
+
+	info->ctu_info		= ctu_info;
+	info->ctu_info_nr	= nr;
+
+rsnd_of_parse_ctu_end:
+	of_node_put(node);
+
+}
+
+int rsnd_ctu_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv)
+{
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	struct rsnd_ctu *ctu;
+	struct clk *clk;
+	char name[CTU_NAME_SIZE];
+	int i, nr, ret;
+
+	/* This driver doesn't support Gen1 at this point */
+	if (rsnd_is_gen1(priv)) {
+		dev_warn(dev, "CTU is not supported on Gen1\n");
+		return -EINVAL;
+	}
+
+	rsnd_of_parse_ctu(pdev, of_data, priv);
+
+	nr = info->ctu_info_nr;
+	if (!nr)
+		return 0;
+
+	ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
+	if (!ctu)
+		return -ENOMEM;
+
+	priv->ctu_nr	= nr;
+	priv->ctu	= ctu;
+
+	for_each_rsnd_ctu(ctu, priv, i) {
+		/*
+		 * CTU00, CTU01, CTU02, CTU03 => CTU0
+		 * CTU10, CTU11, CTU12, CTU13 => CTU1
+		 */
+		snprintf(name, CTU_NAME_SIZE, "%s.%d",
+			 CTU_NAME, i / 4);
+
+		clk = devm_clk_get(dev, name);
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+
+		ctu->info = &info->ctu_info[i];
+
+		ret = rsnd_mod_init(priv, &ctu->mod, &rsnd_ctu_ops,
+				    clk, RSND_MOD_CTU, i);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+void rsnd_ctu_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv)
+{
+	struct rsnd_ctu *ctu;
+	int i;
+
+	for_each_rsnd_ctu(ctu, priv, i) {
+		rsnd_mod_quit(&ctu->mod);
+	}
+}
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 23282f4..229b68d 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -426,7 +426,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU);
 	int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
 	int use_src = !!rsnd_io_to_mod_src(io);
-	int use_dvc = !!rsnd_io_to_mod_dvc(io);
+	int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
+		      !!rsnd_io_to_mod_ctu(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
 		dma_addr_t out_addr;
@@ -464,7 +465,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc && !use_src)
+	if (use_cmd && !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
 
 	/* use SSIU or SSI ? */
@@ -472,8 +473,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 		is_ssi++;
 
 	return (is_from) ?
-		dma_addrs[is_ssi][is_play][use_src + use_dvc].out_addr :
-		dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
+		dma_addrs[is_ssi][is_play][use_src + use_cmd].out_addr :
+		dma_addrs[is_ssi][is_play][use_src + use_cmd].in_addr;
 }
 
 static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
@@ -504,6 +505,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
 	struct rsnd_mod *mod_start, *mod_end;
@@ -543,6 +545,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 		if (src) {
 			mod[i] = src;
 			src = NULL;
+		} else if (ctu) {
+			mod[i] = ctu;
+			ctu = NULL;
 		} else if (dvc) {
 			mod[i] = dvc;
 			dvc = NULL;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index a2d5df4..41b75cd 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -240,6 +240,8 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SRC_SRCCR,	0x224,	0x40),
 		RSND_GEN_M_REG(SRC_BSDSR,	0x22c,	0x40),
 		RSND_GEN_M_REG(SRC_BSISR,	0x238,	0x40),
+		RSND_GEN_M_REG(CTU_CTUIR,	0x504,	0x100),
+		RSND_GEN_M_REG(CTU_ADINR,	0x508,	0x100),
 		RSND_GEN_M_REG(DVC_SWRSR,	0xe00,	0x100),
 		RSND_GEN_M_REG(DVC_DVUIR,	0xe04,	0x100),
 		RSND_GEN_M_REG(DVC_ADINR,	0xe08,	0x100),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 7fee207..f2128a7 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -47,6 +47,8 @@ enum rsnd_reg {
 	RSND_REG_SCU_SYS_STATUS0,
 	RSND_REG_SCU_SYS_INT_EN0,
 	RSND_REG_CMD_ROUTE_SLCT,
+	RSND_REG_CTU_CTUIR,
+	RSND_REG_CTU_ADINR,
 	RSND_REG_DVC_SWRSR,
 	RSND_REG_DVC_DVUIR,
 	RSND_REG_DVC_ADINR,
@@ -220,6 +222,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
  */
 enum rsnd_mod_type {
 	RSND_MOD_DVC = 0,
+	RSND_MOD_CTU,
 	RSND_MOD_SRC,
 	RSND_MOD_SSI,
 	RSND_MOD_MAX,
@@ -351,6 +354,7 @@ struct rsnd_dai_stream {
 #define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
 #define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
 #define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
+#define rsnd_io_to_mod_ctu(io)	rsnd_io_to_mod((io), RSND_MOD_CTU)
 #define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
@@ -463,6 +467,12 @@ struct rsnd_priv {
 	int src_nr;
 
 	/*
+	 * below value will be filled on rsnd_ctu_probe()
+	 */
+	void *ctu;
+	int ctu_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -568,6 +578,17 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
 /*
+ *	R-Car CTU
+ */
+int rsnd_ctu_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+
+void rsnd_ctu_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
+
+/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
1.9.1

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

* [PATCH 31/35] ASoC: rsnd: add MIX (Mixer) support
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (29 preceding siblings ...)
  2015-07-15  7:17 ` [PATCH 30/35] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support Kuninori Morimoto
@ 2015-07-15  7:17 ` Kuninori Morimoto
  2015-07-17 18:26   ` Applied "ASoC: rsnd: add MIX (Mixer) support" to the asoc tree Mark Brown
  2015-07-15  7:17 ` [PATCH 32/35] ARM: shmobile: r8a7790: Add Audio CTU support on DTSI Kuninori Morimoto
                   ` (4 subsequent siblings)
  35 siblings, 1 reply; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

This patch adds MIX (Mixer) initial support for rsnd driver.
It is assuming that this MIX is used via DPCM.

This is sample code for playback.

	CPU0  : [MEM] -> [SRC1] -> [CTU02] -+
					    |
					    +-> [MIX0] -> [DVC0] -> [SSI0]
	                                    |
	CPU1  : [MEM] -> [SRC2] -> [CTU03] -+

	sound {
		compatible = "renesas,rsrc-card";

		...

		cpu@0 {
			sound-dai = <&rcar_sound 0>;
		};

		cpu@1 {
			sound-dai = <&rcar_sound 1>;
		};

		codec {
			...
		};
	};

	rcar_sound {

		...

		rcar_sound,dai {
			dai0 {
				playback = <&src1 &ctu02 &mix0 &dvc0 &ssi0>;
			};
			dai1 {
				playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;
			};
		};
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |   8 +
 include/sound/rcar_snd.h                           |   7 +
 sound/soc/sh/rcar/Makefile                         |   2 +-
 sound/soc/sh/rcar/core.c                           |  85 +++++++--
 sound/soc/sh/rcar/dma.c                            |   5 +
 sound/soc/sh/rcar/gen.c                            |  10 ++
 sound/soc/sh/rcar/mix.c                            | 200 +++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h                           |  29 +++
 8 files changed, 333 insertions(+), 13 deletions(-)
 create mode 100644 sound/soc/sh/rcar/mix.c

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 278607d..1173395 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,9 @@ Required properties:
 - rcar_sound,ctu		: Should contain CTU feature.
 				  The number of CTU subnode should be same as HW.
 				  see below for detail.
+- rcar_sound,mix		: Should contain MIX feature.
+				  The number of MIX subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dvc		: Should contain DVC feature.
 				  The number of DVC subnode should be same as HW.
 				  see below for detail.
@@ -93,6 +96,11 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 
+	rcar_sound,mix {
+		mix0: mix@0 { };
+		mix1: mix@1 { };
+	};
+
 	rcar_sound,ctu {
 		ctu00: ctu@0 { };
 		ctu01: ctu@1 { };
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 8f93030..bb7b2eb 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -65,6 +65,10 @@ struct rsnd_ctu_platform_info {
 	u32 flags;
 };
 
+struct rsnd_mix_platform_info {
+	u32 flags;
+};
+
 struct rsnd_dvc_platform_info {
 	u32 flags;
 };
@@ -73,6 +77,7 @@ struct rsnd_dai_path_info {
 	struct rsnd_ssi_platform_info *ssi;
 	struct rsnd_src_platform_info *src;
 	struct rsnd_ctu_platform_info *ctu;
+	struct rsnd_mix_platform_info *mix;
 	struct rsnd_dvc_platform_info *dvc;
 };
 
@@ -100,6 +105,8 @@ struct rcar_snd_info {
 	int src_info_nr;
 	struct rsnd_ctu_platform_info *ctu_info;
 	int ctu_info_nr;
+	struct rsnd_mix_platform_info *mix_info;
+	int mix_info_nr;
 	struct rsnd_dvc_platform_info *dvc_info;
 	int dvc_info_nr;
 	struct rsnd_dai_platform_info *dai_info;
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index 7c4730a..8b25850 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o mix.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 63ae7bb..927a7b0 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -605,23 +605,74 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io)
 {
-	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-	int src_id = rsnd_mod_id(src);
-	u32 path[] = {
-		[0] = 0x30000,
-		[1] = 0x30001,
-		[2] = 0x40000,
-		[3] = 0x10000,
-		[4] = 0x20000,
-		[5] = 0x40100
-	};
+	struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *cmd;
+	struct device *dev = rsnd_priv_to_dev(priv);
+	u32 data;
 
 	/* Gen1 is not supported */
 	if (rsnd_is_gen1(priv))
 		return;
 
-	rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
+	if (!mix && !dvc)
+		return;
+
+	if (mix) {
+		struct rsnd_dai *rdai;
+		int i;
+		u32 path[] = {
+			[0] = 0,
+			[1] = 1 << 0,
+			[2] = 0,
+			[3] = 0,
+			[4] = 0,
+			[5] = 1 << 8
+		};
+
+		/*
+		 * it is assuming that integrater is well understanding about
+		 * data path. Here doesn't check impossible connection,
+		 * like src2 + src5
+		 */
+		data = 0;
+		for_each_rsnd_dai(rdai, priv, i) {
+			io = &rdai->playback;
+			if (mix == rsnd_io_to_mod_mix(io))
+				data |= path[rsnd_mod_id(src)];
+
+			io = &rdai->capture;
+			if (mix == rsnd_io_to_mod_mix(io))
+				data |= path[rsnd_mod_id(src)];
+		}
+
+		/*
+		 * We can't use ctu = rsnd_io_ctu() here.
+		 * Since, ID of dvc/mix are 0 or 1 (= same as CMD number)
+		 * but ctu IDs are 0 - 7 (= CTU00 - CTU13)
+		 */
+		cmd = mix;
+	} else {
+		u32 path[] = {
+			[0] = 0x30000,
+			[1] = 0x30001,
+			[2] = 0x40000,
+			[3] = 0x10000,
+			[4] = 0x20000,
+			[5] = 0x40100
+		};
+
+		data = path[rsnd_mod_id(src)];
+
+		cmd = dvc;
+	}
+
+	dev_dbg(dev, "ctu/mix path = 0x%08x", data);
+
+	rsnd_mod_write(cmd, CMD_ROUTE_SLCT, data);
+
+	rsnd_mod_write(cmd, CMD_CTRL, 0x10);
 }
 
 static int rsnd_path_init(struct rsnd_priv *priv,
@@ -656,6 +707,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	if (ret < 0)
 		return ret;
 
+	/* MIX */
+	ret = rsnd_path_add(priv, io, mix);
+	if (ret < 0)
+		return ret;
+
 	/* DVC */
 	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
@@ -672,13 +728,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	struct device_node *ssi_node,	*ssi_np;
 	struct device_node *src_node,	*src_np;
 	struct device_node *ctu_node,	*ctu_np;
+	struct device_node *mix_node,	*mix_np;
 	struct device_node *dvc_node,	*dvc_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_platform_info *dai_info;
 	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
 	struct device *dev = &pdev->dev;
 	int nr, i;
-	int dai_i, ssi_i, src_i, ctu_i, dvc_i;
+	int dai_i, ssi_i, src_i, ctu_i, mix_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -705,6 +762,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
 	src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
 	ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
+	mix_node = of_get_child_by_name(dev->of_node, "rcar_sound,mix");
 	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
@@ -742,6 +800,7 @@ if (name##_node) {							\
 			mod_parse(ssi);
 			mod_parse(src);
 			mod_parse(ctu);
+			mod_parse(mix);
 			mod_parse(dvc);
 
 			of_node_put(playback);
@@ -1155,6 +1214,7 @@ static int rsnd_probe(struct platform_device *pdev)
 		rsnd_ssi_probe,
 		rsnd_src_probe,
 		rsnd_ctu_probe,
+		rsnd_mix_probe,
 		rsnd_dvc_probe,
 		rsnd_adg_probe,
 		rsnd_dai_probe,
@@ -1251,6 +1311,7 @@ static int rsnd_remove(struct platform_device *pdev)
 		rsnd_ssi_remove,
 		rsnd_src_remove,
 		rsnd_ctu_remove,
+		rsnd_mix_remove,
 		rsnd_dvc_remove,
 	};
 	int ret = 0, i;
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 229b68d..305b129 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -427,6 +427,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
 	int use_src = !!rsnd_io_to_mod_src(io);
 	int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
+		      !!rsnd_io_to_mod_mix(io) ||
 		      !!rsnd_io_to_mod_ctu(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
@@ -506,6 +507,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
+	struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
 	struct rsnd_mod *mod_start, *mod_end;
@@ -548,6 +550,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 		} else if (ctu) {
 			mod[i] = ctu;
 			ctu = NULL;
+		} else if (mix) {
+			mod[i] = mix;
+			mix = NULL;
 		} else if (dvc) {
 			mod[i] = dvc;
 			dvc = NULL;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 41b75cd..f04d17b 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -242,6 +242,16 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SRC_BSISR,	0x238,	0x40),
 		RSND_GEN_M_REG(CTU_CTUIR,	0x504,	0x100),
 		RSND_GEN_M_REG(CTU_ADINR,	0x508,	0x100),
+		RSND_GEN_M_REG(MIX_SWRSR,	0xd00,	0x40),
+		RSND_GEN_M_REG(MIX_MIXIR,	0xd04,	0x40),
+		RSND_GEN_M_REG(MIX_ADINR,	0xd08,	0x40),
+		RSND_GEN_M_REG(MIX_MIXMR,	0xd10,	0x40),
+		RSND_GEN_M_REG(MIX_MVPDR,	0xd14,	0x40),
+		RSND_GEN_M_REG(MIX_MDBAR,	0xd18,	0x40),
+		RSND_GEN_M_REG(MIX_MDBBR,	0xd1c,	0x40),
+		RSND_GEN_M_REG(MIX_MDBCR,	0xd20,	0x40),
+		RSND_GEN_M_REG(MIX_MDBDR,	0xd24,	0x40),
+		RSND_GEN_M_REG(MIX_MDBER,	0xd28,	0x40),
 		RSND_GEN_M_REG(DVC_SWRSR,	0xe00,	0x100),
 		RSND_GEN_M_REG(DVC_DVUIR,	0xe04,	0x100),
 		RSND_GEN_M_REG(DVC_ADINR,	0xe08,	0x100),
diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c
new file mode 100644
index 0000000..0d5c102
--- /dev/null
+++ b/sound/soc/sh/rcar/mix.c
@@ -0,0 +1,200 @@
+/*
+ * mix.c
+ *
+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include "rsnd.h"
+
+#define MIX_NAME_SIZE	16
+#define MIX_NAME "mix"
+
+struct rsnd_mix {
+	struct rsnd_mix_platform_info *info; /* rcar_snd.h */
+	struct rsnd_mod mod;
+};
+
+#define rsnd_mix_nr(priv) ((priv)->mix_nr)
+#define for_each_rsnd_mix(pos, priv, i)					\
+	for ((i) = 0;							\
+	     ((i) < rsnd_mix_nr(priv)) &&				\
+		     ((pos) = (struct rsnd_mix *)(priv)->mix + i);	\
+	     i++)
+
+
+static void rsnd_mix_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, MIX_SWRSR, 0);
+	rsnd_mod_write(mod, MIX_SWRSR, 1);
+}
+
+#define rsnd_mix_initialize_lock(mod)	__rsnd_mix_initialize_lock(mod, 1)
+#define rsnd_mix_initialize_unlock(mod)	__rsnd_mix_initialize_lock(mod, 0)
+static void __rsnd_mix_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, MIX_MIXIR, enable);
+}
+
+static void rsnd_mix_volume_update(struct rsnd_dai_stream *io,
+				  struct rsnd_mod *mod)
+{
+
+	/* Disable MIX dB setting */
+	rsnd_mod_write(mod, MIX_MDBER, 0);
+
+	rsnd_mod_write(mod, MIX_MDBAR, 0);
+	rsnd_mod_write(mod, MIX_MDBBR, 0);
+	rsnd_mod_write(mod, MIX_MDBCR, 0);
+	rsnd_mod_write(mod, MIX_MDBDR, 0);
+
+	/* Enable MIX dB setting */
+	rsnd_mod_write(mod, MIX_MDBER, 1);
+}
+
+static int rsnd_mix_init(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_start(mod);
+
+	rsnd_mix_soft_reset(mod);
+
+	rsnd_mix_initialize_lock(mod);
+
+	rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io));
+
+	rsnd_path_parse(priv, io);
+
+	/* volume step */
+	rsnd_mod_write(mod, MIX_MIXMR, 0);
+	rsnd_mod_write(mod, MIX_MVPDR, 0);
+
+	rsnd_mix_volume_update(io, mod);
+
+	rsnd_mix_initialize_unlock(mod);
+
+	return 0;
+}
+
+static int rsnd_mix_quit(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_stop(mod);
+
+	return 0;
+}
+
+static struct rsnd_mod_ops rsnd_mix_ops = {
+	.name		= MIX_NAME,
+	.init		= rsnd_mix_init,
+	.quit		= rsnd_mix_quit,
+};
+
+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id)
+{
+	if (WARN_ON(id < 0 || id >= rsnd_mix_nr(priv)))
+		id = 0;
+
+	return &((struct rsnd_mix *)(priv->mix) + id)->mod;
+}
+
+static void rsnd_of_parse_mix(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_mix_platform_info *mix_info;
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = &pdev->dev;
+	int nr;
+
+	if (!of_data)
+		return;
+
+	node = of_get_child_by_name(dev->of_node, "rcar_sound,mix");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_mix_end;
+
+	mix_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_mix_platform_info) * nr,
+				GFP_KERNEL);
+	if (!mix_info) {
+		dev_err(dev, "mix info allocation error\n");
+		goto rsnd_of_parse_mix_end;
+	}
+
+	info->mix_info		= mix_info;
+	info->mix_info_nr	= nr;
+
+rsnd_of_parse_mix_end:
+	of_node_put(node);
+
+}
+
+int rsnd_mix_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv)
+{
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	struct rsnd_mix *mix;
+	struct clk *clk;
+	char name[MIX_NAME_SIZE];
+	int i, nr, ret;
+
+	/* This driver doesn't support Gen1 at this point */
+	if (rsnd_is_gen1(priv)) {
+		dev_warn(dev, "MIX is not supported on Gen1\n");
+		return -EINVAL;
+	}
+
+	rsnd_of_parse_mix(pdev, of_data, priv);
+
+	nr = info->mix_info_nr;
+	if (!nr)
+		return 0;
+
+	mix	= devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL);
+	if (!mix)
+		return -ENOMEM;
+
+	priv->mix_nr	= nr;
+	priv->mix	= mix;
+
+	for_each_rsnd_mix(mix, priv, i) {
+		snprintf(name, MIX_NAME_SIZE, "%s.%d",
+			 MIX_NAME, i);
+
+		clk = devm_clk_get(dev, name);
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+
+		mix->info = &info->mix_info[i];
+
+		ret = rsnd_mod_init(priv, &mix->mod, &rsnd_mix_ops,
+				    clk, RSND_MOD_MIX, i);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+void rsnd_mix_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv)
+{
+	struct rsnd_mix *mix;
+	int i;
+
+	for_each_rsnd_mix(mix, priv, i) {
+		rsnd_mod_quit(&mix->mod);
+	}
+}
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f2128a7..7a0e52b 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -49,6 +49,16 @@ enum rsnd_reg {
 	RSND_REG_CMD_ROUTE_SLCT,
 	RSND_REG_CTU_CTUIR,
 	RSND_REG_CTU_ADINR,
+	RSND_REG_MIX_SWRSR,
+	RSND_REG_MIX_MIXIR,
+	RSND_REG_MIX_ADINR,
+	RSND_REG_MIX_MIXMR,
+	RSND_REG_MIX_MVPDR,
+	RSND_REG_MIX_MDBAR,
+	RSND_REG_MIX_MDBBR,
+	RSND_REG_MIX_MDBCR,
+	RSND_REG_MIX_MDBDR,
+	RSND_REG_MIX_MDBER,
 	RSND_REG_DVC_SWRSR,
 	RSND_REG_DVC_DVUIR,
 	RSND_REG_DVC_ADINR,
@@ -222,6 +232,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
  */
 enum rsnd_mod_type {
 	RSND_MOD_DVC = 0,
+	RSND_MOD_MIX,
 	RSND_MOD_CTU,
 	RSND_MOD_SRC,
 	RSND_MOD_SSI,
@@ -355,6 +366,7 @@ struct rsnd_dai_stream {
 #define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
 #define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
 #define rsnd_io_to_mod_ctu(io)	rsnd_io_to_mod((io), RSND_MOD_CTU)
+#define rsnd_io_to_mod_mix(io)	rsnd_io_to_mod((io), RSND_MOD_MIX)
 #define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
@@ -473,6 +485,12 @@ struct rsnd_priv {
 	int ctu_nr;
 
 	/*
+	 * below value will be filled on rsnd_mix_probe()
+	 */
+	void *mix;
+	int mix_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -589,6 +607,17 @@ void rsnd_ctu_remove(struct platform_device *pdev,
 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
 
 /*
+ *	R-Car MIX
+ */
+int rsnd_mix_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+
+void rsnd_mix_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
+
+/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
1.9.1

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

* [PATCH 32/35] ARM: shmobile: r8a7790: Add Audio CTU support on DTSI
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (30 preceding siblings ...)
  2015-07-15  7:17 ` [PATCH 31/35] ASoC: rsnd: add MIX (Mixer) support Kuninori Morimoto
@ 2015-07-15  7:17 ` Kuninori Morimoto
  2015-07-15  7:18 ` [PATCH 33/35] ARM: shmobile: r8a7790: Add Audio MIX " Kuninori Morimoto
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 arch/arm/boot/dts/r8a7790.dtsi            | 16 ++++++++++++++++
 include/dt-bindings/clock/r8a7790-clock.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 3ae0c3b..6aa1d75 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1303,6 +1303,7 @@
 				<&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
+				<&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>;
 
 			#clock-cells = <1>;
@@ -1312,6 +1313,7 @@
 				R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
 				R8A7790_CLK_SCU_ALL
 				R8A7790_CLK_SCU_DVC1 R8A7790_CLK_SCU_DVC0
+				R8A7790_CLK_SCU_CTU1_MIX1 R8A7790_CLK_SCU_CTU0_MIX0
 				R8A7790_CLK_SCU_SRC9 R8A7790_CLK_SCU_SRC8 R8A7790_CLK_SCU_SRC7 R8A7790_CLK_SCU_SRC6 R8A7790_CLK_SCU_SRC5
 				R8A7790_CLK_SCU_SRC4 R8A7790_CLK_SCU_SRC3 R8A7790_CLK_SCU_SRC2 R8A7790_CLK_SCU_SRC1 R8A7790_CLK_SCU_SRC0
 			>;
@@ -1321,6 +1323,7 @@
 				"ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
 				"scu-all",
 				"scu-dvc1", "scu-dvc0",
+				"scu-ctu1-mix1", "scu-ctu0-mix0",
 				"scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
 				"scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
 		};
@@ -1536,6 +1539,7 @@
 			<&mstp10_clks R8A7790_CLK_SCU_SRC5>, <&mstp10_clks R8A7790_CLK_SCU_SRC4>,
 			<&mstp10_clks R8A7790_CLK_SCU_SRC3>, <&mstp10_clks R8A7790_CLK_SCU_SRC2>,
 			<&mstp10_clks R8A7790_CLK_SCU_SRC1>, <&mstp10_clks R8A7790_CLK_SCU_SRC0>,
+			<&mstp10_clks R8A7790_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
 			<&mstp10_clks R8A7790_CLK_SCU_DVC0>, <&mstp10_clks R8A7790_CLK_SCU_DVC1>,
 			<&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
 		clock-names = "ssi-all",
@@ -1543,6 +1547,7 @@
 				"ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
 				"src.9", "src.8", "src.7", "src.6", "src.5",
 				"src.4", "src.3", "src.2", "src.1", "src.0",
+				"ctu.0", "ctu.1",
 				"dvc.0", "dvc.1",
 				"clk_a", "clk_b", "clk_c", "clk_i";
 
@@ -1559,6 +1564,17 @@
 			};
 		};
 
+		rcar_sound,ctu {
+			ctu00: ctu@0 { };
+			ctu01: ctu@1 { };
+			ctu02: ctu@2 { };
+			ctu03: ctu@3 { };
+			ctu10: ctu@4 { };
+			ctu11: ctu@5 { };
+			ctu12: ctu@6 { };
+			ctu13: ctu@7 { };
+		};
+
 		rcar_sound,src {
 			src0: src@0 {
 				interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index e119ef3..7b1ad89 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -144,6 +144,8 @@
 #define R8A7790_CLK_SCU_ALL		17
 #define R8A7790_CLK_SCU_DVC1		18
 #define R8A7790_CLK_SCU_DVC0		19
+#define R8A7790_CLK_SCU_CTU1_MIX1	20
+#define R8A7790_CLK_SCU_CTU0_MIX0	21
 #define R8A7790_CLK_SCU_SRC9		22
 #define R8A7790_CLK_SCU_SRC8		23
 #define R8A7790_CLK_SCU_SRC7		24
-- 
1.9.1

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

* [PATCH 33/35] ARM: shmobile: r8a7790: Add Audio MIX support on DTSI
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (31 preceding siblings ...)
  2015-07-15  7:17 ` [PATCH 32/35] ARM: shmobile: r8a7790: Add Audio CTU support on DTSI Kuninori Morimoto
@ 2015-07-15  7:18 ` Kuninori Morimoto
  2015-07-15  7:18 ` [PATCH 34/35] ARM: shmobile: r8a7791: Add Audio CTU " Kuninori Morimoto
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 arch/arm/boot/dts/r8a7790.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 6aa1d75..f1cdccc 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1540,6 +1540,7 @@
 			<&mstp10_clks R8A7790_CLK_SCU_SRC3>, <&mstp10_clks R8A7790_CLK_SCU_SRC2>,
 			<&mstp10_clks R8A7790_CLK_SCU_SRC1>, <&mstp10_clks R8A7790_CLK_SCU_SRC0>,
 			<&mstp10_clks R8A7790_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
+			<&mstp10_clks R8A7790_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
 			<&mstp10_clks R8A7790_CLK_SCU_DVC0>, <&mstp10_clks R8A7790_CLK_SCU_DVC1>,
 			<&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
 		clock-names = "ssi-all",
@@ -1548,6 +1549,7 @@
 				"src.9", "src.8", "src.7", "src.6", "src.5",
 				"src.4", "src.3", "src.2", "src.1", "src.0",
 				"ctu.0", "ctu.1",
+				"mix.0", "mix.1",
 				"dvc.0", "dvc.1",
 				"clk_a", "clk_b", "clk_c", "clk_i";
 
@@ -1564,6 +1566,11 @@
 			};
 		};
 
+		rcar_sound,mix {
+			mix0: mix@0 { };
+			mix1: mix@1 { };
+		};
+
 		rcar_sound,ctu {
 			ctu00: ctu@0 { };
 			ctu01: ctu@1 { };
-- 
1.9.1

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

* [PATCH 34/35] ARM: shmobile: r8a7791: Add Audio CTU support on DTSI
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (32 preceding siblings ...)
  2015-07-15  7:18 ` [PATCH 33/35] ARM: shmobile: r8a7790: Add Audio MIX " Kuninori Morimoto
@ 2015-07-15  7:18 ` Kuninori Morimoto
  2015-07-15  7:18 ` [PATCH 35/35] ARM: shmobile: r8a7791: Add Audio MIX " Kuninori Morimoto
  2015-07-16 21:19 ` [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Mark Brown
  35 siblings, 0 replies; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7791.dtsi            | 16 ++++++++++++++++
 include/dt-bindings/clock/r8a7791-clock.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 07ea2be..cdd55b8 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1311,6 +1311,7 @@
 				<&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
+				<&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
 				<&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>;
 
 			#clock-cells = <1>;
@@ -1320,6 +1321,7 @@
 				R8A7791_CLK_SSI4 R8A7791_CLK_SSI3 R8A7791_CLK_SSI2 R8A7791_CLK_SSI1 R8A7791_CLK_SSI0
 				R8A7791_CLK_SCU_ALL
 				R8A7791_CLK_SCU_DVC1 R8A7791_CLK_SCU_DVC0
+				R8A7791_CLK_SCU_CTU1_MIX1 R8A7791_CLK_SCU_CTU0_MIX0
 				R8A7791_CLK_SCU_SRC9 R8A7791_CLK_SCU_SRC8 R8A7791_CLK_SCU_SRC7 R8A7791_CLK_SCU_SRC6 R8A7791_CLK_SCU_SRC5
 				R8A7791_CLK_SCU_SRC4 R8A7791_CLK_SCU_SRC3 R8A7791_CLK_SCU_SRC2 R8A7791_CLK_SCU_SRC1 R8A7791_CLK_SCU_SRC0
 			>;
@@ -1329,6 +1331,7 @@
 				"ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
 				"scu-all",
 				"scu-dvc1", "scu-dvc0",
+				"scu-ctu1-mix1", "scu-ctu0-mix0",
 				"scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
 				"scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
 		};
@@ -1582,6 +1585,7 @@
 			<&mstp10_clks R8A7791_CLK_SCU_SRC5>, <&mstp10_clks R8A7791_CLK_SCU_SRC4>,
 			<&mstp10_clks R8A7791_CLK_SCU_SRC3>, <&mstp10_clks R8A7791_CLK_SCU_SRC2>,
 			<&mstp10_clks R8A7791_CLK_SCU_SRC1>, <&mstp10_clks R8A7791_CLK_SCU_SRC0>,
+			<&mstp10_clks R8A7791_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
 			<&mstp10_clks R8A7791_CLK_SCU_DVC0>, <&mstp10_clks R8A7791_CLK_SCU_DVC1>,
 			<&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
 		clock-names = "ssi-all",
@@ -1589,6 +1593,7 @@
 				"ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
 				"src.9", "src.8", "src.7", "src.6", "src.5",
 				"src.4", "src.3", "src.2", "src.1", "src.0",
+				"ctu.0", "ctu.1",
 				"dvc.0", "dvc.1",
 				"clk_a", "clk_b", "clk_c", "clk_i";
 
@@ -1605,6 +1610,17 @@
 			};
 		};
 
+		rcar_sound,ctu {
+			ctu00: ctu@0 { };
+			ctu01: ctu@1 { };
+			ctu02: ctu@2 { };
+			ctu03: ctu@3 { };
+			ctu10: ctu@4 { };
+			ctu11: ctu@5 { };
+			ctu12: ctu@6 { };
+			ctu13: ctu@7 { };
+		};
+
 		rcar_sound,src {
 			src0: src@0 {
 				interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 4022683..dd09b73 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -141,6 +141,8 @@
 #define R8A7791_CLK_SCU_ALL		17
 #define R8A7791_CLK_SCU_DVC1		18
 #define R8A7791_CLK_SCU_DVC0		19
+#define R8A7791_CLK_SCU_CTU1_MIX1	20
+#define R8A7791_CLK_SCU_CTU0_MIX0	21
 #define R8A7791_CLK_SCU_SRC9		22
 #define R8A7791_CLK_SCU_SRC8		23
 #define R8A7791_CLK_SCU_SRC7		24
-- 
1.9.1

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

* [PATCH 35/35] ARM: shmobile: r8a7791: Add Audio MIX support on DTSI
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (33 preceding siblings ...)
  2015-07-15  7:18 ` [PATCH 34/35] ARM: shmobile: r8a7791: Add Audio CTU " Kuninori Morimoto
@ 2015-07-15  7:18 ` Kuninori Morimoto
  2015-07-16 21:19 ` [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Mark Brown
  35 siblings, 0 replies; 68+ messages in thread
From: Kuninori Morimoto @ 2015-07-15  7:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7791.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index cdd55b8..d37339bd7 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1586,6 +1586,7 @@
 			<&mstp10_clks R8A7791_CLK_SCU_SRC3>, <&mstp10_clks R8A7791_CLK_SCU_SRC2>,
 			<&mstp10_clks R8A7791_CLK_SCU_SRC1>, <&mstp10_clks R8A7791_CLK_SCU_SRC0>,
 			<&mstp10_clks R8A7791_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
+			<&mstp10_clks R8A7791_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
 			<&mstp10_clks R8A7791_CLK_SCU_DVC0>, <&mstp10_clks R8A7791_CLK_SCU_DVC1>,
 			<&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
 		clock-names = "ssi-all",
@@ -1594,6 +1595,7 @@
 				"src.9", "src.8", "src.7", "src.6", "src.5",
 				"src.4", "src.3", "src.2", "src.1", "src.0",
 				"ctu.0", "ctu.1",
+				"mix.0", "mix.1",
 				"dvc.0", "dvc.1",
 				"clk_a", "clk_b", "clk_c", "clk_i";
 
@@ -1610,6 +1612,11 @@
 			};
 		};
 
+		rcar_sound,mix {
+			mix0: mix@0 { };
+			mix1: mix@1 { };
+		};
+
 		rcar_sound,ctu {
 			ctu00: ctu@0 { };
 			ctu01: ctu@1 { };
-- 
1.9.1

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

* Applied "ASoC: core: add snd_soc_of_parse_audio_prefix()" to the asoc tree
  2015-07-15  7:07 ` [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix() Kuninori Morimoto
@ 2015-07-16 21:01   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:01 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: core: add snd_soc_of_parse_audio_prefix()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5e3cdaa20816dd2fe4dc17d06a9f0dae0abc930c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:07:42 +0000
Subject: [PATCH] ASoC: core: add snd_soc_of_parse_audio_prefix()

Current ASoC can add name_prefix for DAPM, and it is necessary for
route settings. This patch adds snd_soc_of_parse_audio_prefix() for
this purpose. It will be used with snd_soc_of_parse_audio_routing().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/soc.h  |  4 ++++
 sound/soc/soc-core.c | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 93df8bf..75cd19c 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1604,6 +1604,10 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
 int snd_soc_of_parse_tdm_slot(struct device_node *np,
 			      unsigned int *slots,
 			      unsigned int *slot_width);
+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+				   struct snd_soc_codec_conf *codec_conf,
+				   struct device_node *of_node,
+				   const char *propname);
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a4a5c0..fd15d54 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3303,6 +3303,26 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot);
 
+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+				   struct snd_soc_codec_conf *codec_conf,
+				   struct device_node *of_node,
+				   const char *propname)
+{
+	struct device_node *np = card->dev->of_node;
+	const char *str;
+	int ret;
+
+	ret = of_property_read_string(np, propname, &str);
+	if (ret < 0) {
+		/* no prefix is not error */
+		return;
+	}
+
+	codec_conf->of_node	= of_node;
+	codec_conf->name_prefix	= str;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix);
+
 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname)
 {
-- 
2.1.4

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

* Applied "ASoC: rsnd: move SRC specific macro into src.c" to the asoc tree
  2015-07-15  7:11 ` [PATCH 12/35] ASoC: rsnd: move SRC specific macro into src.c Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: move SRC specific macro into src.c

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From da599fd34b1f2f14f2c387e6b3a909f9ff519c8a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:11:21 +0000
Subject: [PATCH] ASoC: rsnd: move SRC specific macro into src.c

rsnd_src_nr() is used only from src.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsnd.h | 2 --
 sound/soc/sh/rcar/src.c  | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 8f793f0..c8d2029 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -554,8 +554,6 @@ int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
 int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
-#define rsnd_src_nr(priv) ((priv)->src_nr)
-
 /*
  *	R-Car SSI
  */
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 38d0aba..0b06ac8 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -30,6 +30,7 @@ struct rsnd_src {
 
 #define RSND_SRC_NAME_SIZE 16
 
+#define rsnd_src_nr(priv) ((priv)->src_nr)
 #define rsnd_enable_sync_convert(src) ((src)->sen.val)
 #define rsnd_src_of_node(priv) \
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src")
-- 
2.1.4

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

* Applied "ASoC: rsnd: move DVC specific macro into dvc.c" to the asoc tree
  2015-07-15  7:11 ` [PATCH 11/35] ASoC: rsnd: move DVC specific macro into dvc.c Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: move DVC specific macro into dvc.c

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4f35fabaa30b116d549d95fe7dae907510c71862 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:11:02 +0000
Subject: [PATCH] ASoC: rsnd: move DVC specific macro into dvc.c

rsnd_dvc_nr() is used only from dvc.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dvc.c  | 1 +
 sound/soc/sh/rcar/rsnd.h | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index dbf0da6..8a61aa3 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -24,6 +24,7 @@ struct rsnd_dvc {
 	struct rsnd_kctrl_cfg_s rdown;	/* Ramp Rate Down */
 };
 
+#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
 #define rsnd_dvc_of_node(priv) \
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,dvc")
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 46eb4da..8f793f0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -579,7 +579,4 @@ void rsnd_dvc_remove(struct platform_device *pdev,
 		     struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
 
-#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
-
-
 #endif
-- 
2.1.4

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

* Applied "ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL" to the asoc tree
  2015-07-15  7:10 ` [PATCH 10/35] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 72413c107e81386a7da438bcf888ee2af5d3b72f Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:10:43 +0000
Subject: [PATCH] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL

enabling to use same method for exception case is useful.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsnd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 9ecd151..46eb4da 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -316,7 +316,7 @@ struct rsnd_mod {
 
 #define rsnd_mod_to_priv(mod) ((mod)->priv)
 #define rsnd_mod_to_dma(mod) (&(mod)->dma)
-#define rsnd_mod_id(mod) ((mod)->id)
+#define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1)
 #define rsnd_mod_hw_start(mod)	clk_enable((mod)->clk)
 #define rsnd_mod_hw_stop(mod)	clk_disable((mod)->clk)
 
-- 
2.1.4

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

* Applied "ASoC: rsnd: add workaround for SRC sync convert + DVC" to the asoc tree
  2015-07-15  7:10 ` [PATCH 09/35] ASoC: rsnd: add workaround for SRC sync convert + DVC Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add workaround for SRC sync convert + DVC

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1a1bf58aafd09b3cb148eead3d709e2d7974a1f3 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:10:22 +0000
Subject: [PATCH] ASoC: rsnd: add workaround for SRC sync convert + DVC

We couldn't use SRC sync convert mode together with DVC,
but we can use workaround for it.
This patch adds workaround and can use SRC sync convert + DVC

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/src.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 9e11f73..38d0aba 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -616,6 +616,14 @@ static void rsnd_src_irq_ctrol_gen2(struct rsnd_mod *mod, int enable)
 		int_val = 0;
 	}
 
+	/*
+	 * WORKAROUND
+	 *
+	 * ignore over flow error when rsnd_enable_sync_convert()
+	 */
+	if (rsnd_enable_sync_convert(src))
+		sys_int_val = sys_int_val & 0xffff;
+
 	rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
 	rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
 	rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
@@ -631,11 +639,22 @@ static void rsnd_src_error_clear_gen2(struct rsnd_mod *mod)
 
 static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
 {
-	u32 val = OUF_SRC(rsnd_mod_id(mod));
+	struct rsnd_src *src = rsnd_mod_to_src(mod);
+	u32 val0, val1;
 	bool ret = false;
 
-	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val) ||
-	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val)) {
+	val0 = val1 = OUF_SRC(rsnd_mod_id(mod));
+
+	/*
+	 * WORKAROUND
+	 *
+	 * ignore over flow error when rsnd_enable_sync_convert()
+	 */
+	if (rsnd_enable_sync_convert(src))
+		val0 = val0 & 0xffff;
+
+	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val0) ||
+	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val1)) {
 		struct rsnd_src *src = rsnd_mod_to_src(mod);
 
 		src->err++;
@@ -651,7 +670,16 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
 static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
 				struct rsnd_dai_stream *io)
 {
-	u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11;
+	struct rsnd_src *src = rsnd_mod_to_src(mod);
+	u32 val;
+
+	/*
+	 * WORKAROUND
+	 *
+	 * Enable SRC output if you want to use sync convert together with DVC
+	 */
+	val = (rsnd_io_to_mod_dvc(io) && !rsnd_enable_sync_convert(src)) ?
+		0x01 : 0x11;
 
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
@@ -921,13 +949,6 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
 		return 0;
 
 	/*
-	 * We can't use SRC sync convert
-	 * if it has DVC
-	 */
-	if (rsnd_io_to_mod_dvc(io))
-		return 0;
-
-	/*
 	 * enable sync convert
 	 */
 	ret = rsnd_kctrl_new_s(mod, io, rtd,
-- 
2.1.4

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

* Applied "ASoC: rsnd: fixup each module counter on __rsnd_mod_call()" to the asoc tree
  2015-07-15  7:10 ` [PATCH 08/35] ASoC: rsnd: fixup each module counter on __rsnd_mod_call() Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: fixup each module counter on __rsnd_mod_call()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From a48e3f9747fd62b385221a892cd4726b82dacd11 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:10:04 +0000
Subject: [PATCH] ASoC: rsnd: fixup each module counter on __rsnd_mod_call()

'5451ea443b ("ASoC: rsnd: count each mod (SSI/SRC/DVC)")' counts each
module's callback status, but counts 1st callback only.
This patch fixup it. Otherwise, multi-called function will be trouble

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f1e5920..d44bfb7 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -242,9 +242,9 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	if (val == __rsnd_mod_call_##func) {				\
 		called = 1;						\
 		ret = (mod)->ops->func(mod, io, param);			\
-		mod->status = (mod->status & ~mask) +			\
-			(add << __rsnd_mod_shift_##func);		\
 	}								\
+	mod->status = (mod->status & ~mask) +				\
+		(add << __rsnd_mod_shift_##func);			\
 	dev_dbg(dev, "%s[%d] 0x%08x %s\n",				\
 		rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status,	\
 		called ? #func : "");					\
-- 
2.1.4

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

* Applied "ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE" to the asoc tree
  2015-07-15  7:09 ` [PATCH 07/35] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From efa991dc9143815179fd55a88e846cc39792608c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:09:47 +0000
Subject: [PATCH] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE

based on datasheet

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/gen.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 9 ++++-----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 9dc1968..5d3592df 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -218,7 +218,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8,	0x80),
 		RSND_GEN_M_REG(SSI_CTRL,	0x10,	0x80),
-		RSND_GEN_M_REG(INT_ENABLE,	0x18,	0x80),
+		RSND_GEN_M_REG(SSI_INT_ENABLE,	0x18,	0x80),
 	};
 	struct rsnd_regmap_field_conf conf_scu[] = {
 		RSND_GEN_M_REG(SRC_BUSIF_MODE,	0x0,	0x20),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f49b0cb..9ecd151 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -119,7 +119,7 @@ enum rsnd_reg {
 #define RSND_REG_SSI_CTRL		RSND_REG_SHARE02
 #define RSND_REG_SSI_BUSIF_MODE		RSND_REG_SHARE03
 #define RSND_REG_SSI_BUSIF_ADINR	RSND_REG_SHARE04
-#define RSND_REG_INT_ENABLE		RSND_REG_SHARE05
+#define RSND_REG_SSI_INT_ENABLE		RSND_REG_SHARE05
 #define RSND_REG_SRC_BSDSR		RSND_REG_SHARE06
 #define RSND_REG_SRC_BSISR		RSND_REG_SHARE07
 #define RSND_REG_DIV_EN			RSND_REG_SHARE08
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 3f6f4df..9e11f73 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -215,10 +215,9 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod)
 		return 0;
 
 	/* enable SSI interrupt if Gen2 */
-	if (rsnd_ssi_is_dma_mode(ssi_mod))
-		rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0e000000);
-	else
-		rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
+	rsnd_mod_write(ssi_mod, SSI_INT_ENABLE,
+		       rsnd_ssi_is_dma_mode(ssi_mod) ?
+		       0x0e000000 : 0x0f000000);
 
 	return 0;
 }
@@ -231,7 +230,7 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod)
 		return 0;
 
 	/* disable SSI interrupt if Gen2 */
-	rsnd_mod_write(ssi_mod, INT_ENABLE, 0x00000000);
+	rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, 0x00000000);
 
 	return 0;
 }
-- 
2.1.4

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

* Applied "ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN" to the asoc tree
  2015-07-15  7:09 ` [PATCH 06/35] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From cdde84d10d3cb4d35051bc5fdb268f6faf33d1c8 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:09:27 +0000
Subject: [PATCH] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN

based on datasheet

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/gen.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 48f704b..9dc1968 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -216,7 +216,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		/* FIXME: it needs SSI_MODE2/3 in the future */
 		RSND_GEN_M_REG(SSI_BUSIF_MODE,	0x0,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
-		RSND_GEN_M_REG(BUSIF_DALIGN,	0x8,	0x80),
+		RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8,	0x80),
 		RSND_GEN_M_REG(SSI_CTRL,	0x10,	0x80),
 		RSND_GEN_M_REG(INT_ENABLE,	0x18,	0x80),
 	};
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f729646..f49b0cb 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -136,7 +136,7 @@ enum rsnd_reg {
 #define RSND_REG_AUDIO_CLK_SEL2		RSND_REG_SHARE19
 #define RSND_REG_CMD_CTRL		RSND_REG_SHARE20
 #define RSND_REG_CMDOUT_TIMSEL		RSND_REG_SHARE21
-#define RSND_REG_BUSIF_DALIGN		RSND_REG_SHARE22
+#define RSND_REG_SSI_BUSIF_DALIGN	RSND_REG_SHARE22
 #define RSND_REG_DVC_VRCTR		RSND_REG_SHARE23
 #define RSND_REG_DVC_VRPDR		RSND_REG_SHARE24
 #define RSND_REG_DVC_VRDBR		RSND_REG_SHARE25
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 37927ca..3f6f4df 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 			val |= 0x76543210 & ~mask;
 			break;
 		}
-		rsnd_mod_write(ssi_mod, BUSIF_DALIGN, val);
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_DALIGN, val);
 
 	}
 
-- 
2.1.4

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

* Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from DVC" to the asoc tree
  2015-07-15  7:09 ` [PATCH 05/35] ASoC: rsnd: remove unnecessary 'out of memory' message from DVC Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: remove unnecessary 'out of memory' message from DVC

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6abcae32ea68899bfd4b770433860a71f8c3500b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:09:07 +0000
Subject: [PATCH] ASoC: rsnd: remove unnecessary 'out of memory' message from
 DVC

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dvc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 36fc020..dbf0da6 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -354,10 +354,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	}
 
 	dvc	= devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
-	if (!dvc) {
-		dev_err(dev, "CMD allocate failed\n");
+	if (!dvc)
 		return -ENOMEM;
-	}
 
 	priv->dvc_nr	= nr;
 	priv->dvc	= dvc;
-- 
2.1.4

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

* Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SRC" to the asoc tree
  2015-07-15  7:08 ` [PATCH 04/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SRC Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: remove unnecessary 'out of memory' message from SRC

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 33363f7a18f3baaa04b678aac8819c43296c8c9c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:08:44 +0000
Subject: [PATCH] ASoC: rsnd: remove unnecessary 'out of memory' message from
 SRC

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/src.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index c61c171..37927ca 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -1047,10 +1047,8 @@ int rsnd_src_probe(struct platform_device *pdev,
 		return 0;
 
 	src	= devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL);
-	if (!src) {
-		dev_err(dev, "SRC allocate failed\n");
+	if (!src)
 		return -ENOMEM;
-	}
 
 	priv->src_nr	= nr;
 	priv->src	= src;
-- 
2.1.4

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

* Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SSI" to the asoc tree
  2015-07-15  7:08 ` [PATCH 03/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SSI Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: remove unnecessary 'out of memory' message from SSI

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From afa700729646761f58cc068d86a37e09a70e4cf6 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:08:24 +0000
Subject: [PATCH] ASoC: rsnd: remove unnecessary 'out of memory' message from
 SSI

Current checkpatch.pl indicates 'out of memory' message is unnecessary.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/ssi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2fbe59f..d45b9a7 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -770,10 +770,8 @@ int rsnd_ssi_probe(struct platform_device *pdev,
 	 */
 	nr	= info->ssi_info_nr;
 	ssi	= devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL);
-	if (!ssi) {
-		dev_err(dev, "SSI allocate failed\n");
+	if (!ssi)
 		return -ENOMEM;
-	}
 
 	priv->ssi	= ssi;
 	priv->ssi_nr	= nr;
-- 
2.1.4

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

* Applied "ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing" to the asoc tree
  2015-07-15  7:08 ` [PATCH 02/35] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing Kuninori Morimoto
@ 2015-07-16 21:11   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:11 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From b7419dd73606118b8797d49b53a9fbe2e2dfa863 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:08:05 +0000
Subject: [PATCH] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for
 routing

using common audio routing path method makes sense.
Let's use snd_soc_of_parse_audio_route/prefix.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../bindings/sound/renesas,rsrc-card.txt           |  7 +++++++
 sound/soc/sh/rcar/rsrc-card.c                      | 22 ++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index c641550..962748a 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -6,6 +6,7 @@ Required properties:
 
 - compatible				: "renesas,rsrc-card,<board>"
 					  Examples with soctypes are:
+					    - "renesas,rsrc-card"
 					    - "renesas,rsrc-card,lager"
 					    - "renesas,rsrc-card,koelsch"
 Optional properties:
@@ -29,6 +30,12 @@ Optional subnode properties:
 - frame-inversion			: bool property. Add this if the
 					  dai-link uses frame clock inversion.
 - convert-rate				: platform specified sampling rate convert
+- audio-prefix				: see audio-routing
+- audio-routing				: A list of the connections between audio components.
+					  Each entry is a pair of strings, the first being the connection's sink,
+					  the second being the connection's source. Valid names for sources.
+					  use audio-prefix if some components is using same sink/sources naming.
+					  it can be used if compatible was "renesas,rsrc-card";
 
 Required CPU/CODEC subnodes properties:
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 84e9357..d61db9c 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -41,6 +41,7 @@ static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
 static const struct of_device_id rsrc_card_of_match[] = {
 	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
+	{ .compatible = "renesas,rsrc-card", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
@@ -242,8 +243,15 @@ static int rsrc_card_parse_links(struct device_node *np,
 		snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
 
 		/* additional name prefix */
-		priv->codec_conf.of_node	= dai_link->codec_of_node;
-		priv->codec_conf.name_prefix	= of_data->prefix;
+		if (of_data) {
+			priv->codec_conf.of_node = dai_link->codec_of_node;
+			priv->codec_conf.name_prefix = of_data->prefix;
+		} else {
+			snd_soc_of_parse_audio_prefix(&priv->snd_card,
+						      &priv->codec_conf,
+						      dai_link->codec_of_node,
+						      "audio-prefix");
+		}
 
 		/* set dai_name */
 		snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
@@ -361,8 +369,14 @@ static int rsrc_card_parse_of(struct device_node *node,
 	priv->snd_card.num_links		= num;
 	priv->snd_card.codec_conf		= &priv->codec_conf;
 	priv->snd_card.num_configs		= 1;
-	priv->snd_card.of_dapm_routes		= of_data->routes;
-	priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+
+	if (of_data) {
+		priv->snd_card.of_dapm_routes		= of_data->routes;
+		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+	} else {
+		snd_soc_of_parse_audio_routing(&priv->snd_card,
+					       "audio-routing");
+	}
 
 	/* Parse the card name from DT */
 	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-- 
2.1.4

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

* Re: [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support
  2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
                   ` (34 preceding siblings ...)
  2015-07-15  7:18 ` [PATCH 35/35] ARM: shmobile: r8a7791: Add Audio MIX " Kuninori Morimoto
@ 2015-07-16 21:19 ` Mark Brown
  35 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:19 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, shiiba, Liam Girdwood, komatsu, kobayashi, Simon


[-- Attachment #1.1: Type: text/plain, Size: 605 bytes --]

On Wed, Jul 15, 2015 at 07:06:56AM +0000, Kuninori Morimoto wrote:

>  1) -  2) adds audio prefix support on DT which is needed on DPCM
>  3) - 29) cleanup/tidyup/workaround/prepare patches for CTU/MIX support
> 30) - 31) CTU/MIX support on driver
> 32) - 35) CTU/MIX support on SoC

*Please* don't submit such large patch serieses unless you really need
to, it's a lot to review at once.  It's best to split things up to
smaller sets to be easier to work with.  For example with this set it'd
be better to send the cleanups and tidyups first (ideally one kind of
cleanup at a time) then the new feature.

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

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Applied "ASoC: rsnd: tidyup SRC position on each code" to the asoc tree
  2015-07-15  7:16 ` [PATCH 28/35] ASoC: rsnd: tidyup SRC position on each code Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup SRC position on each code

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 78edead4494219640d9fdf37d76beae24f79de9e Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:16:37 +0000
Subject: [PATCH] ASoC: rsnd: tidyup SRC position on each code

This is cleanup for CTU/MIX support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/Makefile |  2 +-
 sound/soc/sh/rcar/core.c   |  8 ++++----
 sound/soc/sh/rcar/rsnd.h   | 38 +++++++++++++++++++-------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index f1b4451..3a274fd 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o src.o adg.o ssi.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 8919afa..e20d8ea 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -641,13 +641,13 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	 * using fixed path.
 	 */
 
-	/* SRC */
-	ret = rsnd_path_add(priv, io, src);
+	/* SSI */
+	ret = rsnd_path_add(priv, io, ssi);
 	if (ret < 0)
 		return ret;
 
-	/* SSI */
-	ret = rsnd_path_add(priv, io, ssi);
+	/* SRC */
+	ret = rsnd_path_add(priv, io, src);
 	if (ret < 0)
 		return ret;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 5f5b8b1..7fee207 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -441,12 +441,6 @@ struct rsnd_priv {
 	void *gen;
 
 	/*
-	 * below value will be filled on rsnd_src_probe()
-	 */
-	void *src;
-	int src_nr;
-
-	/*
 	 * below value will be filled on rsnd_adg_probe()
 	 */
 	void *adg;
@@ -463,6 +457,12 @@ struct rsnd_priv {
 	int ssi_nr;
 
 	/*
+	 * below value will be filled on rsnd_src_probe()
+	 */
+	void *src;
+	int src_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -535,6 +535,19 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
 		     u32 max);
 
 /*
+ *	R-Car SSI
+ */
+int rsnd_ssi_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+void rsnd_ssi_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
+int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
+int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
+int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
+
+/*
  *	R-Car SRC
  */
 int rsnd_src_probe(struct platform_device *pdev,
@@ -555,19 +568,6 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
 /*
- *	R-Car SSI
- */
-int rsnd_ssi_probe(struct platform_device *pdev,
-		   const struct rsnd_of_data *of_data,
-		   struct rsnd_priv *priv);
-void rsnd_ssi_remove(struct platform_device *pdev,
-		     struct rsnd_priv *priv);
-struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
-int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
-int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
-int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
-
-/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
2.1.4

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

* Applied "ASoC: rsnd: add rsnd_io_to_mod()" to the asoc tree
  2015-07-15  7:16 ` [PATCH 27/35] ASoC: rsnd: add rsnd_io_to_mod() Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_io_to_mod()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5cbbadd3d507eeb7711266e3932f4c427cbcbd61 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:16:19 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_io_to_mod()

Sometimes we would like to get each module directly, especially data path
searching. this patch adds rsnd_io_to_mod() macro, and existing
rsnd_io_to_mod_xxx() use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsnd.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 705e66f..5f5b8b1 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -348,9 +348,10 @@ struct rsnd_dai_stream {
 	int byte_per_period;
 	int next_period_byte;
 };
-#define rsnd_io_to_mod_ssi(io)	((io)->mod[RSND_MOD_SSI])
-#define rsnd_io_to_mod_src(io)	((io)->mod[RSND_MOD_SRC])
-#define rsnd_io_to_mod_dvc(io)	((io)->mod[RSND_MOD_DVC])
+#define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
+#define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
+#define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
+#define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
 #define rsnd_io_is_play(io)	(&rsnd_io_to_rdai(io)->playback == io)
-- 
2.1.4

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

* Applied "ASoC: rsnd: dma: add DMA name on .ops" to the asoc tree
  2015-07-15  7:16 ` [PATCH 26/35] ASoC: rsnd: dma: add DMA name on .ops Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: dma: add DMA name on .ops

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ddea1b2e83c379840aa54fadc587e418cf986ccb Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:16:03 +0000
Subject: [PATCH] ASoC: rsnd: dma: add DMA name on .ops

Current rsnd driver is using Audio DMAC (via DMAEngine) and
Audio DMAC peri peri (via original method), and usage of these DMAC
are different. Indicates its naming is useful for debugging.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dma.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 9431061..a175863 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -28,6 +28,7 @@ struct rsnd_dma_ctrl {
 };
 
 struct rsnd_dma_ops {
+	char *name;
 	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
 	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
 	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
@@ -190,7 +191,8 @@ static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
 	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
-	dev_dbg(dev, "dma : %pad -> %pad\n",
+	dev_dbg(dev, "%s %pad -> %pad\n",
+		dma->ops->name,
 		&cfg.src_addr, &cfg.dst_addr);
 
 	ret = dmaengine_slave_config(dmaen->chan, &cfg);
@@ -223,6 +225,7 @@ static void rsnd_dmaen_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
 }
 
 static struct rsnd_dma_ops rsnd_dmaen_ops = {
+	.name	= "audmac",
 	.start	= rsnd_dmaen_start,
 	.stop	= rsnd_dmaen_stop,
 	.init	= rsnd_dmaen_init,
@@ -368,6 +371,7 @@ static int rsnd_dmapp_init(struct rsnd_dai_stream *io,
 }
 
 static struct rsnd_dma_ops rsnd_dmapp_ops = {
+	.name	= "audmac-pp",
 	.start	= rsnd_dmapp_start,
 	.stop	= rsnd_dmapp_stop,
 	.init	= rsnd_dmapp_init,
@@ -580,6 +584,7 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 	struct rsnd_mod *mod_to;
 	struct rsnd_priv *priv = rsnd_io_to_priv(io);
 	struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
 	int is_play = rsnd_io_is_play(io);
 
 	/*
@@ -606,6 +611,11 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 	if (rsnd_is_gen1(priv))
 		dma->ops = &rsnd_dmaen_ops;
 
+	dev_dbg(dev, "%s %s[%d] -> %s[%d]\n",
+		dma->ops->name,
+		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
+		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
+
 	return dma->ops->init(io, dma, id, mod_from, mod_to);
 }
 
-- 
2.1.4

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

* Applied "ASoC: rsnd: check the Gen1 at the beginning of DVC probe" to the asoc tree
  2015-07-15  7:15 ` [PATCH 25/35] ASoC: rsnd: check the Gen1 at the beginning of DVC probe Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: check the Gen1 at the beginning of DVC probe

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9469b8b6092d347ef8a5fa9d2d7dde4c857a0994 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:15:47 +0000
Subject: [PATCH] ASoC: rsnd: check the Gen1 at the beginning of DVC probe

DVC doesn't support Gen1, check it beginning of probe

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dvc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index d06e4ee..5779638 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -332,18 +332,18 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr, ret;
 
-	rsnd_of_parse_dvc(pdev, of_data, priv);
-
-	nr = info->dvc_info_nr;
-	if (!nr)
-		return 0;
-
 	/* This driver doesn't support Gen1 at this point */
 	if (rsnd_is_gen1(priv)) {
 		dev_warn(dev, "CMD is not supported on Gen1\n");
 		return -EINVAL;
 	}
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
+	nr = info->dvc_info_nr;
+	if (!nr)
+		return 0;
+
 	dvc	= devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
 	if (!dvc)
 		return -ENOMEM;
-- 
2.1.4

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

* Applied "ASoC: rsnd: tidyup rsnd_dma_ops definition place" to the asoc tree
  2015-07-15  7:15 ` [PATCH 24/35] ASoC: rsnd: tidyup rsnd_dma_ops definition place Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup rsnd_dma_ops definition place

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 98d358af07aa6fc4cd6cdfd3256ab792eb3675cd Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:15:27 +0000
Subject: [PATCH] ASoC: rsnd: tidyup rsnd_dma_ops definition place

rsnd_dma_ops is used only from dma.c, rsnd.h doesn't need it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dma.c  | 8 ++++++++
 sound/soc/sh/rcar/rsnd.h | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index d306e29..9431061 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -27,6 +27,14 @@ struct rsnd_dma_ctrl {
 	int dmapp_num;
 };
 
+struct rsnd_dma_ops {
+	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
+		    struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
+	void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
+};
+
 #define rsnd_priv_to_dmac(p)	((struct rsnd_dma_ctrl *)(p)->dma)
 
 /*
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 6c10a8b..705e66f 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -181,13 +181,6 @@ void rsnd_path_parse(struct rsnd_priv *priv,
  *	R-Car DMA
  */
 struct rsnd_dma;
-struct rsnd_dma_ops {
-	void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-	void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-	int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
-		    struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
-	void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-};
 
 struct rsnd_dmaen {
 	struct dma_chan		*chan;
-- 
2.1.4

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

* Applied "ASoC: rsnd: show debug message for SSI/SRC/DVC connection" to the asoc tree
  2015-07-15  7:15 ` [PATCH 23/35] ASoC: rsnd: show debug message for SSI/SRC/DVC connection Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: show debug message for SSI/SRC/DVC connection

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 84e95355602c59865be8a3bd18cd2f0b3863b4cb Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:15:10 +0000
Subject: [PATCH] ASoC: rsnd: show debug message for SSI/SRC/DVC connection

It can help for connection debug

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0f9323f..8919afa 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -332,11 +332,18 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 static int rsnd_dai_connect(struct rsnd_mod *mod,
 			    struct rsnd_dai_stream *io)
 {
+	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct device *dev = rsnd_priv_to_dev(priv);
+
 	if (!mod)
 		return -EIO;
 
 	io->mod[mod->type] = mod;
 
+	dev_dbg(dev, "%s[%d] is connected to io (%s)\n",
+		rsnd_mod_name(mod), rsnd_mod_id(mod),
+		rsnd_io_is_play(io) ? "Playback" : "Capture");
+
 	return 0;
 }
 
-- 
2.1.4

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

* Applied "ASoC: rsnd: tidyup data align position" to the asoc tree
  2015-07-15  7:14 ` [PATCH 22/35] ASoC: rsnd: tidyup data align position Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup data align position

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4689032b11d1af10e5eb755eb575f9761a455a72 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:14:47 +0000
Subject: [PATCH] ASoC: rsnd: tidyup data align position

Sound L/R order of SSI is different from Linux sound data order.
So current rsnd driver is using DALIGN (= data align) to exchange data
align on SSIU. OTOH, CMD/SRC/SSIU have DALIGN register. Now inverted
sound volume will be exchanged if user used volume control on DVC.
Because SSIU which exchanges data align is located after DVC.

	MEM -> SRC -> DVC -> SSI

This patch exchanges data align SRC if possible

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 36 ++++++++++++++++++++++++++++++++++++
 sound/soc/sh/rcar/gen.c  |  1 +
 sound/soc/sh/rcar/rsnd.h |  3 +++
 sound/soc/sh/rcar/src.c  | 20 +++++---------------
 4 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index a3637b9..0f9323f 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -249,6 +249,42 @@ u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 
 	return chan;
 }
+
+/*
+ *	DALIGN function
+ */
+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
+	struct rsnd_mod *target = src ? src : ssi;
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	u32 val = 0x76543210;
+	u32 mask = ~0;
+
+	mask <<= runtime->channels * 4;
+	val = val & mask;
+
+	switch (runtime->sample_bits) {
+	case 16:
+		val |= 0x67452301 & ~mask;
+		break;
+	case 32:
+		val |= 0x76543210 & ~mask;
+		break;
+	}
+
+	/*
+	 * exchange channeles on SRC if possible,
+	 * otherwise, R/L volume settings on DVC
+	 * changes inverted channels
+	 */
+	if (mod == target)
+		return val;
+	else
+		return 0x76543210;
+}
+
 /*
  *	rsnd_dai functions
  */
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 5d3592df..a2d5df4 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -222,6 +222,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 	};
 	struct rsnd_regmap_field_conf conf_scu[] = {
 		RSND_GEN_M_REG(SRC_BUSIF_MODE,	0x0,	0x20),
+		RSND_GEN_M_REG(SRC_BUSIF_DALIGN,0x8,	0x20),
 		RSND_GEN_M_REG(SRC_ROUTE_MODE0,	0xc,	0x20),
 		RSND_GEN_M_REG(SRC_CTRL,	0x10,	0x20),
 		RSND_GEN_M_REG(SRC_INT_ENABLE0,	0x18,	0x20),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 1296b35..6c10a8b 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -99,6 +99,7 @@ enum rsnd_reg {
 	RSND_REG_SHARE26,
 	RSND_REG_SHARE27,
 	RSND_REG_SHARE28,
+	RSND_REG_SHARE29,
 
 	RSND_REG_MAX,
 };
@@ -143,6 +144,7 @@ enum rsnd_reg {
 #define RSND_REG_SCU_SYS_STATUS1	RSND_REG_SHARE26
 #define RSND_REG_SCU_SYS_INT_EN1	RSND_REG_SHARE27
 #define RSND_REG_SRC_INT_ENABLE0	RSND_REG_SHARE28
+#define RSND_REG_SRC_BUSIF_DALIGN	RSND_REG_SHARE29
 
 struct rsnd_of_data;
 struct rsnd_priv;
@@ -171,6 +173,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index c45da61..89a18e1 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -148,7 +148,6 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 			int use_busif)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
@@ -185,27 +184,14 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 	 * DMA settings for SSIU
 	 */
 	if (use_busif) {
-		u32 val = 0x76543210;
-		u32 mask = ~0;
+		u32 val = rsnd_get_dalign(ssi_mod, io);
 
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
 			       rsnd_get_adinr_bit(ssi_mod, io));
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
 		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
 
-		mask <<= runtime->channels * 4;
-		val = val & mask;
-
-		switch (runtime->sample_bits) {
-		case 16:
-			val |= 0x67452301 & ~mask;
-			break;
-		case 32:
-			val |= 0x76543210 & ~mask;
-			break;
-		}
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_DALIGN, val);
-
 	}
 
 	return 0;
@@ -678,6 +664,10 @@ static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 	u32 val;
 
+	val = rsnd_get_dalign(mod, io);
+
+	rsnd_mod_write(mod, SRC_BUSIF_DALIGN, val);
+
 	/*
 	 * WORKAROUND
 	 *
-- 
2.1.4

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

* Applied "ASoC: rsnd: add rsnd_get_adinr_chan()" to the asoc tree
  2015-07-15  7:14 ` [PATCH 21/35] ASoC: rsnd: add rsnd_get_adinr_chan() Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_get_adinr_chan()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From bfe1360d79210f9c1d330a07c26a8d5cb202159d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:14:29 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_get_adinr_chan()

Current rsnd driver has rsnd_get_adinr_bit() to get bit settings for
ADINR (= Audio Information Register) of SSIU/SRC/DVC.
This patch adds rsnd_get_adinr_chan() to get channel settings for
ADINR (= Audio Information Register) of CTU/MIX.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0ca6d02..a3637b9 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -227,6 +227,28 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	return adinr;
 }
 
+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+{
+	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	u32 chan = runtime->channels;
+
+	switch (chan) {
+	case 1:
+	case 2:
+	case 4:
+	case 6:
+	case 8:
+		break;
+	default:
+		dev_warn(dev, "not supported channel\n");
+		chan = 0;
+		break;
+	}
+
+	return chan;
+}
 /*
  *	rsnd_dai functions
  */
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 224a4a9..1296b35 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -170,6 +170,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
-- 
2.1.4

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

* Applied "ASoC: rsnd: tidyup ADINR function name" to the asoc tree
  2015-07-15  7:14 ` [PATCH 20/35] ASoC: rsnd: tidyup ADINR function name Kuninori Morimoto
@ 2015-07-16 21:29   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:29 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup ADINR function name

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3023b384d0c9da49028131b91fe64b24b5b84e6d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:14:05 +0000
Subject: [PATCH] ASoC: rsnd: tidyup ADINR function name

Renesas sound IP (= SSIU/SRC/CTU/MIX/DVC) have ADINR
(= Audio Information Register), but some of them (= SSIU/SRC/DVC)
are for audio data bits, some of them (= CTU/MIX) are for audio data
channels.
Current rsnd driver is supporting SSIU/SRC/DVC, and these ADINR were
for bits. This patch rename rsnd_get_adinr() to rsnd_get_adinr_bit(),
and we will have rsnd_get_adinr_chan() for CTU/MIX.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 4 ++--
 sound/soc/sh/rcar/dvc.c  | 2 +-
 sound/soc/sh/rcar/rsnd.h | 2 +-
 sound/soc/sh/rcar/src.c  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index cb82067..0ca6d02 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -203,9 +203,9 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 }
 
 /*
- *	settting function
+ *	ADINR function
  */
-u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 {
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 343d446..d06e4ee 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -161,7 +161,7 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
 
 	rsnd_path_parse(priv, io);
 
-	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
+	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr_bit(mod, io));
 
 	/* ch0/ch1 Volume */
 	rsnd_dvc_volume_update(io, mod);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 6a87757..224a4a9 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -169,7 +169,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 		enum rsnd_reg reg, u32 data);
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
-u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index b3d965e..c45da61 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
 		u32 mask = ~0;
 
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
-			       rsnd_get_adinr(ssi_mod, io));
+			       rsnd_get_adinr_bit(ssi_mod, io));
 		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
 		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
 
@@ -309,7 +309,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
 		fsrate = 0x0400000 / convert_rate * runtime->rate;
 
 	/* Set channel number and output bit length */
-	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
+	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr_bit(mod, io));
 
 	/* Enable the initial value of IFS */
 	if (fsrate) {
-- 
2.1.4

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

* Applied "ASoC: rsnd: add rsnd_src_initialize_lock/unlock()" to the asoc tree
  2015-07-15  7:13 ` [PATCH 19/35] ASoC: rsnd: add rsnd_src_initialize_lock/unlock() Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_src_initialize_lock/unlock()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d1ade514e84ea55cba999edb04cb88daa4da94b8 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:13:47 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_src_initialize_lock/unlock()

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxIR (Initialization Register) is one
of them. These xxxIR need be set to 1 during initialization.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_initialize_lock/unlock() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/src.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 74ab644..b3d965e 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -124,6 +124,14 @@ static void rsnd_src_soft_reset(struct rsnd_mod *mod)
 	rsnd_mod_write(mod, SRC_SWRSR, 1);
 }
 
+
+#define rsnd_src_initialize_lock(mod)	__rsnd_src_initialize_lock(mod, 1)
+#define rsnd_src_initialize_unlock(mod)	__rsnd_src_initialize_lock(mod, 0)
+static void __rsnd_src_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, SRC_SRCIR, enable);
+}
+
 static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
 					 struct rsnd_mod *mod)
 {
@@ -362,17 +370,13 @@ static int rsnd_src_init(struct rsnd_mod *mod,
 
 	rsnd_src_soft_reset(mod);
 
+	rsnd_src_initialize_lock(mod);
+
 	src->err = 0;
 
 	/* reset sync convert_rate */
 	src->sync.val = 0;
 
-	/*
-	 * Initialize the operation of the SRC internal circuits
-	 * see rsnd_src_start()
-	 */
-	rsnd_mod_write(mod, SRC_SRCIR, 1);
-
 	return 0;
 }
 
@@ -399,11 +403,7 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
 
 static int rsnd_src_start(struct rsnd_mod *mod)
 {
-	/*
-	 * Cancel the initialization and operate the SRC function
-	 * see rsnd_src_init()
-	 */
-	rsnd_mod_write(mod, SRC_SRCIR, 0);
+	rsnd_src_initialize_unlock(mod);
 
 	return 0;
 }
-- 
2.1.4

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

* Applied "ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()" to the asoc tree
  2015-07-15  7:13 ` [PATCH 18/35] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock() Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 3bb3d363e50d371289f0bd63b48da771ea807c02 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:13:29 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxIR (Initialization Register) is one
of them. These xxxIR need be set to 1 during initialization.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_dvc_initialize_lock/unlock() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dvc.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 9392507..343d446 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -70,6 +70,13 @@ static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
 	rsnd_mod_write(mod, DVC_SWRSR, 1);
 }
 
+#define rsnd_dvc_initialize_lock(mod)	__rsnd_dvc_initialize_lock(mod, 1)
+#define rsnd_dvc_initialize_unlock(mod)	__rsnd_dvc_initialize_lock(mod, 0)
+static void __rsnd_dvc_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, DVC_DVUIR, enable);
+}
+
 static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
 				   struct rsnd_mod *mod)
 {
@@ -150,17 +157,15 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
 
 	rsnd_dvc_soft_reset(mod);
 
-	rsnd_path_parse(priv, io);
+	rsnd_dvc_initialize_lock(mod);
 
-	rsnd_mod_write(mod, DVC_DVUIR, 1);
+	rsnd_path_parse(priv, io);
 
 	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
 
 	/* ch0/ch1 Volume */
 	rsnd_dvc_volume_update(io, mod);
 
-	rsnd_mod_write(mod, DVC_DVUIR, 0);
-
 	rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
 	return 0;
@@ -179,6 +184,8 @@ static int rsnd_dvc_start(struct rsnd_mod *mod,
 			  struct rsnd_dai_stream *io,
 			  struct rsnd_priv *priv)
 {
+	rsnd_dvc_initialize_unlock(mod);
+
 	rsnd_mod_write(mod, CMD_CTRL, 0x10);
 
 	return 0;
-- 
2.1.4

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

* Applied "ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting" to the asoc tree
  2015-07-15  7:13 ` [PATCH 17/35] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From e2c08416196bd10a6575057fdd1347a307ce3a15 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:13:10 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route
 setting

Current sound data route settings is done in dvc.c, and it doesn't care
about CTU/MIX at this poinnt, but we need to care about these.
OTOH, rsnd driver already has rsnd_path_xxx() functions for data path which
are good match for CTU/MIX/DVC path selectio.
This patch adds new rsnd_path_parse() to select sound data route which will
care about CTU/MIX/DVC path.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
 sound/soc/sh/rcar/dvc.c  | 40 +++++++++-------------------------------
 sound/soc/sh/rcar/rsnd.h |  2 ++
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 93fed50..cb82067 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -537,6 +537,28 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	}							\
 }
 
+void rsnd_path_parse(struct rsnd_priv *priv,
+		     struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
+	int src_id = rsnd_mod_id(src);
+	u32 path[] = {
+		[0] = 0x30000,
+		[1] = 0x30001,
+		[2] = 0x40000,
+		[3] = 0x10000,
+		[4] = 0x20000,
+		[5] = 0x40100
+	};
+
+	/* Gen1 is not supported */
+	if (rsnd_is_gen1(priv))
+		return;
+
+	rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
+}
+
 static int rsnd_path_init(struct rsnd_priv *priv,
 			  struct rsnd_dai *rdai,
 			  struct rsnd_dai_stream *io)
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 24d0763..9392507 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -142,48 +142,26 @@ static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
 	return 0;
 }
 
-static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
+static int rsnd_dvc_init(struct rsnd_mod *mod,
 			 struct rsnd_dai_stream *io,
 			 struct rsnd_priv *priv)
 {
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
-	struct device *dev = rsnd_priv_to_dev(priv);
-	int dvc_id = rsnd_mod_id(dvc_mod);
-	int src_id = rsnd_mod_id(src_mod);
-	u32 route[] = {
-		[0] = 0x30000,
-		[1] = 0x30001,
-		[2] = 0x40000,
-		[3] = 0x10000,
-		[4] = 0x20000,
-		[5] = 0x40100
-	};
-
-	if (src_id >= ARRAY_SIZE(route)) {
-		dev_err(dev, "DVC%d isn't connected to SRC%d\n", dvc_id, src_id);
-		return -EINVAL;
-	}
-
-	rsnd_mod_hw_start(dvc_mod);
+	rsnd_mod_hw_start(mod);
 
-	rsnd_dvc_soft_reset(dvc_mod);
+	rsnd_dvc_soft_reset(mod);
 
-	/*
-	 * fixme
-	 * it doesn't support CTU/MIX
-	 */
-	rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
+	rsnd_path_parse(priv, io);
 
-	rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
+	rsnd_mod_write(mod, DVC_DVUIR, 1);
 
-	rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
+	rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
 
 	/* ch0/ch1 Volume */
-	rsnd_dvc_volume_update(io, dvc_mod);
+	rsnd_dvc_volume_update(io, mod);
 
-	rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
+	rsnd_mod_write(mod, DVC_DVUIR, 0);
 
-	rsnd_adg_set_cmd_timsel_gen2(dvc_mod, io);
+	rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
 	return 0;
 }
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c8d2029..6a87757 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -170,6 +170,8 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
 void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
 		    u32 mask, u32 data);
 u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
+void rsnd_path_parse(struct rsnd_priv *priv,
+		     struct rsnd_dai_stream *io);
 
 /*
  *	R-Car DMA
-- 
2.1.4

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

* Applied "ASoC: rsnd: rename rsnd_path_parse/break() into add/remove" to the asoc tree
  2015-07-15  7:12 ` [PATCH 16/35] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: rename rsnd_path_parse/break() into add/remove

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c8cf15f64f8ddb3169987c2f26df3341b8556296 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:12:52 +0000
Subject: [PATCH] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove

parse/break is a little ambiguous/confusable name for rsnd module path.
Especially for CTU/MIX support. It was renamed to add/remove

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index ff4f15a..93fed50 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -507,7 +507,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	.set_fmt	= rsnd_soc_dai_set_fmt,
 };
 
-#define rsnd_path_parse(priv, io, type)				\
+#define rsnd_path_add(priv, io, type)				\
 ({								\
 	struct rsnd_mod *mod;					\
 	int ret = 0;						\
@@ -523,7 +523,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	ret;							\
 })
 
-#define rsnd_path_break(priv, io, type)				\
+#define rsnd_path_remove(priv, io, type)			\
 {								\
 	struct rsnd_mod *mod;					\
 	int id = -1;						\
@@ -555,17 +555,17 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	 */
 
 	/* SRC */
-	ret = rsnd_path_parse(priv, io, src);
+	ret = rsnd_path_add(priv, io, src);
 	if (ret < 0)
 		return ret;
 
 	/* SSI */
-	ret = rsnd_path_parse(priv, io, ssi);
+	ret = rsnd_path_add(priv, io, ssi);
 	if (ret < 0)
 		return ret;
 
 	/* DVC */
-	ret = rsnd_path_parse(priv, io, dvc);
+	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
 		return ret;
 
@@ -1023,8 +1023,8 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
 		/*
 		 * remove SRC/DVC from DAI,
 		 */
-		rsnd_path_break(priv, io, src);
-		rsnd_path_break(priv, io, dvc);
+		rsnd_path_remove(priv, io, src);
+		rsnd_path_remove(priv, io, dvc);
 
 		/*
 		 * fallback
-- 
2.1.4

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

* Applied "ASoC: rsnd: enable module multi connection" to the asoc tree
  2015-07-15  7:12 ` [PATCH 15/35] ASoC: rsnd: enable module multi connection Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: enable module multi connection

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d6f8d5b4422a5a391c02df97af9ef7da5a929d71 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:12:36 +0000
Subject: [PATCH] ASoC: rsnd: enable module multi connection

'8a4e379b54f8("ASoC: rsnd: remove io from rsnd_mod")' removed mod/io
relationship. rsnd_dai_connect() mod/io check is no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index d44bfb7..ff4f15a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -277,16 +277,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
 	if (!mod)
 		return -EIO;
 
-	if (io->mod[mod->type]) {
-		struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-		struct device *dev = rsnd_priv_to_dev(priv);
-
-		dev_err(dev, "%s[%d] is not empty\n",
-			rsnd_mod_name(mod),
-			rsnd_mod_id(mod));
-		return -EIO;
-	}
-
 	io->mod[mod->type] = mod;
 
 	return 0;
-- 
2.1.4

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

* Applied "ASoC: rsnd: src: make sure SRC soft reset" to the asoc tree
  2015-07-15  7:12 ` [PATCH 14/35] ASoC: rsnd: src: make sure SRC soft reset Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: src: make sure SRC soft reset

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 379febfd2e30ec8db5baccd9f9403bf650c6afa1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:12:18 +0000
Subject: [PATCH] ASoC: rsnd: src: make sure SRC soft reset

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxRSR (Software reset Register) is one
of them. These xxxRSR need be set to 1 to 0 when software reset.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_src_soft_reset() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/src.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 0b06ac8..74ab644 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -118,6 +118,12 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
+static void rsnd_src_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, SRC_SWRSR, 0);
+	rsnd_mod_write(mod, SRC_SWRSR, 1);
+}
+
 static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
 					 struct rsnd_mod *mod)
 {
@@ -294,10 +300,6 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
 	if (convert_rate)
 		fsrate = 0x0400000 / convert_rate * runtime->rate;
 
-	/* set/clear soft reset */
-	rsnd_mod_write(mod, SRC_SWRSR, 0);
-	rsnd_mod_write(mod, SRC_SWRSR, 1);
-
 	/* Set channel number and output bit length */
 	rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
 
@@ -358,6 +360,8 @@ static int rsnd_src_init(struct rsnd_mod *mod,
 
 	rsnd_mod_hw_start(mod);
 
+	rsnd_src_soft_reset(mod);
+
 	src->err = 0;
 
 	/* reset sync convert_rate */
-- 
2.1.4

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

* Applied "ASoC: rsnd: dvc: make sure DVC soft reset" to the asoc tree
  2015-07-15  7:12 ` [PATCH 13/35] ASoC: rsnd: dvc: make sure DVC soft reset Kuninori Morimoto
@ 2015-07-16 21:30   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-16 21:30 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: dvc: make sure DVC soft reset

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 636e4bad5cca947839c09d3e13ad6feeb7fa45da Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:12:00 +0000
Subject: [PATCH] ASoC: rsnd: dvc: make sure DVC soft reset

Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
and these have similar register. xxxRSR (Software reset Register) is one
of them. These xxxRSR need be set to 1 to 0 when software reset.
Current rsnd driver has src.c / dvc.c, and we will have mix.c.
It is readable if these have same named function.
This patch adds rsnd_dvc_soft_reset() and make sure it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dvc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 8a61aa3..24d0763 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -64,6 +64,12 @@ static const char * const dvc_ramp_rate[] = {
 	"0.125 dB/8192 steps",	 /* 10111 */
 };
 
+static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, DVC_SWRSR, 0);
+	rsnd_mod_write(mod, DVC_SWRSR, 1);
+}
+
 static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
 				   struct rsnd_mod *mod)
 {
@@ -160,15 +166,14 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
 
 	rsnd_mod_hw_start(dvc_mod);
 
+	rsnd_dvc_soft_reset(dvc_mod);
+
 	/*
 	 * fixme
 	 * it doesn't support CTU/MIX
 	 */
 	rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
 
-	rsnd_mod_write(dvc_mod, DVC_SWRSR, 0);
-	rsnd_mod_write(dvc_mod, DVC_SWRSR, 1);
-
 	rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
 
 	rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
-- 
2.1.4

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

* Applied "ASoC: rsnd: add MIX (Mixer) support" to the asoc tree
  2015-07-15  7:17 ` [PATCH 31/35] ASoC: rsnd: add MIX (Mixer) support Kuninori Morimoto
@ 2015-07-17 18:26   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-17 18:26 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add MIX (Mixer) support

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 70fb10529f61c31c26397a02091177bedd23217d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:17:36 +0000
Subject: [PATCH] ASoC: rsnd: add MIX (Mixer) support

This patch adds MIX (Mixer) initial support for rsnd driver.
It is assuming that this MIX is used via DPCM.

This is sample code for playback.

	CPU0  : [MEM] -> [SRC1] -> [CTU02] -+
					    |
					    +-> [MIX0] -> [DVC0] -> [SSI0]
	                                    |
	CPU1  : [MEM] -> [SRC2] -> [CTU03] -+

	sound {
		compatible = "renesas,rsrc-card";

		...

		cpu@0 {
			sound-dai = <&rcar_sound 0>;
		};

		cpu@1 {
			sound-dai = <&rcar_sound 1>;
		};

		codec {
			...
		};
	};

	rcar_sound {

		...

		rcar_sound,dai {
			dai0 {
				playback = <&src1 &ctu02 &mix0 &dvc0 &ssi0>;
			};
			dai1 {
				playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;
			};
		};
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |   8 +
 include/sound/rcar_snd.h                           |   7 +
 sound/soc/sh/rcar/Makefile                         |   2 +-
 sound/soc/sh/rcar/core.c                           |  85 +++++++--
 sound/soc/sh/rcar/dma.c                            |   5 +
 sound/soc/sh/rcar/gen.c                            |  10 ++
 sound/soc/sh/rcar/mix.c                            | 200 +++++++++++++++++++++
 sound/soc/sh/rcar/rsnd.h                           |  29 +++
 8 files changed, 333 insertions(+), 13 deletions(-)
 create mode 100644 sound/soc/sh/rcar/mix.c

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 278607de05de..1173395b5e5c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,9 @@ Required properties:
 - rcar_sound,ctu		: Should contain CTU feature.
 				  The number of CTU subnode should be same as HW.
 				  see below for detail.
+- rcar_sound,mix		: Should contain MIX feature.
+				  The number of MIX subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dvc		: Should contain DVC feature.
 				  The number of DVC subnode should be same as HW.
 				  see below for detail.
@@ -93,6 +96,11 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 
+	rcar_sound,mix {
+		mix0: mix@0 { };
+		mix1: mix@1 { };
+	};
+
 	rcar_sound,ctu {
 		ctu00: ctu@0 { };
 		ctu01: ctu@1 { };
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 8f9303093ab9..bb7b2ebfee7b 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -65,6 +65,10 @@ struct rsnd_ctu_platform_info {
 	u32 flags;
 };
 
+struct rsnd_mix_platform_info {
+	u32 flags;
+};
+
 struct rsnd_dvc_platform_info {
 	u32 flags;
 };
@@ -73,6 +77,7 @@ struct rsnd_dai_path_info {
 	struct rsnd_ssi_platform_info *ssi;
 	struct rsnd_src_platform_info *src;
 	struct rsnd_ctu_platform_info *ctu;
+	struct rsnd_mix_platform_info *mix;
 	struct rsnd_dvc_platform_info *dvc;
 };
 
@@ -100,6 +105,8 @@ struct rcar_snd_info {
 	int src_info_nr;
 	struct rsnd_ctu_platform_info *ctu_info;
 	int ctu_info_nr;
+	struct rsnd_mix_platform_info *mix_info;
+	int mix_info_nr;
 	struct rsnd_dvc_platform_info *dvc_info;
 	int dvc_info_nr;
 	struct rsnd_dai_platform_info *dai_info;
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index 7c4730a81c4a..8b258501aa35 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o mix.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 63ae7bbfd1dc..927a7b02123b 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -605,23 +605,74 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 void rsnd_path_parse(struct rsnd_priv *priv,
 		     struct rsnd_dai_stream *io)
 {
-	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-	int src_id = rsnd_mod_id(src);
-	u32 path[] = {
-		[0] = 0x30000,
-		[1] = 0x30001,
-		[2] = 0x40000,
-		[3] = 0x10000,
-		[4] = 0x20000,
-		[5] = 0x40100
-	};
+	struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
+	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *cmd;
+	struct device *dev = rsnd_priv_to_dev(priv);
+	u32 data;
 
 	/* Gen1 is not supported */
 	if (rsnd_is_gen1(priv))
 		return;
 
-	rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
+	if (!mix && !dvc)
+		return;
+
+	if (mix) {
+		struct rsnd_dai *rdai;
+		int i;
+		u32 path[] = {
+			[0] = 0,
+			[1] = 1 << 0,
+			[2] = 0,
+			[3] = 0,
+			[4] = 0,
+			[5] = 1 << 8
+		};
+
+		/*
+		 * it is assuming that integrater is well understanding about
+		 * data path. Here doesn't check impossible connection,
+		 * like src2 + src5
+		 */
+		data = 0;
+		for_each_rsnd_dai(rdai, priv, i) {
+			io = &rdai->playback;
+			if (mix == rsnd_io_to_mod_mix(io))
+				data |= path[rsnd_mod_id(src)];
+
+			io = &rdai->capture;
+			if (mix == rsnd_io_to_mod_mix(io))
+				data |= path[rsnd_mod_id(src)];
+		}
+
+		/*
+		 * We can't use ctu = rsnd_io_ctu() here.
+		 * Since, ID of dvc/mix are 0 or 1 (= same as CMD number)
+		 * but ctu IDs are 0 - 7 (= CTU00 - CTU13)
+		 */
+		cmd = mix;
+	} else {
+		u32 path[] = {
+			[0] = 0x30000,
+			[1] = 0x30001,
+			[2] = 0x40000,
+			[3] = 0x10000,
+			[4] = 0x20000,
+			[5] = 0x40100
+		};
+
+		data = path[rsnd_mod_id(src)];
+
+		cmd = dvc;
+	}
+
+	dev_dbg(dev, "ctu/mix path = 0x%08x", data);
+
+	rsnd_mod_write(cmd, CMD_ROUTE_SLCT, data);
+
+	rsnd_mod_write(cmd, CMD_CTRL, 0x10);
 }
 
 static int rsnd_path_init(struct rsnd_priv *priv,
@@ -656,6 +707,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	if (ret < 0)
 		return ret;
 
+	/* MIX */
+	ret = rsnd_path_add(priv, io, mix);
+	if (ret < 0)
+		return ret;
+
 	/* DVC */
 	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
@@ -672,13 +728,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	struct device_node *ssi_node,	*ssi_np;
 	struct device_node *src_node,	*src_np;
 	struct device_node *ctu_node,	*ctu_np;
+	struct device_node *mix_node,	*mix_np;
 	struct device_node *dvc_node,	*dvc_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_platform_info *dai_info;
 	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
 	struct device *dev = &pdev->dev;
 	int nr, i;
-	int dai_i, ssi_i, src_i, ctu_i, dvc_i;
+	int dai_i, ssi_i, src_i, ctu_i, mix_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -705,6 +762,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
 	src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
 	ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
+	mix_node = of_get_child_by_name(dev->of_node, "rcar_sound,mix");
 	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
@@ -742,6 +800,7 @@ if (name##_node) {							\
 			mod_parse(ssi);
 			mod_parse(src);
 			mod_parse(ctu);
+			mod_parse(mix);
 			mod_parse(dvc);
 
 			of_node_put(playback);
@@ -1155,6 +1214,7 @@ static int rsnd_probe(struct platform_device *pdev)
 		rsnd_ssi_probe,
 		rsnd_src_probe,
 		rsnd_ctu_probe,
+		rsnd_mix_probe,
 		rsnd_dvc_probe,
 		rsnd_adg_probe,
 		rsnd_dai_probe,
@@ -1251,6 +1311,7 @@ static int rsnd_remove(struct platform_device *pdev)
 		rsnd_ssi_remove,
 		rsnd_src_remove,
 		rsnd_ctu_remove,
+		rsnd_mix_remove,
 		rsnd_dvc_remove,
 	};
 	int ret = 0, i;
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 229b68d2cf70..305b12929853 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -427,6 +427,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
 	int use_src = !!rsnd_io_to_mod_src(io);
 	int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
+		      !!rsnd_io_to_mod_mix(io) ||
 		      !!rsnd_io_to_mod_ctu(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
@@ -506,6 +507,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
+	struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
 	struct rsnd_mod *mod_start, *mod_end;
@@ -548,6 +550,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 		} else if (ctu) {
 			mod[i] = ctu;
 			ctu = NULL;
+		} else if (mix) {
+			mod[i] = mix;
+			mix = NULL;
 		} else if (dvc) {
 			mod[i] = dvc;
 			dvc = NULL;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 41b75cd4e09b..f04d17bc6e3d 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -242,6 +242,16 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SRC_BSISR,	0x238,	0x40),
 		RSND_GEN_M_REG(CTU_CTUIR,	0x504,	0x100),
 		RSND_GEN_M_REG(CTU_ADINR,	0x508,	0x100),
+		RSND_GEN_M_REG(MIX_SWRSR,	0xd00,	0x40),
+		RSND_GEN_M_REG(MIX_MIXIR,	0xd04,	0x40),
+		RSND_GEN_M_REG(MIX_ADINR,	0xd08,	0x40),
+		RSND_GEN_M_REG(MIX_MIXMR,	0xd10,	0x40),
+		RSND_GEN_M_REG(MIX_MVPDR,	0xd14,	0x40),
+		RSND_GEN_M_REG(MIX_MDBAR,	0xd18,	0x40),
+		RSND_GEN_M_REG(MIX_MDBBR,	0xd1c,	0x40),
+		RSND_GEN_M_REG(MIX_MDBCR,	0xd20,	0x40),
+		RSND_GEN_M_REG(MIX_MDBDR,	0xd24,	0x40),
+		RSND_GEN_M_REG(MIX_MDBER,	0xd28,	0x40),
 		RSND_GEN_M_REG(DVC_SWRSR,	0xe00,	0x100),
 		RSND_GEN_M_REG(DVC_DVUIR,	0xe04,	0x100),
 		RSND_GEN_M_REG(DVC_ADINR,	0xe08,	0x100),
diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c
new file mode 100644
index 000000000000..0d5c102db6f5
--- /dev/null
+++ b/sound/soc/sh/rcar/mix.c
@@ -0,0 +1,200 @@
+/*
+ * mix.c
+ *
+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include "rsnd.h"
+
+#define MIX_NAME_SIZE	16
+#define MIX_NAME "mix"
+
+struct rsnd_mix {
+	struct rsnd_mix_platform_info *info; /* rcar_snd.h */
+	struct rsnd_mod mod;
+};
+
+#define rsnd_mix_nr(priv) ((priv)->mix_nr)
+#define for_each_rsnd_mix(pos, priv, i)					\
+	for ((i) = 0;							\
+	     ((i) < rsnd_mix_nr(priv)) &&				\
+		     ((pos) = (struct rsnd_mix *)(priv)->mix + i);	\
+	     i++)
+
+
+static void rsnd_mix_soft_reset(struct rsnd_mod *mod)
+{
+	rsnd_mod_write(mod, MIX_SWRSR, 0);
+	rsnd_mod_write(mod, MIX_SWRSR, 1);
+}
+
+#define rsnd_mix_initialize_lock(mod)	__rsnd_mix_initialize_lock(mod, 1)
+#define rsnd_mix_initialize_unlock(mod)	__rsnd_mix_initialize_lock(mod, 0)
+static void __rsnd_mix_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, MIX_MIXIR, enable);
+}
+
+static void rsnd_mix_volume_update(struct rsnd_dai_stream *io,
+				  struct rsnd_mod *mod)
+{
+
+	/* Disable MIX dB setting */
+	rsnd_mod_write(mod, MIX_MDBER, 0);
+
+	rsnd_mod_write(mod, MIX_MDBAR, 0);
+	rsnd_mod_write(mod, MIX_MDBBR, 0);
+	rsnd_mod_write(mod, MIX_MDBCR, 0);
+	rsnd_mod_write(mod, MIX_MDBDR, 0);
+
+	/* Enable MIX dB setting */
+	rsnd_mod_write(mod, MIX_MDBER, 1);
+}
+
+static int rsnd_mix_init(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_start(mod);
+
+	rsnd_mix_soft_reset(mod);
+
+	rsnd_mix_initialize_lock(mod);
+
+	rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io));
+
+	rsnd_path_parse(priv, io);
+
+	/* volume step */
+	rsnd_mod_write(mod, MIX_MIXMR, 0);
+	rsnd_mod_write(mod, MIX_MVPDR, 0);
+
+	rsnd_mix_volume_update(io, mod);
+
+	rsnd_mix_initialize_unlock(mod);
+
+	return 0;
+}
+
+static int rsnd_mix_quit(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_stop(mod);
+
+	return 0;
+}
+
+static struct rsnd_mod_ops rsnd_mix_ops = {
+	.name		= MIX_NAME,
+	.init		= rsnd_mix_init,
+	.quit		= rsnd_mix_quit,
+};
+
+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id)
+{
+	if (WARN_ON(id < 0 || id >= rsnd_mix_nr(priv)))
+		id = 0;
+
+	return &((struct rsnd_mix *)(priv->mix) + id)->mod;
+}
+
+static void rsnd_of_parse_mix(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_mix_platform_info *mix_info;
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = &pdev->dev;
+	int nr;
+
+	if (!of_data)
+		return;
+
+	node = of_get_child_by_name(dev->of_node, "rcar_sound,mix");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_mix_end;
+
+	mix_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_mix_platform_info) * nr,
+				GFP_KERNEL);
+	if (!mix_info) {
+		dev_err(dev, "mix info allocation error\n");
+		goto rsnd_of_parse_mix_end;
+	}
+
+	info->mix_info		= mix_info;
+	info->mix_info_nr	= nr;
+
+rsnd_of_parse_mix_end:
+	of_node_put(node);
+
+}
+
+int rsnd_mix_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv)
+{
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	struct rsnd_mix *mix;
+	struct clk *clk;
+	char name[MIX_NAME_SIZE];
+	int i, nr, ret;
+
+	/* This driver doesn't support Gen1 at this point */
+	if (rsnd_is_gen1(priv)) {
+		dev_warn(dev, "MIX is not supported on Gen1\n");
+		return -EINVAL;
+	}
+
+	rsnd_of_parse_mix(pdev, of_data, priv);
+
+	nr = info->mix_info_nr;
+	if (!nr)
+		return 0;
+
+	mix	= devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL);
+	if (!mix)
+		return -ENOMEM;
+
+	priv->mix_nr	= nr;
+	priv->mix	= mix;
+
+	for_each_rsnd_mix(mix, priv, i) {
+		snprintf(name, MIX_NAME_SIZE, "%s.%d",
+			 MIX_NAME, i);
+
+		clk = devm_clk_get(dev, name);
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+
+		mix->info = &info->mix_info[i];
+
+		ret = rsnd_mod_init(priv, &mix->mod, &rsnd_mix_ops,
+				    clk, RSND_MOD_MIX, i);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+void rsnd_mix_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv)
+{
+	struct rsnd_mix *mix;
+	int i;
+
+	for_each_rsnd_mix(mix, priv, i) {
+		rsnd_mod_quit(&mix->mod);
+	}
+}
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f2128a7cf259..7a0e52b4640a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -49,6 +49,16 @@ enum rsnd_reg {
 	RSND_REG_CMD_ROUTE_SLCT,
 	RSND_REG_CTU_CTUIR,
 	RSND_REG_CTU_ADINR,
+	RSND_REG_MIX_SWRSR,
+	RSND_REG_MIX_MIXIR,
+	RSND_REG_MIX_ADINR,
+	RSND_REG_MIX_MIXMR,
+	RSND_REG_MIX_MVPDR,
+	RSND_REG_MIX_MDBAR,
+	RSND_REG_MIX_MDBBR,
+	RSND_REG_MIX_MDBCR,
+	RSND_REG_MIX_MDBDR,
+	RSND_REG_MIX_MDBER,
 	RSND_REG_DVC_SWRSR,
 	RSND_REG_DVC_DVUIR,
 	RSND_REG_DVC_ADINR,
@@ -222,6 +232,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
  */
 enum rsnd_mod_type {
 	RSND_MOD_DVC = 0,
+	RSND_MOD_MIX,
 	RSND_MOD_CTU,
 	RSND_MOD_SRC,
 	RSND_MOD_SSI,
@@ -355,6 +366,7 @@ struct rsnd_dai_stream {
 #define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
 #define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
 #define rsnd_io_to_mod_ctu(io)	rsnd_io_to_mod((io), RSND_MOD_CTU)
+#define rsnd_io_to_mod_mix(io)	rsnd_io_to_mod((io), RSND_MOD_MIX)
 #define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
@@ -473,6 +485,12 @@ struct rsnd_priv {
 	int ctu_nr;
 
 	/*
+	 * below value will be filled on rsnd_mix_probe()
+	 */
+	void *mix;
+	int mix_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -589,6 +607,17 @@ void rsnd_ctu_remove(struct platform_device *pdev,
 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
 
 /*
+ *	R-Car MIX
+ */
+int rsnd_mix_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+
+void rsnd_mix_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
+
+/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
2.1.4

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

* Applied "ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support" to the asoc tree
  2015-07-15  7:17 ` [PATCH 30/35] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support Kuninori Morimoto
@ 2015-07-17 18:26   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-17 18:26 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 9269e3c3cfac277a49b485e27ac6850f9a11a259 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:17:17 +0000
Subject: [PATCH] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support

This patch adds CTU (Channel Transfer Unit) support for rsnd driver.
But, it does nothing to data at this point, but is required for MIX
support.

CTU design is a little different from other IPs (CTU0 is including
CTU00 - CTU03, and CTU1 is including CTU10 - CTU13, these have different
register mapping) We need to care about it on this driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |  14 ++
 include/sound/rcar_snd.h                           |   7 +
 sound/soc/sh/rcar/Makefile                         |   2 +-
 sound/soc/sh/rcar/core.c                           |  12 +-
 sound/soc/sh/rcar/ctu.c                            | 171 +++++++++++++++++++++
 sound/soc/sh/rcar/dma.c                            |  13 +-
 sound/soc/sh/rcar/gen.c                            |   2 +
 sound/soc/sh/rcar/rsnd.h                           |  21 +++
 8 files changed, 236 insertions(+), 6 deletions(-)
 create mode 100644 sound/soc/sh/rcar/ctu.c

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index b6b3a786855f..278607de05de 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -18,6 +18,9 @@ Required properties:
 - rcar_sound,src		: Should contain SRC feature.
 				  The number of SRC subnode should be same as HW.
 				  see below for detail.
+- rcar_sound,ctu		: Should contain CTU feature.
+				  The number of CTU subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dvc		: Should contain DVC feature.
 				  The number of DVC subnode should be same as HW.
 				  see below for detail.
@@ -90,6 +93,17 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 
+	rcar_sound,ctu {
+		ctu00: ctu@0 { };
+		ctu01: ctu@1 { };
+		ctu02: ctu@2 { };
+		ctu03: ctu@3 { };
+		ctu10: ctu@4 { };
+		ctu11: ctu@5 { };
+		ctu12: ctu@6 { };
+		ctu13: ctu@7 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 {
 			interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 4cecd0c175f6..8f9303093ab9 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -61,6 +61,10 @@ struct rsnd_src_platform_info {
 /*
  * flags
  */
+struct rsnd_ctu_platform_info {
+	u32 flags;
+};
+
 struct rsnd_dvc_platform_info {
 	u32 flags;
 };
@@ -68,6 +72,7 @@ struct rsnd_dvc_platform_info {
 struct rsnd_dai_path_info {
 	struct rsnd_ssi_platform_info *ssi;
 	struct rsnd_src_platform_info *src;
+	struct rsnd_ctu_platform_info *ctu;
 	struct rsnd_dvc_platform_info *dvc;
 };
 
@@ -93,6 +98,8 @@ struct rcar_snd_info {
 	int ssi_info_nr;
 	struct rsnd_src_platform_info *src_info;
 	int src_info_nr;
+	struct rsnd_ctu_platform_info *ctu_info;
+	int ctu_info_nr;
 	struct rsnd_dvc_platform_info *dvc_info;
 	int dvc_info_nr;
 	struct rsnd_dai_platform_info *dai_info;
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index 3a274fd3593c..7c4730a81c4a 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,4 +1,4 @@
-snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o dvc.o
+snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
 
 snd-soc-rsrc-card-objs	:= rsrc-card.o
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index e20d8ea0aafe..63ae7bbfd1dc 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -651,6 +651,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
 	if (ret < 0)
 		return ret;
 
+	/* CTU */
+	ret = rsnd_path_add(priv, io, ctu);
+	if (ret < 0)
+		return ret;
+
 	/* DVC */
 	ret = rsnd_path_add(priv, io, dvc);
 	if (ret < 0)
@@ -666,13 +671,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 	struct device_node *dai_node,	*dai_np;
 	struct device_node *ssi_node,	*ssi_np;
 	struct device_node *src_node,	*src_np;
+	struct device_node *ctu_node,	*ctu_np;
 	struct device_node *dvc_node,	*dvc_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_platform_info *dai_info;
 	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
 	struct device *dev = &pdev->dev;
 	int nr, i;
-	int dai_i, ssi_i, src_i, dvc_i;
+	int dai_i, ssi_i, src_i, ctu_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -698,6 +704,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
 
 	ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
 	src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
+	ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
 	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
@@ -734,6 +741,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(ctu);
 			mod_parse(dvc);
 
 			of_node_put(playback);
@@ -1146,6 +1154,7 @@ static int rsnd_probe(struct platform_device *pdev)
 		rsnd_dma_probe,
 		rsnd_ssi_probe,
 		rsnd_src_probe,
+		rsnd_ctu_probe,
 		rsnd_dvc_probe,
 		rsnd_adg_probe,
 		rsnd_dai_probe,
@@ -1241,6 +1250,7 @@ static int rsnd_remove(struct platform_device *pdev)
 			      struct rsnd_priv *priv) = {
 		rsnd_ssi_remove,
 		rsnd_src_remove,
+		rsnd_ctu_remove,
 		rsnd_dvc_remove,
 	};
 	int ret = 0, i;
diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
new file mode 100644
index 000000000000..05edd2009b81
--- /dev/null
+++ b/sound/soc/sh/rcar/ctu.c
@@ -0,0 +1,171 @@
+/*
+ * ctu.c
+ *
+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include "rsnd.h"
+
+#define CTU_NAME_SIZE	16
+#define CTU_NAME "ctu"
+
+struct rsnd_ctu {
+	struct rsnd_ctu_platform_info *info; /* rcar_snd.h */
+	struct rsnd_mod mod;
+};
+
+#define rsnd_ctu_nr(priv) ((priv)->ctu_nr)
+#define for_each_rsnd_ctu(pos, priv, i)					\
+	for ((i) = 0;							\
+	     ((i) < rsnd_ctu_nr(priv)) &&				\
+		     ((pos) = (struct rsnd_ctu *)(priv)->ctu + i);	\
+	     i++)
+
+#define rsnd_ctu_initialize_lock(mod)	__rsnd_ctu_initialize_lock(mod, 1)
+#define rsnd_ctu_initialize_unlock(mod)	__rsnd_ctu_initialize_lock(mod, 0)
+static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable)
+{
+	rsnd_mod_write(mod, CTU_CTUIR, enable);
+}
+
+static int rsnd_ctu_init(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_start(mod);
+
+	rsnd_ctu_initialize_lock(mod);
+
+	rsnd_mod_write(mod, CTU_ADINR, rsnd_get_adinr_chan(mod, io));
+
+	rsnd_ctu_initialize_unlock(mod);
+
+	return 0;
+}
+
+static int rsnd_ctu_quit(struct rsnd_mod *mod,
+			 struct rsnd_dai_stream *io,
+			 struct rsnd_priv *priv)
+{
+	rsnd_mod_hw_stop(mod);
+
+	return 0;
+}
+
+static struct rsnd_mod_ops rsnd_ctu_ops = {
+	.name		= CTU_NAME,
+	.init		= rsnd_ctu_init,
+	.quit		= rsnd_ctu_quit,
+};
+
+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
+{
+	if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv)))
+		id = 0;
+
+	return &((struct rsnd_ctu *)(priv->ctu) + id)->mod;
+}
+
+void rsnd_of_parse_ctu(struct platform_device *pdev,
+		       const struct rsnd_of_data *of_data,
+		       struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_ctu_platform_info *ctu_info;
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = &pdev->dev;
+	int nr;
+
+	if (!of_data)
+		return;
+
+	node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_ctu_end;
+
+	ctu_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_ctu_platform_info) * nr,
+				GFP_KERNEL);
+	if (!ctu_info) {
+		dev_err(dev, "ctu info allocation error\n");
+		goto rsnd_of_parse_ctu_end;
+	}
+
+	info->ctu_info		= ctu_info;
+	info->ctu_info_nr	= nr;
+
+rsnd_of_parse_ctu_end:
+	of_node_put(node);
+
+}
+
+int rsnd_ctu_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv)
+{
+	struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	struct rsnd_ctu *ctu;
+	struct clk *clk;
+	char name[CTU_NAME_SIZE];
+	int i, nr, ret;
+
+	/* This driver doesn't support Gen1 at this point */
+	if (rsnd_is_gen1(priv)) {
+		dev_warn(dev, "CTU is not supported on Gen1\n");
+		return -EINVAL;
+	}
+
+	rsnd_of_parse_ctu(pdev, of_data, priv);
+
+	nr = info->ctu_info_nr;
+	if (!nr)
+		return 0;
+
+	ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
+	if (!ctu)
+		return -ENOMEM;
+
+	priv->ctu_nr	= nr;
+	priv->ctu	= ctu;
+
+	for_each_rsnd_ctu(ctu, priv, i) {
+		/*
+		 * CTU00, CTU01, CTU02, CTU03 => CTU0
+		 * CTU10, CTU11, CTU12, CTU13 => CTU1
+		 */
+		snprintf(name, CTU_NAME_SIZE, "%s.%d",
+			 CTU_NAME, i / 4);
+
+		clk = devm_clk_get(dev, name);
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+
+		ctu->info = &info->ctu_info[i];
+
+		ret = rsnd_mod_init(priv, &ctu->mod, &rsnd_ctu_ops,
+				    clk, RSND_MOD_CTU, i);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+void rsnd_ctu_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv)
+{
+	struct rsnd_ctu *ctu;
+	int i;
+
+	for_each_rsnd_ctu(ctu, priv, i) {
+		rsnd_mod_quit(&ctu->mod);
+	}
+}
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 23282f48f71f..229b68d2cf70 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -426,7 +426,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU);
 	int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
 	int use_src = !!rsnd_io_to_mod_src(io);
-	int use_dvc = !!rsnd_io_to_mod_dvc(io);
+	int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
+		      !!rsnd_io_to_mod_ctu(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
 		dma_addr_t out_addr;
@@ -464,7 +465,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc && !use_src)
+	if (use_cmd && !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
 
 	/* use SSIU or SSI ? */
@@ -472,8 +473,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
 		is_ssi++;
 
 	return (is_from) ?
-		dma_addrs[is_ssi][is_play][use_src + use_dvc].out_addr :
-		dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
+		dma_addrs[is_ssi][is_play][use_src + use_cmd].out_addr :
+		dma_addrs[is_ssi][is_play][use_src + use_cmd].in_addr;
 }
 
 static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
@@ -504,6 +505,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+	struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
 	struct rsnd_mod *mod_start, *mod_end;
@@ -543,6 +545,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 		if (src) {
 			mod[i] = src;
 			src = NULL;
+		} else if (ctu) {
+			mod[i] = ctu;
+			ctu = NULL;
 		} else if (dvc) {
 			mod[i] = dvc;
 			dvc = NULL;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index a2d5df4d5d17..41b75cd4e09b 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -240,6 +240,8 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
 		RSND_GEN_M_REG(SRC_SRCCR,	0x224,	0x40),
 		RSND_GEN_M_REG(SRC_BSDSR,	0x22c,	0x40),
 		RSND_GEN_M_REG(SRC_BSISR,	0x238,	0x40),
+		RSND_GEN_M_REG(CTU_CTUIR,	0x504,	0x100),
+		RSND_GEN_M_REG(CTU_ADINR,	0x508,	0x100),
 		RSND_GEN_M_REG(DVC_SWRSR,	0xe00,	0x100),
 		RSND_GEN_M_REG(DVC_DVUIR,	0xe04,	0x100),
 		RSND_GEN_M_REG(DVC_ADINR,	0xe08,	0x100),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 7fee2079ba5a..f2128a7cf259 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -47,6 +47,8 @@ enum rsnd_reg {
 	RSND_REG_SCU_SYS_STATUS0,
 	RSND_REG_SCU_SYS_INT_EN0,
 	RSND_REG_CMD_ROUTE_SLCT,
+	RSND_REG_CTU_CTUIR,
+	RSND_REG_CTU_ADINR,
 	RSND_REG_DVC_SWRSR,
 	RSND_REG_DVC_DVUIR,
 	RSND_REG_DVC_ADINR,
@@ -220,6 +222,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
  */
 enum rsnd_mod_type {
 	RSND_MOD_DVC = 0,
+	RSND_MOD_CTU,
 	RSND_MOD_SRC,
 	RSND_MOD_SSI,
 	RSND_MOD_MAX,
@@ -351,6 +354,7 @@ struct rsnd_dai_stream {
 #define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
 #define rsnd_io_to_mod_ssi(io)	rsnd_io_to_mod((io), RSND_MOD_SSI)
 #define rsnd_io_to_mod_src(io)	rsnd_io_to_mod((io), RSND_MOD_SRC)
+#define rsnd_io_to_mod_ctu(io)	rsnd_io_to_mod((io), RSND_MOD_CTU)
 #define rsnd_io_to_mod_dvc(io)	rsnd_io_to_mod((io), RSND_MOD_DVC)
 #define rsnd_io_to_rdai(io)	((io)->rdai)
 #define rsnd_io_to_priv(io)	(rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
@@ -463,6 +467,12 @@ struct rsnd_priv {
 	int src_nr;
 
 	/*
+	 * below value will be filled on rsnd_ctu_probe()
+	 */
+	void *ctu;
+	int ctu_nr;
+
+	/*
 	 * below value will be filled on rsnd_dvc_probe()
 	 */
 	void *dvc;
@@ -568,6 +578,17 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
 int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
 
 /*
+ *	R-Car CTU
+ */
+int rsnd_ctu_probe(struct platform_device *pdev,
+		   const struct rsnd_of_data *of_data,
+		   struct rsnd_priv *priv);
+
+void rsnd_ctu_remove(struct platform_device *pdev,
+		     struct rsnd_priv *priv);
+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
+
+/*
  *	R-Car DVC
  */
 int rsnd_dvc_probe(struct platform_device *pdev,
-- 
2.1.4

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

* Applied "ASoC: rsnd: update Audio DMA path search method" to the asoc tree
  2015-07-15  7:16 ` [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method Kuninori Morimoto
@ 2015-07-17 18:26   ` Mark Brown
  0 siblings, 0 replies; 68+ messages in thread
From: Mark Brown @ 2015-07-17 18:26 UTC (permalink / raw)
  To: Kuninori Morimoto, Keita Kobayashi, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: update Audio DMA path search method

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7dfb49194557ccf27ab99c8c04c021320e7ae458 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 15 Jul 2015 07:16:56 +0000
Subject: [PATCH] ASoC: rsnd: update Audio DMA path search method

Current rsnd driver is assuming Audio DMAC / Audio DMAC peri peri
are used from SSI/SSIU/SRC/DVC. But we will add CTU/MIX to this driver.
Then, current DMA path searching method is not understandable, and good
enough for this purpose. This patch update DMA path search method, more
simply.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dma.c | 88 +++++++++++++++++++++++++++++--------------------
 1 file changed, 53 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index a175863d239c..23282f48f71f 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -494,7 +494,7 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
 	return rsnd_gen2_dma_addr(io, mod, is_play, is_from);
 }
 
-#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
+#define MOD_MAX (RSND_MOD_MAX + 1) /* +Memory */
 static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			     struct rsnd_dai_stream *io,
 			     int is_play,
@@ -506,53 +506,71 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 	struct rsnd_mod *src = rsnd_io_to_mod_src(io);
 	struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
 	struct rsnd_mod *mod[MOD_MAX];
-	int i, index;
+	struct rsnd_mod *mod_start, *mod_end;
+	struct rsnd_priv *priv = rsnd_mod_to_priv(this);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	int nr, i;
 
+	if (!ssi)
+		return;
 
-	for (i = 0; i < MOD_MAX; i++)
+	nr = 0;
+	for (i = 0; i < MOD_MAX; i++) {
 		mod[i] = NULL;
+		nr += !!rsnd_io_to_mod(io, i);
+	}
 
 	/*
-	 * in play case...
+	 * [S] -*-> [E]
+	 * [S] -*-> SRC -o-> [E]
+	 * [S] -*-> SRC -> DVC -o-> [E]
+	 * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E]
+	 *
+	 * playback	[S] = mem
+	 *		[E] = SSI
 	 *
-	 * src -> dst
+	 * capture	[S] = SSI
+	 *		[E] = mem
 	 *
-	 * mem -> SSI
-	 * mem -> SRC -> SSI
-	 * mem -> SRC -> DVC -> SSI
+	 * -*->		Audio DMAC
+	 * -o->		Audio DMAC peri peri
 	 */
-	mod[0] = NULL; /* for "mem" */
-	index = 1;
-	for (i = 1; i < MOD_MAX; i++) {
-		if (!src) {
-			mod[i] = ssi;
-		} else if (!dvc) {
-			mod[i] = src;
-			src = NULL;
-		} else {
-			if ((!is_play) && (this == src))
-				this = dvc;
+	mod_start	= (is_play) ? NULL : ssi;
+	mod_end		= (is_play) ? ssi  : NULL;
 
-			mod[i] = (is_play) ? src : dvc;
-			i++;
-			mod[i] = (is_play) ? dvc : src;
+	mod[0] = mod_start;
+	for (i = 1; i < nr; i++) {
+		if (src) {
+			mod[i] = src;
 			src = NULL;
+		} else if (dvc) {
+			mod[i] = dvc;
 			dvc = NULL;
 		}
-
-		if (mod[i] == this)
-			index = i;
-
-		if (mod[i] == ssi)
-			break;
 	}
+	mod[i] = mod_end;
 
-	if (is_play) {
-		*mod_from = mod[index - 1];
-		*mod_to   = mod[index];
+	/*
+	 *		| SSI | SRC |
+	 * -------------+-----+-----+
+	 *  is_play	|  o  |  *  |
+	 * !is_play	|  *  |  o  |
+	 */
+	if ((this == ssi) == (is_play)) {
+		*mod_from	= mod[nr - 1];
+		*mod_to		= mod[nr];
 	} else {
-		*mod_from = mod[index];
-		*mod_to   = mod[index - 1];
+		*mod_from	= mod[0];
+		*mod_to		= mod[1];
+	}
+
+	dev_dbg(dev, "module connection (this is %s[%d])\n",
+		rsnd_mod_name(this), rsnd_mod_id(this));
+	for (i = 0; i <= nr; i++) {
+		dev_dbg(dev, "  %s[%d]%s\n",
+		       rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]),
+		       (mod[i] == *mod_from) ? " from" :
+		       (mod[i] == *mod_to)   ? " to" : "");
 	}
 }
 
@@ -580,8 +598,8 @@ void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
 
 int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
 {
-	struct rsnd_mod *mod_from;
-	struct rsnd_mod *mod_to;
+	struct rsnd_mod *mod_from = NULL;
+	struct rsnd_mod *mod_to = NULL;
 	struct rsnd_priv *priv = rsnd_io_to_priv(io);
 	struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-- 
2.1.4

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

end of thread, other threads:[~2015-07-17 18:26 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15  7:06 [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Kuninori Morimoto
2015-07-15  7:07 ` [PATCH 01/35] ASoC: core: add snd_soc_of_parse_audio_prefix() Kuninori Morimoto
2015-07-16 21:01   ` Applied "ASoC: core: add snd_soc_of_parse_audio_prefix()" to the asoc tree Mark Brown
2015-07-15  7:08 ` [PATCH 02/35] ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing" to the asoc tree Mark Brown
2015-07-15  7:08 ` [PATCH 03/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SSI Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SSI" to the asoc tree Mark Brown
2015-07-15  7:08 ` [PATCH 04/35] ASoC: rsnd: remove unnecessary 'out of memory' message from SRC Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from SRC" to the asoc tree Mark Brown
2015-07-15  7:09 ` [PATCH 05/35] ASoC: rsnd: remove unnecessary 'out of memory' message from DVC Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: remove unnecessary 'out of memory' message from DVC" to the asoc tree Mark Brown
2015-07-15  7:09 ` [PATCH 06/35] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN" to the asoc tree Mark Brown
2015-07-15  7:09 ` [PATCH 07/35] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE" to the asoc tree Mark Brown
2015-07-15  7:10 ` [PATCH 08/35] ASoC: rsnd: fixup each module counter on __rsnd_mod_call() Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: fixup each module counter on __rsnd_mod_call()" to the asoc tree Mark Brown
2015-07-15  7:10 ` [PATCH 09/35] ASoC: rsnd: add workaround for SRC sync convert + DVC Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: add workaround for SRC sync convert + DVC" to the asoc tree Mark Brown
2015-07-15  7:10 ` [PATCH 10/35] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL" to the asoc tree Mark Brown
2015-07-15  7:11 ` [PATCH 11/35] ASoC: rsnd: move DVC specific macro into dvc.c Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: move DVC specific macro into dvc.c" to the asoc tree Mark Brown
2015-07-15  7:11 ` [PATCH 12/35] ASoC: rsnd: move SRC specific macro into src.c Kuninori Morimoto
2015-07-16 21:11   ` Applied "ASoC: rsnd: move SRC specific macro into src.c" to the asoc tree Mark Brown
2015-07-15  7:12 ` [PATCH 13/35] ASoC: rsnd: dvc: make sure DVC soft reset Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: dvc: make sure DVC soft reset" to the asoc tree Mark Brown
2015-07-15  7:12 ` [PATCH 14/35] ASoC: rsnd: src: make sure SRC soft reset Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: src: make sure SRC soft reset" to the asoc tree Mark Brown
2015-07-15  7:12 ` [PATCH 15/35] ASoC: rsnd: enable module multi connection Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: enable module multi connection" to the asoc tree Mark Brown
2015-07-15  7:12 ` [PATCH 16/35] ASoC: rsnd: rename rsnd_path_parse/break() into add/remove Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: rename rsnd_path_parse/break() into add/remove" to the asoc tree Mark Brown
2015-07-15  7:13 ` [PATCH 17/35] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC route setting" to the asoc tree Mark Brown
2015-07-15  7:13 ` [PATCH 18/35] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock() Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()" to the asoc tree Mark Brown
2015-07-15  7:13 ` [PATCH 19/35] ASoC: rsnd: add rsnd_src_initialize_lock/unlock() Kuninori Morimoto
2015-07-16 21:30   ` Applied "ASoC: rsnd: add rsnd_src_initialize_lock/unlock()" to the asoc tree Mark Brown
2015-07-15  7:14 ` [PATCH 20/35] ASoC: rsnd: tidyup ADINR function name Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup ADINR function name" to the asoc tree Mark Brown
2015-07-15  7:14 ` [PATCH 21/35] ASoC: rsnd: add rsnd_get_adinr_chan() Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: add rsnd_get_adinr_chan()" to the asoc tree Mark Brown
2015-07-15  7:14 ` [PATCH 22/35] ASoC: rsnd: tidyup data align position Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup data align position" to the asoc tree Mark Brown
2015-07-15  7:15 ` [PATCH 23/35] ASoC: rsnd: show debug message for SSI/SRC/DVC connection Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: show debug message for SSI/SRC/DVC connection" to the asoc tree Mark Brown
2015-07-15  7:15 ` [PATCH 24/35] ASoC: rsnd: tidyup rsnd_dma_ops definition place Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup rsnd_dma_ops definition place" to the asoc tree Mark Brown
2015-07-15  7:15 ` [PATCH 25/35] ASoC: rsnd: check the Gen1 at the beginning of DVC probe Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: check the Gen1 at the beginning of DVC probe" to the asoc tree Mark Brown
2015-07-15  7:16 ` [PATCH 26/35] ASoC: rsnd: dma: add DMA name on .ops Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: dma: add DMA name on .ops" to the asoc tree Mark Brown
2015-07-15  7:16 ` [PATCH 27/35] ASoC: rsnd: add rsnd_io_to_mod() Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: add rsnd_io_to_mod()" to the asoc tree Mark Brown
2015-07-15  7:16 ` [PATCH 28/35] ASoC: rsnd: tidyup SRC position on each code Kuninori Morimoto
2015-07-16 21:29   ` Applied "ASoC: rsnd: tidyup SRC position on each code" to the asoc tree Mark Brown
2015-07-15  7:16 ` [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method Kuninori Morimoto
2015-07-17 18:26   ` Applied "ASoC: rsnd: update Audio DMA path search method" to the asoc tree Mark Brown
2015-07-15  7:17 ` [PATCH 30/35] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support Kuninori Morimoto
2015-07-17 18:26   ` Applied "ASoC: rsnd: add CTU (Channel Transfer Unit) prototype support" to the asoc tree Mark Brown
2015-07-15  7:17 ` [PATCH 31/35] ASoC: rsnd: add MIX (Mixer) support Kuninori Morimoto
2015-07-17 18:26   ` Applied "ASoC: rsnd: add MIX (Mixer) support" to the asoc tree Mark Brown
2015-07-15  7:17 ` [PATCH 32/35] ARM: shmobile: r8a7790: Add Audio CTU support on DTSI Kuninori Morimoto
2015-07-15  7:18 ` [PATCH 33/35] ARM: shmobile: r8a7790: Add Audio MIX " Kuninori Morimoto
2015-07-15  7:18 ` [PATCH 34/35] ARM: shmobile: r8a7791: Add Audio CTU " Kuninori Morimoto
2015-07-15  7:18 ` [PATCH 35/35] ARM: shmobile: r8a7791: Add Audio MIX " Kuninori Morimoto
2015-07-16 21:19 ` [PATCH 0/35] ASoC: rsnd: add CTU/MIX prototype support Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.