All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/12] ASoC: rsnd: fixup and DT support patches
@ 2014-06-18  8:53 ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Kuninori Morimoto, Simon, linux-sh


Hi Mark

These are R-Car sound fixup and DMA DT support patches.
#1 #2 are bug fix patches.
other patches adds DMA DT support to sound driver.

I already posted some of these patches,
but, merged into this patch-set

Kuninori Morimoto (12):
      ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
      ASoC: rsnd: fixup loop exit timing of dma name search
      ASoC: rsnd: SSI + DMA can select BUSIF
      ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
      ASoC: fsi: add fsi_pointer_update() for common pointer method
      ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
      ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
      ASoC: rsnd: enable DVC when capture
      ASoC: rsnd: enable SRC setting via DT
      ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
      ASoC: rsnd: DMA start address is properly used for each DMAC
      ASoC: rsnd: add DT support to DVC

 .../devicetree/bindings/sound/renesas,rsnd.txt     |   11 +-
 arch/arm/mach-shmobile/board-armadillo800eva.c     |    4 +
 arch/arm/mach-shmobile/board-kzm9g.c               |    2 +
 arch/arm/mach-shmobile/board-mackerel.c            |    4 +
 arch/sh/boards/mach-ecovec24/setup.c               |    2 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/fsi.c                                 |  189 ++++++--------------
 sound/soc/sh/rcar/core.c                           |  158 ++++++++--------
 sound/soc/sh/rcar/dvc.c                            |   50 +++++-
 sound/soc/sh/rcar/gen.c                            |  110 +++++++-----
 sound/soc/sh/rcar/rsnd.h                           |   22 +--
 sound/soc/sh/rcar/src.c                            |   51 ++++--
 sound/soc/sh/rcar/ssi.c                            |   33 +++-
 13 files changed, 339 insertions(+), 298 deletions(-)


Best regards
---
Kuninori Morimoto

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

* [PATCH 0/12] ASoC: rsnd: fixup and DT support patches
@ 2014-06-18  8:53 ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Kuninori Morimoto, Simon, linux-sh


Hi Mark

These are R-Car sound fixup and DMA DT support patches.
#1 #2 are bug fix patches.
other patches adds DMA DT support to sound driver.

I already posted some of these patches,
but, merged into this patch-set

Kuninori Morimoto (12):
      ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
      ASoC: rsnd: fixup loop exit timing of dma name search
      ASoC: rsnd: SSI + DMA can select BUSIF
      ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
      ASoC: fsi: add fsi_pointer_update() for common pointer method
      ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
      ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
      ASoC: rsnd: enable DVC when capture
      ASoC: rsnd: enable SRC setting via DT
      ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
      ASoC: rsnd: DMA start address is properly used for each DMAC
      ASoC: rsnd: add DT support to DVC

 .../devicetree/bindings/sound/renesas,rsnd.txt     |   11 +-
 arch/arm/mach-shmobile/board-armadillo800eva.c     |    4 +
 arch/arm/mach-shmobile/board-kzm9g.c               |    2 +
 arch/arm/mach-shmobile/board-mackerel.c            |    4 +
 arch/sh/boards/mach-ecovec24/setup.c               |    2 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/fsi.c                                 |  189 ++++++--------------
 sound/soc/sh/rcar/core.c                           |  158 ++++++++--------
 sound/soc/sh/rcar/dvc.c                            |   50 +++++-
 sound/soc/sh/rcar/gen.c                            |  110 +++++++-----
 sound/soc/sh/rcar/rsnd.h                           |   22 +--
 sound/soc/sh/rcar/src.c                            |   51 ++++--
 sound/soc/sh/rcar/ssi.c                            |   33 +++-
 13 files changed, 339 insertions(+), 298 deletions(-)


Best regards
---
Kuninori Morimoto

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

* [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:54   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

ad32d0c7b0e993433df152ae747652647eb65a27
(ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
added rsnd_gen_dma_addr() to calculate DMA addr,
but, it is necessary only for Gen2.
This patch ignores Gen1 case.
Kernel will be panic without this patch.
Special thanks to Simon

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/gen.c |   33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 1dd2b7d..0280a11 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -184,7 +184,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		       struct rsnd_dma *dma,
 		       struct dma_slave_config *cfg,
 		       int is_play, int slave_id)
@@ -226,17 +226,6 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
 		}
 	};
 
-	cfg->slave_id	= slave_id;
-	cfg->src_addr	= 0;
-	cfg->dst_addr	= 0;
-	cfg->direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
-	/*
-	 * gen1 uses default DMA addr
-	 */
-	if (rsnd_is_gen1(priv))
-		return;
-
 	/* it shouldn't happen */
 	if (use_dvc & !use_src) {
 		dev_err(dev, "DVC is selected without SRC\n");
@@ -250,6 +239,26 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
 		id, cfg->src_addr, cfg->dst_addr);
 }
 
+void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_dma *dma,
+		       struct dma_slave_config *cfg,
+		       int is_play, int slave_id)
+{
+	cfg->slave_id   = slave_id;
+	cfg->src_addr   = 0;
+	cfg->dst_addr   = 0;
+	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+
+	/*
+	 * gen1 uses default DMA addr
+	 */
+	if (rsnd_is_gen1(priv))
+		return;
+
+	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
+}
+
+
 /*
  *		Gen2
  */
-- 
1.7.9.5


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

* [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
@ 2014-06-18  8:54   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

ad32d0c7b0e993433df152ae747652647eb65a27
(ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
added rsnd_gen_dma_addr() to calculate DMA addr,
but, it is necessary only for Gen2.
This patch ignores Gen1 case.
Kernel will be panic without this patch.
Special thanks to Simon

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/gen.c |   33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 1dd2b7d..0280a11 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -184,7 +184,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		       struct rsnd_dma *dma,
 		       struct dma_slave_config *cfg,
 		       int is_play, int slave_id)
@@ -226,17 +226,6 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
 		}
 	};
 
-	cfg->slave_id	= slave_id;
-	cfg->src_addr	= 0;
-	cfg->dst_addr	= 0;
-	cfg->direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
-	/*
-	 * gen1 uses default DMA addr
-	 */
-	if (rsnd_is_gen1(priv))
-		return;
-
 	/* it shouldn't happen */
 	if (use_dvc & !use_src) {
 		dev_err(dev, "DVC is selected without SRC\n");
@@ -250,6 +239,26 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
 		id, cfg->src_addr, cfg->dst_addr);
 }
 
+void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_dma *dma,
+		       struct dma_slave_config *cfg,
+		       int is_play, int slave_id)
+{
+	cfg->slave_id   = slave_id;
+	cfg->src_addr   = 0;
+	cfg->dst_addr   = 0;
+	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+
+	/*
+	 * gen1 uses default DMA addr
+	 */
+	if (rsnd_is_gen1(priv))
+		return;
+
+	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
+}
+
+
 /*
  *		Gen2
  */
-- 
1.7.9.5


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

* [PATCH 02/12] ASoC: rsnd: fixup loop exit timing of dma name search
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:55   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current dma name search loop didn't care about SSI index
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 4e86265..ed76901 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -297,7 +297,6 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	for (i = 1; i < MOD_MAX; i++) {
 		if (!src) {
 			mod[i] = ssi;
-			break;
 		} else if (!dvc) {
 			mod[i] = src;
 			src = NULL;
@@ -308,6 +307,9 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 
 		if (mod[i] = this)
 			index = i;
+
+		if (mod[i] = ssi)
+			break;
 	}
 
 	if (is_play) {
-- 
1.7.9.5


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

* [PATCH 02/12] ASoC: rsnd: fixup loop exit timing of dma name search
@ 2014-06-18  8:55   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current dma name search loop didn't care about SSI index
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 4e86265..ed76901 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -297,7 +297,6 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	for (i = 1; i < MOD_MAX; i++) {
 		if (!src) {
 			mod[i] = ssi;
-			break;
 		} else if (!dvc) {
 			mod[i] = src;
 			src = NULL;
@@ -308,6 +307,9 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 
 		if (mod[i] == this)
 			index = i;
+
+		if (mod[i] == ssi)
+			break;
 	}
 
 	if (is_play) {
-- 
1.7.9.5


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

* [PATCH 03/12] ASoC: rsnd: SSI + DMA can select BUSIF
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:55   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |    1 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/rcar/core.c                           |   22 ++++---
 sound/soc/sh/rcar/gen.c                            |   64 +++++++++++++-------
 sound/soc/sh/rcar/rsnd.h                           |   10 ++-
 sound/soc/sh/rcar/src.c                            |   37 ++++++++---
 sound/soc/sh/rcar/ssi.c                            |   33 +++++++++-
 7 files changed, 123 insertions(+), 45 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 8346cab..41a120c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,7 @@ SSI subnode properties:
 - interrupts			: Should contain SSI interrupt for PIO transfer
 - shared-pin			: if shared clock pin
 - pio-transfer			: use PIO transfer mode
+- no-busif			: BUSIF is not ussed when [mem -> SSI] via DMA case
 
 SRC subnode properties:
 no properties at this point
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index f4a706f..d76412b 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,6 +34,7 @@
  * B : SSI direction
  */
 #define RSND_SSI_CLK_PIN_SHARE		(1 << 31)
+#define RSND_SSI_NO_BUSIF		(1 << 30) /* SSI+DMA without BUSIF */
 
 #define RSND_SSI(_dma_id, _pio_irq, _flags)		\
 { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index ed76901..1a59602 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -138,6 +138,17 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
 	return mod->ops->name;
 }
 
+char *rsnd_mod_dma_name(struct rsnd_mod *mod)
+{
+	if (!mod || !mod->ops)
+		return "unknown";
+
+	if (!mod->ops->dma_name)
+		return mod->ops->name;
+
+	return mod->ops->dma_name(mod);
+}
+
 void rsnd_mod_init(struct rsnd_priv *priv,
 		   struct rsnd_mod *mod,
 		   struct rsnd_mod_ops *ops,
@@ -261,7 +272,7 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 {
 	if (mod)
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
-			 rsnd_mod_name(mod), rsnd_mod_id(mod));
+			 rsnd_mod_dma_name(mod), rsnd_mod_id(mod));
 	else
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
 
@@ -343,11 +354,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	if (dev->of_node)
-		rsnd_dma_of_name(dma, is_play, dma_name);
-	else
-		snprintf(dma_name, DMA_NAME_SIZE,
-			 is_play ? "tx" : "rx");
+	rsnd_dma_of_name(dma, is_play, dma_name);
+	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
 
 	dev_dbg(dev, "dma name : %s\n", dma_name);
 
@@ -359,8 +367,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		return -EIO;
 	}
 
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
-
 	ret = dmaengine_slave_config(dma->chan, &cfg);
 	if (ret < 0)
 		goto rsnd_dma_init_err;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 0280a11..46677af 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -165,15 +165,19 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *
  *	ex) R-Car H2 case
  *	      mod        / DMAC in    / DMAC out   / DMAC PP in / DMAC pp out
- *	SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
+ *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
+ *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
  *	CMD : 0xec500000 / 0xec008000                             0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
 
-#define RDMA_SSI_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
-#define RDMA_SSI_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_I_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+#define RDMA_SSIU_O_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+
+#define RDMA_SSIU_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
 
 #define RDMA_SRC_I_N(addr, i)	(addr ##_reg - 0x00500000 + (0x400 * i))
 #define RDMA_SRC_O_N(addr, i)	(addr ##_reg - 0x004fc000 + (0x400 * i))
@@ -204,26 +208,36 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	struct dma_addr {
 		dma_addr_t src_addr;
 		dma_addr_t dst_addr;
-	} dma_addrs[2][2][3] = {
-		{ /* SRC */
-			/* Capture */
-			{{ 0,				0 },
-			 { RDMA_SRC_O_N(src, id),	0 },
-			 { RDMA_CMD_O_N(src, id),	0 }},
-			/* Playback */
-			{{ 0,				0, },
-			 { 0,				RDMA_SRC_I_N(src, id) },
-			 { 0,				RDMA_SRC_I_N(src, id) }}
-		}, { /* SSI */
-			/* Capture */
-			{{ RDMA_SSI_O_N(ssi, id),	0 },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) }},
-			/* Playback */
-			{{ 0,				RDMA_SSI_I_N(ssi, id) },
-			 { RDMA_SRC_O_P(src, id),	RDMA_SSI_I_P(ssi, id) },
-			 { RDMA_CMD_O_P(src, id),	RDMA_SSI_I_P(ssi, id) }}
-		}
+	} dma_addrs[3][2][3] = {
+		/* SRC */
+		{{{ 0,				0 },
+		/* Capture */
+		  { RDMA_SRC_O_N(src, id),	0 },
+		  { RDMA_CMD_O_N(src, id),	0 } },
+		 /* Playback */
+		 {{ 0,				0, },
+		  { 0,				RDMA_SRC_I_N(src, id) },
+		  { 0,				RDMA_SRC_I_N(src, id) } }
+		},
+		/* SSI */
+		/* Capture */
+		{{{ RDMA_SSI_O_N(ssi, id),	0 },
+		  { 0,				0 },
+		  { 0,				0 } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
+		  { 0,				0 },
+		  { 0,				0 } }
+		},
+		/* SSIU */
+		/* Capture */
+		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
+		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
@@ -232,6 +246,10 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		return;
 	}
 
+	/* use SSIU or SSI ? */
+	if (is_ssi && (0 = strcmp(rsnd_mod_dma_name(mod), "ssiu")))
+		is_ssi++;
+
 	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
 	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 39d98af..e492c13 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -185,6 +185,7 @@ enum rsnd_mod_type {
 
 struct rsnd_mod_ops {
 	char *name;
+	char* (*dma_name)(struct rsnd_mod *mod);
 	int (*probe)(struct rsnd_mod *mod,
 		     struct rsnd_dai *rdai);
 	int (*remove)(struct rsnd_mod *mod,
@@ -224,6 +225,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 		   enum rsnd_mod_type type,
 		   int id);
 char *rsnd_mod_name(struct rsnd_mod *mod);
+char *rsnd_mod_dma_name(struct rsnd_mod *mod);
 
 /*
  *	R-Car sound DAI
@@ -391,8 +393,12 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct rsnd_dai_stream *io,
 				   struct snd_pcm_runtime *runtime);
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai);
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif);
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+		       struct rsnd_dai *rdai,
+		       int use_busif);
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
 			    struct rsnd_dai *rdai);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 200eda0..4d39505 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -106,18 +106,17 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai)
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
 {
-	struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
 	 * SSI_MODE0
 	 */
 	rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
-		      src_mod ? 0 : (1 << ssi_id));
+		      !use_busif << ssi_id);
 
 	/*
 	 * SSI_MODE1
@@ -143,6 +142,29 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
 				      0x2 << shift : 0x1 << shift);
 	}
 
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif) {
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
+			       rsnd_get_adinr(ssi_mod));
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
+	}
+
+	return 0;
+}
+
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
+{
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif)
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0);
+
 	return 0;
 }
 
@@ -467,9 +489,6 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr(mod));
-	rsnd_mod_write(mod, SSI_BUSIF_MODE,  1);
-
 	rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
 
 	rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
@@ -554,7 +573,6 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
 
 	rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
 
-	rsnd_mod_write(mod, SSI_CTRL, 0x1);
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
 	return rsnd_src_start(mod, rdai);
@@ -565,7 +583,6 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
 {
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 
-	rsnd_mod_write(mod, SSI_CTRL, 0);
 	rsnd_mod_write(mod, SRC_CTRL, 0);
 
 	rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2df723d..34e8400 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -90,6 +90,20 @@ struct rsnd_ssi {
 #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
 #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
 
+static int rsnd_ssi_use_busif(struct rsnd_mod *mod)
+{
+	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+	int use_busif = 0;
+
+	if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF))
+		use_busif = 1;
+	if (rsnd_io_to_mod_src(io))
+		use_busif = 1;
+
+	return use_busif;
+}
+
 static void rsnd_ssi_status_check(struct rsnd_mod *mod,
 				  u32 bit)
 {
@@ -289,8 +303,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 	ssi->cr_own	= cr;
 	ssi->err	= -1; /* ignore 1st error */
 
-	rsnd_src_ssi_mode_init(mod, rdai);
-
 	return 0;
 }
 
@@ -389,6 +401,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
 	/* enable PIO IRQ */
 	ssi->cr_etc = UIEN | OIEN | DIEN;
 
+	rsnd_src_ssiu_start(mod, rdai, 0);
+
 	rsnd_src_enable_ssi_irq(mod, rdai);
 
 	rsnd_ssi_hw_start(ssi, rdai, io);
@@ -405,6 +419,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
 
 	rsnd_ssi_hw_stop(ssi, rdai);
 
+	rsnd_src_ssiu_stop(mod, rdai, 0);
+
 	return 0;
 }
 
@@ -457,6 +473,8 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
 	/* enable DMA transfer */
 	ssi->cr_etc = DMEN;
 
+	rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
+
 	rsnd_dma_start(dma);
 
 	rsnd_ssi_hw_start(ssi, ssi->rdai, io);
@@ -482,11 +500,19 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
 
 	rsnd_dma_stop(dma);
 
+	rsnd_src_ssiu_stop(mod, rdai, 1);
+
 	return 0;
 }
 
+static char *rsnd_ssi_dma_name(struct rsnd_mod *mod)
+{
+	return rsnd_ssi_use_busif(mod) ? "ssiu" : SSI_NAME;
+}
+
 static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
 	.name	= SSI_NAME,
+	.dma_name = rsnd_ssi_dma_name,
 	.probe	= rsnd_ssi_dma_probe,
 	.remove	= rsnd_ssi_dma_remove,
 	.init	= rsnd_ssi_init,
@@ -595,6 +621,9 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
 		 */
 		ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
 			0 : 1;
+
+		if (of_get_property(np, "no-busif", NULL))
+			ssi_info->flags |= RSND_SSI_NO_BUSIF;
 	}
 
 rsnd_of_parse_ssi_end:
-- 
1.7.9.5


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

* [PATCH 03/12] ASoC: rsnd: SSI + DMA can select BUSIF
@ 2014-06-18  8:55   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |    1 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/rcar/core.c                           |   22 ++++---
 sound/soc/sh/rcar/gen.c                            |   64 +++++++++++++-------
 sound/soc/sh/rcar/rsnd.h                           |   10 ++-
 sound/soc/sh/rcar/src.c                            |   37 ++++++++---
 sound/soc/sh/rcar/ssi.c                            |   33 +++++++++-
 7 files changed, 123 insertions(+), 45 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 8346cab..41a120c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,7 @@ SSI subnode properties:
 - interrupts			: Should contain SSI interrupt for PIO transfer
 - shared-pin			: if shared clock pin
 - pio-transfer			: use PIO transfer mode
+- no-busif			: BUSIF is not ussed when [mem -> SSI] via DMA case
 
 SRC subnode properties:
 no properties at this point
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index f4a706f..d76412b 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,6 +34,7 @@
  * B : SSI direction
  */
 #define RSND_SSI_CLK_PIN_SHARE		(1 << 31)
+#define RSND_SSI_NO_BUSIF		(1 << 30) /* SSI+DMA without BUSIF */
 
 #define RSND_SSI(_dma_id, _pio_irq, _flags)		\
 { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index ed76901..1a59602 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -138,6 +138,17 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
 	return mod->ops->name;
 }
 
+char *rsnd_mod_dma_name(struct rsnd_mod *mod)
+{
+	if (!mod || !mod->ops)
+		return "unknown";
+
+	if (!mod->ops->dma_name)
+		return mod->ops->name;
+
+	return mod->ops->dma_name(mod);
+}
+
 void rsnd_mod_init(struct rsnd_priv *priv,
 		   struct rsnd_mod *mod,
 		   struct rsnd_mod_ops *ops,
@@ -261,7 +272,7 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 {
 	if (mod)
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
-			 rsnd_mod_name(mod), rsnd_mod_id(mod));
+			 rsnd_mod_dma_name(mod), rsnd_mod_id(mod));
 	else
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
 
@@ -343,11 +354,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	if (dev->of_node)
-		rsnd_dma_of_name(dma, is_play, dma_name);
-	else
-		snprintf(dma_name, DMA_NAME_SIZE,
-			 is_play ? "tx" : "rx");
+	rsnd_dma_of_name(dma, is_play, dma_name);
+	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
 
 	dev_dbg(dev, "dma name : %s\n", dma_name);
 
@@ -359,8 +367,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		return -EIO;
 	}
 
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
-
 	ret = dmaengine_slave_config(dma->chan, &cfg);
 	if (ret < 0)
 		goto rsnd_dma_init_err;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 0280a11..46677af 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -165,15 +165,19 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *
  *	ex) R-Car H2 case
  *	      mod        / DMAC in    / DMAC out   / DMAC PP in / DMAC pp out
- *	SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
+ *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
+ *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
  *	CMD : 0xec500000 / 0xec008000                             0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
 
-#define RDMA_SSI_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
-#define RDMA_SSI_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_I_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+#define RDMA_SSIU_O_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+
+#define RDMA_SSIU_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
 
 #define RDMA_SRC_I_N(addr, i)	(addr ##_reg - 0x00500000 + (0x400 * i))
 #define RDMA_SRC_O_N(addr, i)	(addr ##_reg - 0x004fc000 + (0x400 * i))
@@ -204,26 +208,36 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	struct dma_addr {
 		dma_addr_t src_addr;
 		dma_addr_t dst_addr;
-	} dma_addrs[2][2][3] = {
-		{ /* SRC */
-			/* Capture */
-			{{ 0,				0 },
-			 { RDMA_SRC_O_N(src, id),	0 },
-			 { RDMA_CMD_O_N(src, id),	0 }},
-			/* Playback */
-			{{ 0,				0, },
-			 { 0,				RDMA_SRC_I_N(src, id) },
-			 { 0,				RDMA_SRC_I_N(src, id) }}
-		}, { /* SSI */
-			/* Capture */
-			{{ RDMA_SSI_O_N(ssi, id),	0 },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) }},
-			/* Playback */
-			{{ 0,				RDMA_SSI_I_N(ssi, id) },
-			 { RDMA_SRC_O_P(src, id),	RDMA_SSI_I_P(ssi, id) },
-			 { RDMA_CMD_O_P(src, id),	RDMA_SSI_I_P(ssi, id) }}
-		}
+	} dma_addrs[3][2][3] = {
+		/* SRC */
+		{{{ 0,				0 },
+		/* Capture */
+		  { RDMA_SRC_O_N(src, id),	0 },
+		  { RDMA_CMD_O_N(src, id),	0 } },
+		 /* Playback */
+		 {{ 0,				0, },
+		  { 0,				RDMA_SRC_I_N(src, id) },
+		  { 0,				RDMA_SRC_I_N(src, id) } }
+		},
+		/* SSI */
+		/* Capture */
+		{{{ RDMA_SSI_O_N(ssi, id),	0 },
+		  { 0,				0 },
+		  { 0,				0 } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
+		  { 0,				0 },
+		  { 0,				0 } }
+		},
+		/* SSIU */
+		/* Capture */
+		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
+		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
@@ -232,6 +246,10 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		return;
 	}
 
+	/* use SSIU or SSI ? */
+	if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
+		is_ssi++;
+
 	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
 	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 39d98af..e492c13 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -185,6 +185,7 @@ enum rsnd_mod_type {
 
 struct rsnd_mod_ops {
 	char *name;
+	char* (*dma_name)(struct rsnd_mod *mod);
 	int (*probe)(struct rsnd_mod *mod,
 		     struct rsnd_dai *rdai);
 	int (*remove)(struct rsnd_mod *mod,
@@ -224,6 +225,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 		   enum rsnd_mod_type type,
 		   int id);
 char *rsnd_mod_name(struct rsnd_mod *mod);
+char *rsnd_mod_dma_name(struct rsnd_mod *mod);
 
 /*
  *	R-Car sound DAI
@@ -391,8 +393,12 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct rsnd_dai_stream *io,
 				   struct snd_pcm_runtime *runtime);
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai);
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif);
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+		       struct rsnd_dai *rdai,
+		       int use_busif);
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
 			    struct rsnd_dai *rdai);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 200eda0..4d39505 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -106,18 +106,17 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai)
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
 {
-	struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
 	 * SSI_MODE0
 	 */
 	rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
-		      src_mod ? 0 : (1 << ssi_id));
+		      !use_busif << ssi_id);
 
 	/*
 	 * SSI_MODE1
@@ -143,6 +142,29 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
 				      0x2 << shift : 0x1 << shift);
 	}
 
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif) {
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
+			       rsnd_get_adinr(ssi_mod));
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
+	}
+
+	return 0;
+}
+
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
+{
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif)
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0);
+
 	return 0;
 }
 
@@ -467,9 +489,6 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr(mod));
-	rsnd_mod_write(mod, SSI_BUSIF_MODE,  1);
-
 	rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
 
 	rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
@@ -554,7 +573,6 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
 
 	rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
 
-	rsnd_mod_write(mod, SSI_CTRL, 0x1);
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
 	return rsnd_src_start(mod, rdai);
@@ -565,7 +583,6 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
 {
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 
-	rsnd_mod_write(mod, SSI_CTRL, 0);
 	rsnd_mod_write(mod, SRC_CTRL, 0);
 
 	rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2df723d..34e8400 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -90,6 +90,20 @@ struct rsnd_ssi {
 #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
 #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
 
+static int rsnd_ssi_use_busif(struct rsnd_mod *mod)
+{
+	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+	int use_busif = 0;
+
+	if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF))
+		use_busif = 1;
+	if (rsnd_io_to_mod_src(io))
+		use_busif = 1;
+
+	return use_busif;
+}
+
 static void rsnd_ssi_status_check(struct rsnd_mod *mod,
 				  u32 bit)
 {
@@ -289,8 +303,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 	ssi->cr_own	= cr;
 	ssi->err	= -1; /* ignore 1st error */
 
-	rsnd_src_ssi_mode_init(mod, rdai);
-
 	return 0;
 }
 
@@ -389,6 +401,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
 	/* enable PIO IRQ */
 	ssi->cr_etc = UIEN | OIEN | DIEN;
 
+	rsnd_src_ssiu_start(mod, rdai, 0);
+
 	rsnd_src_enable_ssi_irq(mod, rdai);
 
 	rsnd_ssi_hw_start(ssi, rdai, io);
@@ -405,6 +419,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
 
 	rsnd_ssi_hw_stop(ssi, rdai);
 
+	rsnd_src_ssiu_stop(mod, rdai, 0);
+
 	return 0;
 }
 
@@ -457,6 +473,8 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
 	/* enable DMA transfer */
 	ssi->cr_etc = DMEN;
 
+	rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
+
 	rsnd_dma_start(dma);
 
 	rsnd_ssi_hw_start(ssi, ssi->rdai, io);
@@ -482,11 +500,19 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
 
 	rsnd_dma_stop(dma);
 
+	rsnd_src_ssiu_stop(mod, rdai, 1);
+
 	return 0;
 }
 
+static char *rsnd_ssi_dma_name(struct rsnd_mod *mod)
+{
+	return rsnd_ssi_use_busif(mod) ? "ssiu" : SSI_NAME;
+}
+
 static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
 	.name	= SSI_NAME,
+	.dma_name = rsnd_ssi_dma_name,
 	.probe	= rsnd_ssi_dma_probe,
 	.remove	= rsnd_ssi_dma_remove,
 	.init	= rsnd_ssi_init,
@@ -595,6 +621,9 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
 		 */
 		ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
 			0 : 1;
+
+		if (of_get_property(np, "no-busif", NULL))
+			ssi_info->flags |= RSND_SSI_NO_BUSIF;
 	}
 
 rsnd_of_parse_ssi_end:
-- 
1.7.9.5


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

* [PATCH 04/12] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:55   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
for snd_pcm_lib_preallocate_pages_for_all().
But, it came from original dma-sh7760.c,
and no longer needed.
This patch exchange its parameter, and removed
original dma mapping and un-needed
dma_sync_single_xxx() from driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-armadillo800eva.c |    4 +++
 arch/arm/mach-shmobile/board-kzm9g.c           |    2 ++
 arch/arm/mach-shmobile/board-mackerel.c        |    4 +++
 arch/sh/boards/mach-ecovec24/setup.c           |    2 ++
 sound/soc/sh/fsi.c                             |   42 +++---------------------
 5 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 395638d..4afe6ae 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1032,6 +1032,8 @@ static struct platform_device fsi_wm8978_device = {
 	.id	= 0,
 	.dev	= {
 		.platform_data	= &fsi_wm8978_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -1055,6 +1057,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index fff330f..bd60fba 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4648_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ece865..fa5e3eb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -521,6 +521,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -917,6 +919,8 @@ static struct platform_device fsi_ak4643_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4643_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 85d5255..0d30492 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi_da7210_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 710a079..7a6b632 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -233,7 +233,6 @@ struct fsi_stream {
 	 */
 	struct dma_chan		*chan;
 	struct work_struct	work;
-	dma_addr_t		dma;
 	int			dma_id;
 	int			loop_cnt;
 	int			additional_pos;
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
  */
 static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-				DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
 	/*
 	 * 24bit data : 24bit bus / package in back
 	 * 16bit data : 16bit bus / stream mode
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 
 	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
 	io->additional_pos = 0;
-	io->dma = dma_map_single(dai->dev, runtime->dma_area,
-				 snd_pcm_lib_buffer_bytes(io->substream), dir);
-	return 0;
-}
-
-static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
-	dma_unmap_single(dai->dev, io->dma,
-			 snd_pcm_lib_buffer_bytes(io->substream), dir);
 	return 0;
 }
 
@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
 	if (period >= runtime->periods)
 		period = 0;
 
-	return io->dma + samples_to_bytes(runtime, period * io->period_samples);
+	return runtime->dma_addr +
+		samples_to_bytes(runtime, period * io->period_samples);
 }
 
 static void fsi_dma_complete(void *data)
@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data)
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
 	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-	dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0),
-			samples_to_bytes(runtime, io->period_samples), dir);
 
 	io->buff_sample_pos += io->period_samples;
 	io->period_pos++;
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
 	for (i = 0; i < io->loop_cnt; i++) {
 		buf	= fsi_dma_get_area(io, io->additional_pos);
 
-		dma_sync_single_for_device(dai->dev, buf, len, dir);
-
 		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc) {
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 
 static struct fsi_stream_handler fsi_dma_push_handler = {
 	.init		= fsi_dma_init,
-	.quit		= fsi_dma_quit,
 	.probe		= fsi_dma_probe,
 	.transfer	= fsi_dma_transfer,
 	.remove		= fsi_dma_remove,
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
 
 static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
-	struct snd_pcm *pcm = rtd->pcm;
-
-	/*
-	 * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
-	 * in MMAP mode (i.e. aplay -M)
-	 */
 	return snd_pcm_lib_preallocate_pages_for_all(
-		pcm,
-		SNDRV_DMA_TYPE_CONTINUOUS,
-		snd_dma_continuous_data(GFP_KERNEL),
+		rtd->pcm,
+		SNDRV_DMA_TYPE_DEV,
+		rtd->card->snd_card->dev,
 		PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
 }
 
-- 
1.7.9.5


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

* [PATCH 04/12] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
@ 2014-06-18  8:55   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
for snd_pcm_lib_preallocate_pages_for_all().
But, it came from original dma-sh7760.c,
and no longer needed.
This patch exchange its parameter, and removed
original dma mapping and un-needed
dma_sync_single_xxx() from driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-armadillo800eva.c |    4 +++
 arch/arm/mach-shmobile/board-kzm9g.c           |    2 ++
 arch/arm/mach-shmobile/board-mackerel.c        |    4 +++
 arch/sh/boards/mach-ecovec24/setup.c           |    2 ++
 sound/soc/sh/fsi.c                             |   42 +++---------------------
 5 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 395638d..4afe6ae 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1032,6 +1032,8 @@ static struct platform_device fsi_wm8978_device = {
 	.id	= 0,
 	.dev	= {
 		.platform_data	= &fsi_wm8978_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -1055,6 +1057,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index fff330f..bd60fba 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4648_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ece865..fa5e3eb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -521,6 +521,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -917,6 +919,8 @@ static struct platform_device fsi_ak4643_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4643_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 85d5255..0d30492 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi_da7210_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 710a079..7a6b632 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -233,7 +233,6 @@ struct fsi_stream {
 	 */
 	struct dma_chan		*chan;
 	struct work_struct	work;
-	dma_addr_t		dma;
 	int			dma_id;
 	int			loop_cnt;
 	int			additional_pos;
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
  */
 static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-				DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
 	/*
 	 * 24bit data : 24bit bus / package in back
 	 * 16bit data : 16bit bus / stream mode
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 
 	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
 	io->additional_pos = 0;
-	io->dma = dma_map_single(dai->dev, runtime->dma_area,
-				 snd_pcm_lib_buffer_bytes(io->substream), dir);
-	return 0;
-}
-
-static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
-	dma_unmap_single(dai->dev, io->dma,
-			 snd_pcm_lib_buffer_bytes(io->substream), dir);
 	return 0;
 }
 
@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
 	if (period >= runtime->periods)
 		period = 0;
 
-	return io->dma + samples_to_bytes(runtime, period * io->period_samples);
+	return runtime->dma_addr +
+		samples_to_bytes(runtime, period * io->period_samples);
 }
 
 static void fsi_dma_complete(void *data)
@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data)
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
 	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-	dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0),
-			samples_to_bytes(runtime, io->period_samples), dir);
 
 	io->buff_sample_pos += io->period_samples;
 	io->period_pos++;
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
 	for (i = 0; i < io->loop_cnt; i++) {
 		buf	= fsi_dma_get_area(io, io->additional_pos);
 
-		dma_sync_single_for_device(dai->dev, buf, len, dir);
-
 		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc) {
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 
 static struct fsi_stream_handler fsi_dma_push_handler = {
 	.init		= fsi_dma_init,
-	.quit		= fsi_dma_quit,
 	.probe		= fsi_dma_probe,
 	.transfer	= fsi_dma_transfer,
 	.remove		= fsi_dma_remove,
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
 
 static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
-	struct snd_pcm *pcm = rtd->pcm;
-
-	/*
-	 * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
-	 * in MMAP mode (i.e. aplay -M)
-	 */
 	return snd_pcm_lib_preallocate_pages_for_all(
-		pcm,
-		SNDRV_DMA_TYPE_CONTINUOUS,
-		snd_dma_continuous_data(GFP_KERNEL),
+		rtd->pcm,
+		SNDRV_DMA_TYPE_DEV,
+		rtd->card->snd_card->dev,
 		PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
 }
 
-- 
1.7.9.5


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

* [PATCH 05/12] ASoC: fsi: add fsi_pointer_update() for common pointer method
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

fsi PIO/DMA handler are using each own pointer update method,
but these can be share.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |   57 ++++++++++++++++++++--------------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7a6b632..820a408 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1041,6 +1041,26 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
 	return ret;
 }
 
+static void fsi_pointer_update(struct fsi_stream *io, int size)
+{
+	io->buff_sample_pos += size;
+
+	if (io->buff_sample_pos >+	    io->period_samples * (io->period_pos + 1)) {
+		struct snd_pcm_substream *substream = io->substream;
+		struct snd_pcm_runtime *runtime = substream->runtime;
+
+		io->period_pos++;
+
+		if (io->period_pos >= runtime->periods) {
+			io->buff_sample_pos = 0;
+			io->period_pos = 0;
+		}
+
+		snd_pcm_period_elapsed(substream);
+	}
+}
+
 /*
  *		pio data transfer handler
  */
@@ -1107,31 +1127,11 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples),
 		int samples)
 {
-	struct snd_pcm_runtime *runtime;
-	struct snd_pcm_substream *substream;
 	u8 *buf;
-	int over_period;
 
 	if (!fsi_stream_is_working(fsi, io))
 		return -EINVAL;
 
-	over_period	= 0;
-	substream	= io->substream;
-	runtime		= substream->runtime;
-
-	/* FSI FIFO has limit.
-	 * So, this driver can not send periods data at a time
-	 */
-	if (io->buff_sample_pos >-	    io->period_samples * (io->period_pos + 1)) {
-
-		over_period = 1;
-		io->period_pos = (io->period_pos + 1) % runtime->periods;
-
-		if (0 = io->period_pos)
-			io->buff_sample_pos = 0;
-	}
-
 	buf = fsi_pio_get_area(fsi, io);
 
 	switch (io->sample_width) {
@@ -1145,11 +1145,7 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		return -EINVAL;
 	}
 
-	/* update buff_sample_pos */
-	io->buff_sample_pos += samples;
-
-	if (over_period)
-		snd_pcm_period_elapsed(substream);
+	fsi_pointer_update(io, samples);
 
 	return 0;
 }
@@ -1307,20 +1303,11 @@ static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
 
-	io->buff_sample_pos += io->period_samples;
-	io->period_pos++;
-
-	if (io->period_pos >= runtime->periods) {
-		io->period_pos = 0;
-		io->buff_sample_pos = 0;
-	}
+	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
 	fsi_stream_transfer(io);
-
-	snd_pcm_period_elapsed(io->substream);
 }
 
 static void fsi_dma_do_work(struct work_struct *work)
-- 
1.7.9.5


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

* [PATCH 05/12] ASoC: fsi: add fsi_pointer_update() for common pointer method
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

fsi PIO/DMA handler are using each own pointer update method,
but these can be share.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |   57 ++++++++++++++++++++--------------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7a6b632..820a408 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1041,6 +1041,26 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
 	return ret;
 }
 
+static void fsi_pointer_update(struct fsi_stream *io, int size)
+{
+	io->buff_sample_pos += size;
+
+	if (io->buff_sample_pos >=
+	    io->period_samples * (io->period_pos + 1)) {
+		struct snd_pcm_substream *substream = io->substream;
+		struct snd_pcm_runtime *runtime = substream->runtime;
+
+		io->period_pos++;
+
+		if (io->period_pos >= runtime->periods) {
+			io->buff_sample_pos = 0;
+			io->period_pos = 0;
+		}
+
+		snd_pcm_period_elapsed(substream);
+	}
+}
+
 /*
  *		pio data transfer handler
  */
@@ -1107,31 +1127,11 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples),
 		int samples)
 {
-	struct snd_pcm_runtime *runtime;
-	struct snd_pcm_substream *substream;
 	u8 *buf;
-	int over_period;
 
 	if (!fsi_stream_is_working(fsi, io))
 		return -EINVAL;
 
-	over_period	= 0;
-	substream	= io->substream;
-	runtime		= substream->runtime;
-
-	/* FSI FIFO has limit.
-	 * So, this driver can not send periods data at a time
-	 */
-	if (io->buff_sample_pos >=
-	    io->period_samples * (io->period_pos + 1)) {
-
-		over_period = 1;
-		io->period_pos = (io->period_pos + 1) % runtime->periods;
-
-		if (0 == io->period_pos)
-			io->buff_sample_pos = 0;
-	}
-
 	buf = fsi_pio_get_area(fsi, io);
 
 	switch (io->sample_width) {
@@ -1145,11 +1145,7 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		return -EINVAL;
 	}
 
-	/* update buff_sample_pos */
-	io->buff_sample_pos += samples;
-
-	if (over_period)
-		snd_pcm_period_elapsed(substream);
+	fsi_pointer_update(io, samples);
 
 	return 0;
 }
@@ -1307,20 +1303,11 @@ static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
 
-	io->buff_sample_pos += io->period_samples;
-	io->period_pos++;
-
-	if (io->period_pos >= runtime->periods) {
-		io->period_pos = 0;
-		io->buff_sample_pos = 0;
-	}
+	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
 	fsi_stream_transfer(io);
-
-	snd_pcm_period_elapsed(io->substream);
 }
 
 static void fsi_dma_do_work(struct work_struct *work)
-- 
1.7.9.5


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

* [PATCH 06/12] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current FSI driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |   94 +++++++++++++++-------------------------------------
 1 file changed, 27 insertions(+), 67 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 820a408..a57eb96 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -232,10 +232,7 @@ struct fsi_stream {
 	 * these are for DMAEngine
 	 */
 	struct dma_chan		*chan;
-	struct work_struct	work;
 	int			dma_id;
-	int			loop_cnt;
-	int			additional_pos;
 };
 
 struct fsi_clk {
@@ -1281,24 +1278,9 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 	io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
 			 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
 
-	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
-	io->additional_pos = 0;
-
 	return 0;
 }
 
-static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
-{
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	int period = io->period_pos + additional;
-
-	if (period >= runtime->periods)
-		period = 0;
-
-	return runtime->dma_addr +
-		samples_to_bytes(runtime, period * io->period_samples);
-}
-
 static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1307,53 +1289,37 @@ static void fsi_dma_complete(void *data)
 	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
-	fsi_stream_transfer(io);
 }
 
-static void fsi_dma_do_work(struct work_struct *work)
+static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct fsi_stream *io = container_of(work, struct fsi_stream, work);
-	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_soc_dai *dai;
+	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+	struct snd_pcm_substream *substream = io->substream;
 	struct dma_async_tx_descriptor *desc;
-	struct snd_pcm_runtime *runtime;
-	enum dma_data_direction dir;
 	int is_play = fsi_stream_is_play(fsi, io);
-	int len, i;
-	dma_addr_t buf;
-
-	if (!fsi_stream_is_working(fsi, io))
-		return;
-
-	dai	= fsi_get_dai(io->substream);
-	runtime	= io->substream->runtime;
-	dir	= is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	len	= samples_to_bytes(runtime, io->period_samples);
-
-	for (i = 0; i < io->loop_cnt; i++) {
-		buf	= fsi_dma_get_area(io, io->additional_pos);
-
-		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
-					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= fsi_dma_complete;
-		desc->callback_param	= io;
-
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dai->dev, "tx_submit() fail\n");
-			return;
-		}
+	enum dma_data_direction dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	int ret = -EIO;
+
+	desc = dmaengine_prep_dma_cyclic(io->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+	if (!desc) {
+		dev_err(dai->dev, "dmaengine_prep_dma_cyclic() fail\n");
+		goto fsi_dma_transfer_err;
+	}
 
-		dma_async_issue_pending(io->chan);
+	desc->callback		= fsi_dma_complete;
+	desc->callback_param	= io;
 
-		io->additional_pos = 1;
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dai->dev, "tx_submit() fail\n");
+		goto fsi_dma_transfer_err;
 	}
 
-	io->loop_cnt = 1;
+	dma_async_issue_pending(io->chan);
 
 	/*
 	 * FIXME
@@ -1370,13 +1336,11 @@ static void fsi_dma_do_work(struct work_struct *work)
 			fsi_reg_write(fsi, DIFF_ST, 0);
 		}
 	}
-}
 
-static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	schedule_work(&io->work);
+	ret = 0;
 
-	return 0;
+fsi_dma_transfer_err:
+	return ret;
 }
 
 static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
@@ -1437,15 +1401,11 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
 		return fsi_stream_probe(fsi, dev);
 	}
 
-	INIT_WORK(&io->work, fsi_dma_do_work);
-
 	return 0;
 }
 
 static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	cancel_work_sync(&io->work);
-
 	fsi_stream_stop(fsi, io);
 
 	if (io->chan)
@@ -1618,9 +1578,9 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		if (!ret)
 			ret = fsi_hw_startup(fsi, io, dai->dev);
 		if (!ret)
-			ret = fsi_stream_transfer(io);
+			ret = fsi_stream_start(fsi, io);
 		if (!ret)
-			fsi_stream_start(fsi, io);
+			ret = fsi_stream_transfer(io);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (!ret)
-- 
1.7.9.5


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

* [PATCH 06/12] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current FSI driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |   94 +++++++++++++++-------------------------------------
 1 file changed, 27 insertions(+), 67 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 820a408..a57eb96 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -232,10 +232,7 @@ struct fsi_stream {
 	 * these are for DMAEngine
 	 */
 	struct dma_chan		*chan;
-	struct work_struct	work;
 	int			dma_id;
-	int			loop_cnt;
-	int			additional_pos;
 };
 
 struct fsi_clk {
@@ -1281,24 +1278,9 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 	io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
 			 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
 
-	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
-	io->additional_pos = 0;
-
 	return 0;
 }
 
-static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
-{
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	int period = io->period_pos + additional;
-
-	if (period >= runtime->periods)
-		period = 0;
-
-	return runtime->dma_addr +
-		samples_to_bytes(runtime, period * io->period_samples);
-}
-
 static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1307,53 +1289,37 @@ static void fsi_dma_complete(void *data)
 	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
-	fsi_stream_transfer(io);
 }
 
-static void fsi_dma_do_work(struct work_struct *work)
+static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct fsi_stream *io = container_of(work, struct fsi_stream, work);
-	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_soc_dai *dai;
+	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+	struct snd_pcm_substream *substream = io->substream;
 	struct dma_async_tx_descriptor *desc;
-	struct snd_pcm_runtime *runtime;
-	enum dma_data_direction dir;
 	int is_play = fsi_stream_is_play(fsi, io);
-	int len, i;
-	dma_addr_t buf;
-
-	if (!fsi_stream_is_working(fsi, io))
-		return;
-
-	dai	= fsi_get_dai(io->substream);
-	runtime	= io->substream->runtime;
-	dir	= is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	len	= samples_to_bytes(runtime, io->period_samples);
-
-	for (i = 0; i < io->loop_cnt; i++) {
-		buf	= fsi_dma_get_area(io, io->additional_pos);
-
-		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
-					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= fsi_dma_complete;
-		desc->callback_param	= io;
-
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dai->dev, "tx_submit() fail\n");
-			return;
-		}
+	enum dma_data_direction dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	int ret = -EIO;
+
+	desc = dmaengine_prep_dma_cyclic(io->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+	if (!desc) {
+		dev_err(dai->dev, "dmaengine_prep_dma_cyclic() fail\n");
+		goto fsi_dma_transfer_err;
+	}
 
-		dma_async_issue_pending(io->chan);
+	desc->callback		= fsi_dma_complete;
+	desc->callback_param	= io;
 
-		io->additional_pos = 1;
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dai->dev, "tx_submit() fail\n");
+		goto fsi_dma_transfer_err;
 	}
 
-	io->loop_cnt = 1;
+	dma_async_issue_pending(io->chan);
 
 	/*
 	 * FIXME
@@ -1370,13 +1336,11 @@ static void fsi_dma_do_work(struct work_struct *work)
 			fsi_reg_write(fsi, DIFF_ST, 0);
 		}
 	}
-}
 
-static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	schedule_work(&io->work);
+	ret = 0;
 
-	return 0;
+fsi_dma_transfer_err:
+	return ret;
 }
 
 static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
@@ -1437,15 +1401,11 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
 		return fsi_stream_probe(fsi, dev);
 	}
 
-	INIT_WORK(&io->work, fsi_dma_do_work);
-
 	return 0;
 }
 
 static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	cancel_work_sync(&io->work);
-
 	fsi_stream_stop(fsi, io);
 
 	if (io->chan)
@@ -1618,9 +1578,9 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		if (!ret)
 			ret = fsi_hw_startup(fsi, io, dai->dev);
 		if (!ret)
-			ret = fsi_stream_transfer(io);
+			ret = fsi_stream_start(fsi, io);
 		if (!ret)
-			fsi_stream_start(fsi, io);
+			ret = fsi_stream_transfer(io);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (!ret)
-- 
1.7.9.5


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

* [PATCH 07/12] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   76 +++++++++++-----------------------------------
 sound/soc/sh/rcar/rsnd.h |    4 ---
 2 files changed, 18 insertions(+), 62 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 1a59602..5a4d7e0 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -164,26 +164,8 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 /*
  *	rsnd_dma functions
  */
-static void __rsnd_dma_start(struct rsnd_dma *dma);
-static void rsnd_dma_continue(struct rsnd_dma *dma)
-{
-	/* push next A or B plane */
-	dma->submit_loop = 1;
-	schedule_work(&dma->work);
-}
-
-void rsnd_dma_start(struct rsnd_dma *dma)
-{
-	/* push both A and B plane*/
-	dma->offset = 0;
-	dma->submit_loop = 2;
-	__rsnd_dma_start(dma);
-}
-
 void rsnd_dma_stop(struct rsnd_dma *dma)
 {
-	dma->submit_loop = 0;
-	cancel_work_sync(&dma->work);
 	dmaengine_terminate_all(dma->chan);
 }
 
@@ -191,11 +173,7 @@ static void rsnd_dma_complete(void *data)
 {
 	struct rsnd_dma *dma = (struct rsnd_dma *)data;
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	unsigned long flags;
-
-	rsnd_lock(priv, flags);
 
 	/*
 	 * Renesas sound Gen1 needs 1 DMAC,
@@ -208,57 +186,40 @@ static void rsnd_dma_complete(void *data)
 	 * rsnd_dai_pointer_update() will be called twice,
 	 * ant it will breaks io->byte_pos
 	 */
-	if (dma->submit_loop)
-		rsnd_dma_continue(dma);
-
-	rsnd_unlock(priv, flags);
 
 	rsnd_dai_pointer_update(io, io->byte_per_period);
 }
 
-static void __rsnd_dma_start(struct rsnd_dma *dma)
+void rsnd_dma_start(struct rsnd_dma *dma)
 {
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct snd_pcm_substream *substream = io->substream;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_async_tx_descriptor *desc;
-	dma_addr_t buf;
-	size_t len = io->byte_per_period;
-	int i;
-
-	for (i = 0; i < dma->submit_loop; i++) {
 
-		buf = runtime->dma_addr +
-			rsnd_dai_pointer_offset(io, dma->offset + len);
-		dma->offset = len;
+	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dma->dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
-		desc = dmaengine_prep_slave_single(
-			dma->chan, buf, len, dma->dir,
-			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= rsnd_dma_complete;
-		desc->callback_param	= dma;
+	if (!desc) {
+		dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
+		return;
+	}
 
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dev, "dmaengine_submit() fail\n");
-			return;
-		}
+	desc->callback		= rsnd_dma_complete;
+	desc->callback_param	= dma;
 
-		dma_async_issue_pending(dma->chan);
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dev, "dmaengine_submit() fail\n");
+		return;
 	}
-}
-
-static void rsnd_dma_do_work(struct work_struct *work)
-{
-	struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
 
-	__rsnd_dma_start(dma);
+	dma_async_issue_pending(dma->chan);
 }
 
 int rsnd_dma_available(struct rsnd_dma *dma)
@@ -372,7 +333,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		goto rsnd_dma_init_err;
 
 	dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	INIT_WORK(&dma->work, rsnd_dma_do_work);
 
 	return 0;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index e492c13..be17136 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -156,12 +156,8 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod);
  */
 struct rsnd_dma {
 	struct sh_dmae_slave	slave;
-	struct work_struct	work;
 	struct dma_chan		*chan;
 	enum dma_data_direction dir;
-
-	int submit_loop;
-	int offset; /* it cares A/B plane */
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 07/12] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   76 +++++++++++-----------------------------------
 sound/soc/sh/rcar/rsnd.h |    4 ---
 2 files changed, 18 insertions(+), 62 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 1a59602..5a4d7e0 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -164,26 +164,8 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 /*
  *	rsnd_dma functions
  */
-static void __rsnd_dma_start(struct rsnd_dma *dma);
-static void rsnd_dma_continue(struct rsnd_dma *dma)
-{
-	/* push next A or B plane */
-	dma->submit_loop = 1;
-	schedule_work(&dma->work);
-}
-
-void rsnd_dma_start(struct rsnd_dma *dma)
-{
-	/* push both A and B plane*/
-	dma->offset = 0;
-	dma->submit_loop = 2;
-	__rsnd_dma_start(dma);
-}
-
 void rsnd_dma_stop(struct rsnd_dma *dma)
 {
-	dma->submit_loop = 0;
-	cancel_work_sync(&dma->work);
 	dmaengine_terminate_all(dma->chan);
 }
 
@@ -191,11 +173,7 @@ static void rsnd_dma_complete(void *data)
 {
 	struct rsnd_dma *dma = (struct rsnd_dma *)data;
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	unsigned long flags;
-
-	rsnd_lock(priv, flags);
 
 	/*
 	 * Renesas sound Gen1 needs 1 DMAC,
@@ -208,57 +186,40 @@ static void rsnd_dma_complete(void *data)
 	 * rsnd_dai_pointer_update() will be called twice,
 	 * ant it will breaks io->byte_pos
 	 */
-	if (dma->submit_loop)
-		rsnd_dma_continue(dma);
-
-	rsnd_unlock(priv, flags);
 
 	rsnd_dai_pointer_update(io, io->byte_per_period);
 }
 
-static void __rsnd_dma_start(struct rsnd_dma *dma)
+void rsnd_dma_start(struct rsnd_dma *dma)
 {
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct snd_pcm_substream *substream = io->substream;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_async_tx_descriptor *desc;
-	dma_addr_t buf;
-	size_t len = io->byte_per_period;
-	int i;
-
-	for (i = 0; i < dma->submit_loop; i++) {
 
-		buf = runtime->dma_addr +
-			rsnd_dai_pointer_offset(io, dma->offset + len);
-		dma->offset = len;
+	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dma->dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
-		desc = dmaengine_prep_slave_single(
-			dma->chan, buf, len, dma->dir,
-			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= rsnd_dma_complete;
-		desc->callback_param	= dma;
+	if (!desc) {
+		dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
+		return;
+	}
 
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dev, "dmaengine_submit() fail\n");
-			return;
-		}
+	desc->callback		= rsnd_dma_complete;
+	desc->callback_param	= dma;
 
-		dma_async_issue_pending(dma->chan);
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dev, "dmaengine_submit() fail\n");
+		return;
 	}
-}
-
-static void rsnd_dma_do_work(struct work_struct *work)
-{
-	struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
 
-	__rsnd_dma_start(dma);
+	dma_async_issue_pending(dma->chan);
 }
 
 int rsnd_dma_available(struct rsnd_dma *dma)
@@ -372,7 +333,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		goto rsnd_dma_init_err;
 
 	dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	INIT_WORK(&dma->work, rsnd_dma_do_work);
 
 	return 0;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index e492c13..be17136 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -156,12 +156,8 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod);
  */
 struct rsnd_dma {
 	struct sh_dmae_slave	slave;
-	struct work_struct	work;
 	struct dma_chan		*chan;
 	enum dma_data_direction dir;
-
-	int submit_loop;
-	int offset; /* it cares A/B plane */
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 08/12] ASoC: rsnd: enable DVC when capture
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

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

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index ed00070..deef310 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -191,24 +191,20 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct snd_soc_pcm_runtime *rtd)
 {
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-	struct device *dev = rsnd_priv_to_dev(priv);
 	struct snd_card *card = rtd->card->snd_card;
 	struct snd_kcontrol *kctrl;
 	static struct snd_kcontrol_new knew = {
 		.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name		= "Playback Volume",
 		.info		= rsnd_dvc_volume_info,
 		.get		= rsnd_dvc_volume_get,
 		.put		= rsnd_dvc_volume_put,
 	};
 	int ret;
 
-	if (!rsnd_dai_is_play(rdai, io)) {
-		dev_err(dev, "DVC%d is connected to Capture DAI\n",
-			rsnd_mod_id(mod));
-		return -EINVAL;
-	}
+	if (rsnd_dai_is_play(rdai, io))
+		knew.name = "Playback Volume";
+	else
+		knew.name = "Capture Volume";
 
 	kctrl = snd_ctl_new1(&knew, mod);
 	if (!kctrl)
-- 
1.7.9.5


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

* [PATCH 08/12] ASoC: rsnd: enable DVC when capture
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

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

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index ed00070..deef310 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -191,24 +191,20 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct snd_soc_pcm_runtime *rtd)
 {
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-	struct device *dev = rsnd_priv_to_dev(priv);
 	struct snd_card *card = rtd->card->snd_card;
 	struct snd_kcontrol *kctrl;
 	static struct snd_kcontrol_new knew = {
 		.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name		= "Playback Volume",
 		.info		= rsnd_dvc_volume_info,
 		.get		= rsnd_dvc_volume_get,
 		.put		= rsnd_dvc_volume_put,
 	};
 	int ret;
 
-	if (!rsnd_dai_is_play(rdai, io)) {
-		dev_err(dev, "DVC%d is connected to Capture DAI\n",
-			rsnd_mod_id(mod));
-		return -EINVAL;
-	}
+	if (rsnd_dai_is_play(rdai, io))
+		knew.name = "Playback Volume";
+	else
+		knew.name = "Capture Volume";
 
 	kctrl = snd_ctl_new1(&knew, mod);
 	if (!kctrl)
-- 
1.7.9.5


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

* [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

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

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


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

* [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

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

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


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

* [PATCH 10/12] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   45 +++++++++++++++++++----------
 sound/soc/sh/rcar/gen.c  |   71 ++++++++++++++++++++--------------------------
 sound/soc/sh/rcar/rsnd.h |    7 ++---
 3 files changed, 64 insertions(+), 59 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 5a4d7e0..36895eb 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -239,8 +239,21 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 
 }
 
-static void rsnd_dma_of_name(struct rsnd_dma *dma,
-			     int is_play, char *dma_name)
+static void rsnd_dma_of_name(struct rsnd_mod *mod_from,
+			     struct rsnd_mod *mod_to,
+			     char *dma_name)
+{
+	int index = 0;
+
+	index = _rsnd_dma_of_name(dma_name + index, mod_from);
+	*(dma_name + index++) = '_';
+	index = _rsnd_dma_of_name(dma_name + index, mod_to);
+}
+
+static void rsnd_dma_of_path(struct rsnd_dma *dma,
+			     int is_play,
+			     struct rsnd_mod **mod_from,
+			     struct rsnd_mod **mod_to)
 {
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
@@ -248,7 +261,6 @@ static void rsnd_dma_of_name(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];
-	struct rsnd_mod *src_mod, *dst_mod;
 	int i, index;
 
 
@@ -285,17 +297,12 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	}
 
 	if (is_play) {
-		src_mod = mod[index - 1];
-		dst_mod = mod[index];
+		*mod_from = mod[index - 1];
+		*mod_to   = mod[index];
 	} else {
-		src_mod = mod[index];
-		dst_mod = mod[index - 1];
+		*mod_from = mod[index];
+		*mod_to   = mod[index - 1];
 	}
-
-	index = 0;
-	index = _rsnd_dma_of_name(dma_name + index, src_mod);
-	*(dma_name + index++) = '_';
-	index = _rsnd_dma_of_name(dma_name + index, dst_mod);
 }
 
 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
@@ -303,6 +310,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_slave_config cfg;
+	struct rsnd_mod *mod_from;
+	struct rsnd_mod *mod_to;
 	char dma_name[DMA_NAME_SIZE];
 	dma_cap_mask_t mask;
 	int ret;
@@ -315,10 +324,16 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	rsnd_dma_of_name(dma, is_play, dma_name);
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+	rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
+	rsnd_dma_of_name(mod_from, mod_to, dma_name);
+
+	cfg.slave_id	= id;
+	cfg.direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	cfg.src_addr	= rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
+	cfg.dst_addr	= rsnd_gen_dma_addr(priv, mod_to,   is_play, 0);
 
-	dev_dbg(dev, "dma name : %s\n", dma_name);
+	dev_dbg(dev, "dma : %s %pad -> %pad\n",
+		dma_name, &cfg.src_addr, &cfg.dst_addr);
 
 	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
 						     (void *)id, dev,
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 46677af..73ce4c9 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -168,7 +168,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
  *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
- *	CMD : 0xec500000 / 0xec008000                             0xec308000
+ *	CMD : 0xec500000 /            / 0xec008000                0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
@@ -188,14 +188,13 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+static dma_addr_t
+rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+		   struct rsnd_mod *mod,
+		   int is_play, int is_from)
 {
 	struct platform_device *pdev = rsnd_priv_to_pdev(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 	dma_addr_t ssi_reg = platform_get_resource(pdev,
 				IORESOURCE_MEM, RSND_GEN2_SSI)->start;
@@ -206,76 +205,68 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	int use_dvc = !!rsnd_io_to_mod_dvc(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
-		dma_addr_t src_addr;
-		dma_addr_t dst_addr;
+		dma_addr_t out_addr;
+		dma_addr_t in_addr;
 	} dma_addrs[3][2][3] = {
 		/* SRC */
 		{{{ 0,				0 },
 		/* Capture */
-		  { RDMA_SRC_O_N(src, id),	0 },
-		  { RDMA_CMD_O_N(src, id),	0 } },
+		  { RDMA_SRC_O_N(src, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_CMD_O_N(src, id),	RDMA_SRC_I_P(src, id) } },
 		 /* Playback */
 		 {{ 0,				0, },
-		  { 0,				RDMA_SRC_I_N(src, id) },
-		  { 0,				RDMA_SRC_I_N(src, id) } }
+		  { RDMA_SRC_O_P(src, id),	RDMA_SRC_I_N(src, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SRC_I_N(src, id) } }
 		},
 		/* SSI */
 		/* Capture */
 		{{{ RDMA_SSI_O_N(ssi, id),	0 },
-		  { 0,				0 },
-		  { 0,				0 } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
-		  { 0,				0 },
-		  { 0,				0 } }
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } }
 		},
 		/* SSIU */
 		/* Capture */
 		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
-		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
-		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc & !use_src) {
+	if (use_dvc & !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
-		return;
-	}
 
 	/* use SSIU or SSI ? */
 	if (is_ssi && (0 = strcmp(rsnd_mod_dma_name(mod), "ssiu")))
 		is_ssi++;
 
-	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
-	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
-
-	dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
-		id, cfg->src_addr, cfg->dst_addr);
+	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;
 }
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+			     struct rsnd_mod *mod,
+			     int is_play, int is_from)
 {
-	cfg->slave_id   = slave_id;
-	cfg->src_addr   = 0;
-	cfg->dst_addr   = 0;
-	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
 	/*
 	 * gen1 uses default DMA addr
 	 */
 	if (rsnd_is_gen1(priv))
-		return;
+		return 0;
 
-	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
-}
+	if (!mod)
+		return 0;
 
+	return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
+}
 
 /*
  *		Gen2
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index be17136..70a91b0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -279,10 +279,9 @@ int rsnd_gen_probe(struct platform_device *pdev,
 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
 			       struct rsnd_mod *mod,
 			       enum rsnd_reg reg);
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play,  int slave_id);
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_mod *mod,
+		       int is_play,  int is_from);
 
 #define rsnd_is_gen1(s)		(((s)->info->flags & RSND_GEN_MASK) = RSND_GEN1)
 #define rsnd_is_gen2(s)		(((s)->info->flags & RSND_GEN_MASK) = RSND_GEN2)
-- 
1.7.9.5


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

* [PATCH 10/12] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
@ 2014-06-18  8:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |   45 +++++++++++++++++++----------
 sound/soc/sh/rcar/gen.c  |   71 ++++++++++++++++++++--------------------------
 sound/soc/sh/rcar/rsnd.h |    7 ++---
 3 files changed, 64 insertions(+), 59 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 5a4d7e0..36895eb 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -239,8 +239,21 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 
 }
 
-static void rsnd_dma_of_name(struct rsnd_dma *dma,
-			     int is_play, char *dma_name)
+static void rsnd_dma_of_name(struct rsnd_mod *mod_from,
+			     struct rsnd_mod *mod_to,
+			     char *dma_name)
+{
+	int index = 0;
+
+	index = _rsnd_dma_of_name(dma_name + index, mod_from);
+	*(dma_name + index++) = '_';
+	index = _rsnd_dma_of_name(dma_name + index, mod_to);
+}
+
+static void rsnd_dma_of_path(struct rsnd_dma *dma,
+			     int is_play,
+			     struct rsnd_mod **mod_from,
+			     struct rsnd_mod **mod_to)
 {
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
@@ -248,7 +261,6 @@ static void rsnd_dma_of_name(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];
-	struct rsnd_mod *src_mod, *dst_mod;
 	int i, index;
 
 
@@ -285,17 +297,12 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	}
 
 	if (is_play) {
-		src_mod = mod[index - 1];
-		dst_mod = mod[index];
+		*mod_from = mod[index - 1];
+		*mod_to   = mod[index];
 	} else {
-		src_mod = mod[index];
-		dst_mod = mod[index - 1];
+		*mod_from = mod[index];
+		*mod_to   = mod[index - 1];
 	}
-
-	index = 0;
-	index = _rsnd_dma_of_name(dma_name + index, src_mod);
-	*(dma_name + index++) = '_';
-	index = _rsnd_dma_of_name(dma_name + index, dst_mod);
 }
 
 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
@@ -303,6 +310,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_slave_config cfg;
+	struct rsnd_mod *mod_from;
+	struct rsnd_mod *mod_to;
 	char dma_name[DMA_NAME_SIZE];
 	dma_cap_mask_t mask;
 	int ret;
@@ -315,10 +324,16 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	rsnd_dma_of_name(dma, is_play, dma_name);
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+	rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
+	rsnd_dma_of_name(mod_from, mod_to, dma_name);
+
+	cfg.slave_id	= id;
+	cfg.direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	cfg.src_addr	= rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
+	cfg.dst_addr	= rsnd_gen_dma_addr(priv, mod_to,   is_play, 0);
 
-	dev_dbg(dev, "dma name : %s\n", dma_name);
+	dev_dbg(dev, "dma : %s %pad -> %pad\n",
+		dma_name, &cfg.src_addr, &cfg.dst_addr);
 
 	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
 						     (void *)id, dev,
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 46677af..73ce4c9 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -168,7 +168,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
  *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
- *	CMD : 0xec500000 / 0xec008000                             0xec308000
+ *	CMD : 0xec500000 /            / 0xec008000                0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
@@ -188,14 +188,13 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+static dma_addr_t
+rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+		   struct rsnd_mod *mod,
+		   int is_play, int is_from)
 {
 	struct platform_device *pdev = rsnd_priv_to_pdev(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 	dma_addr_t ssi_reg = platform_get_resource(pdev,
 				IORESOURCE_MEM, RSND_GEN2_SSI)->start;
@@ -206,76 +205,68 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	int use_dvc = !!rsnd_io_to_mod_dvc(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
-		dma_addr_t src_addr;
-		dma_addr_t dst_addr;
+		dma_addr_t out_addr;
+		dma_addr_t in_addr;
 	} dma_addrs[3][2][3] = {
 		/* SRC */
 		{{{ 0,				0 },
 		/* Capture */
-		  { RDMA_SRC_O_N(src, id),	0 },
-		  { RDMA_CMD_O_N(src, id),	0 } },
+		  { RDMA_SRC_O_N(src, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_CMD_O_N(src, id),	RDMA_SRC_I_P(src, id) } },
 		 /* Playback */
 		 {{ 0,				0, },
-		  { 0,				RDMA_SRC_I_N(src, id) },
-		  { 0,				RDMA_SRC_I_N(src, id) } }
+		  { RDMA_SRC_O_P(src, id),	RDMA_SRC_I_N(src, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SRC_I_N(src, id) } }
 		},
 		/* SSI */
 		/* Capture */
 		{{{ RDMA_SSI_O_N(ssi, id),	0 },
-		  { 0,				0 },
-		  { 0,				0 } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
-		  { 0,				0 },
-		  { 0,				0 } }
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } }
 		},
 		/* SSIU */
 		/* Capture */
 		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
-		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
-		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc & !use_src) {
+	if (use_dvc & !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
-		return;
-	}
 
 	/* use SSIU or SSI ? */
 	if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
 		is_ssi++;
 
-	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
-	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
-
-	dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
-		id, cfg->src_addr, cfg->dst_addr);
+	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;
 }
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+			     struct rsnd_mod *mod,
+			     int is_play, int is_from)
 {
-	cfg->slave_id   = slave_id;
-	cfg->src_addr   = 0;
-	cfg->dst_addr   = 0;
-	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
 	/*
 	 * gen1 uses default DMA addr
 	 */
 	if (rsnd_is_gen1(priv))
-		return;
+		return 0;
 
-	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
-}
+	if (!mod)
+		return 0;
 
+	return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
+}
 
 /*
  *		Gen2
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index be17136..70a91b0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -279,10 +279,9 @@ int rsnd_gen_probe(struct platform_device *pdev,
 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
 			       struct rsnd_mod *mod,
 			       enum rsnd_reg reg);
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play,  int slave_id);
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_mod *mod,
+		       int is_play,  int is_from);
 
 #define rsnd_is_gen1(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
 #define rsnd_is_gen2(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
-- 
1.7.9.5


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

* [PATCH 11/12] ASoC: rsnd: DMA start address is properly used for each DMAC
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:57   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |    2 ++
 sound/soc/sh/rcar/rsnd.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 36895eb..6fb89fc 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
 	struct dma_async_tx_descriptor *desc;
 
 	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 (dma->addr) ? dma->addr :
 					 substream->runtime->dma_addr,
 					 snd_pcm_lib_buffer_bytes(substream),
 					 snd_pcm_lib_period_bytes(substream),
@@ -347,6 +348,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	if (ret < 0)
 		goto rsnd_dma_init_err;
 
+	dma->addr = is_play ? cfg.src_addr : cfg.dst_addr;
 	dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
 	return 0;
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 70a91b0..f75c535 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -158,6 +158,7 @@ struct rsnd_dma {
 	struct sh_dmae_slave	slave;
 	struct dma_chan		*chan;
 	enum dma_data_direction dir;
+	dma_addr_t		addr;
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 11/12] ASoC: rsnd: DMA start address is properly used for each DMAC
@ 2014-06-18  8:57   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c |    2 ++
 sound/soc/sh/rcar/rsnd.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 36895eb..6fb89fc 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
 	struct dma_async_tx_descriptor *desc;
 
 	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 (dma->addr) ? dma->addr :
 					 substream->runtime->dma_addr,
 					 snd_pcm_lib_buffer_bytes(substream),
 					 snd_pcm_lib_period_bytes(substream),
@@ -347,6 +348,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	if (ret < 0)
 		goto rsnd_dma_init_err;
 
+	dma->addr = is_play ? cfg.src_addr : cfg.dst_addr;
 	dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
 	return 0;
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 70a91b0..f75c535 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -158,6 +158,7 @@ struct rsnd_dma {
 	struct sh_dmae_slave	slave;
 	struct dma_chan		*chan;
 	enum dma_data_direction dir;
+	dma_addr_t		addr;
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 12/12] ASoC: rsnd: add DT support to DVC
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-18  8:57   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Now, DVC can use DT

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

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 1d88d42..652573e 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -13,6 +13,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,dvc		: Should contain DVC feature.
+				  The number of DVC subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dai		: DAI contents.
 				  The number of DAI subnode should be same as HW.
 				  see below for detail.
@@ -40,6 +43,11 @@ rcar_sound: rcar_sound@0xffd90000 {
 		<0 0xec540000 0 0x1000>, /* SSIU */
 		<0 0xec541000 0 0x1280>; /* SSI */
 
+	rcar_sound,dvc {
+		dvc0: dvc@0 { };
+		dvc1: dvc@1 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 { };
 		src1: src@1 { };
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 6fb89fc..f8076c9 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -286,7 +286,13 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			mod[i] = src;
 			src = NULL;
 		} else {
-			mod[i] = dvc;
+			if ((!is_play) && (this = src))
+				this = dvc;
+
+			mod[i] = (is_play) ? src : dvc;
+			i++;
+			mod[i] = (is_play) ? dvc : src;
+			src = NULL;
 			dvc = NULL;
 		}
 
@@ -719,12 +725,13 @@ 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 *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;
+	int dai_i, ssi_i, src_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -750,6 +757,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");
+	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
 if (name##_node) {							\
@@ -785,6 +793,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(dvc);
 
 			if (playback)
 				of_node_put(playback);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index deef310..9096fb0 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
 	return &((struct rsnd_dvc *)(priv->dvc) + id)->mod;
 }
 
+static void rsnd_of_parse_dvc(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_dvc_platform_info *dvc_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,dvc");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_dvc_end;
+
+	dvc_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_dvc_platform_info) * nr,
+				GFP_KERNEL);
+	if (!dvc_info) {
+		dev_err(dev, "dvc info allocation error\n");
+		goto rsnd_of_parse_dvc_end;
+	}
+
+	info->dvc_info		= dvc_info;
+	info->dvc_info_nr	= nr;
+
+rsnd_of_parse_dvc_end:
+	of_node_put(node);
+}
+
 int rsnd_dvc_probe(struct platform_device *pdev,
 		   const struct rsnd_of_data *of_data,
 		   struct rsnd_priv *priv)
@@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr;
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
 	nr = info->dvc_info_nr;
 	if (!nr)
 		return 0;
-- 
1.7.9.5


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

* [PATCH 12/12] ASoC: rsnd: add DT support to DVC
@ 2014-06-18  8:57   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-18  8:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Now, DVC can use DT

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

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 1d88d42..652573e 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -13,6 +13,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,dvc		: Should contain DVC feature.
+				  The number of DVC subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dai		: DAI contents.
 				  The number of DAI subnode should be same as HW.
 				  see below for detail.
@@ -40,6 +43,11 @@ rcar_sound: rcar_sound@0xffd90000 {
 		<0 0xec540000 0 0x1000>, /* SSIU */
 		<0 0xec541000 0 0x1280>; /* SSI */
 
+	rcar_sound,dvc {
+		dvc0: dvc@0 { };
+		dvc1: dvc@1 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 { };
 		src1: src@1 { };
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 6fb89fc..f8076c9 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -286,7 +286,13 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			mod[i] = src;
 			src = NULL;
 		} else {
-			mod[i] = dvc;
+			if ((!is_play) && (this == src))
+				this = dvc;
+
+			mod[i] = (is_play) ? src : dvc;
+			i++;
+			mod[i] = (is_play) ? dvc : src;
+			src = NULL;
 			dvc = NULL;
 		}
 
@@ -719,12 +725,13 @@ 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 *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;
+	int dai_i, ssi_i, src_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -750,6 +757,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");
+	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
 if (name##_node) {							\
@@ -785,6 +793,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(dvc);
 
 			if (playback)
 				of_node_put(playback);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index deef310..9096fb0 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
 	return &((struct rsnd_dvc *)(priv->dvc) + id)->mod;
 }
 
+static void rsnd_of_parse_dvc(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_dvc_platform_info *dvc_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,dvc");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_dvc_end;
+
+	dvc_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_dvc_platform_info) * nr,
+				GFP_KERNEL);
+	if (!dvc_info) {
+		dev_err(dev, "dvc info allocation error\n");
+		goto rsnd_of_parse_dvc_end;
+	}
+
+	info->dvc_info		= dvc_info;
+	info->dvc_info_nr	= nr;
+
+rsnd_of_parse_dvc_end:
+	of_node_put(node);
+}
+
 int rsnd_dvc_probe(struct platform_device *pdev,
 		   const struct rsnd_of_data *of_data,
 		   struct rsnd_priv *priv)
@@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr;
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
 	nr = info->dvc_info_nr;
 	if (!nr)
 		return 0;
-- 
1.7.9.5


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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
  2014-06-18  8:54   ` Kuninori Morimoto
@ 2014-06-18 10:06     ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-18 10:06 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

On Wed, Jun 18, 2014 at 05:54:43PM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> ad32d0c7b0e993433df152ae747652647eb65a27
> (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> added rsnd_gen_dma_addr() to calculate DMA addr,

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
@ 2014-06-18 10:06     ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-18 10:06 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

On Wed, Jun 18, 2014 at 05:54:43PM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> ad32d0c7b0e993433df152ae747652647eb65a27
> (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> added rsnd_gen_dma_addr() to calculate DMA addr,

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 02/12] ASoC: rsnd: fixup loop exit timing of dma name search
  2014-06-18  8:55   ` Kuninori Morimoto
@ 2014-06-18 10:07     ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-18 10:07 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

On Wed, Jun 18, 2014 at 05:55:09PM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current dma name search loop didn't care about SSI index
> This patch fixes it.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 02/12] ASoC: rsnd: fixup loop exit timing of dma name search
@ 2014-06-18 10:07     ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-18 10:07 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

On Wed, Jun 18, 2014 at 05:55:09PM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current dma name search loop didn't care about SSI index
> This patch fixes it.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
  2014-06-18  8:56   ` Kuninori Morimoto
@ 2014-06-18 14:20     ` Sergei Shtylyov
  -1 siblings, 0 replies; 76+ messages in thread
From: Sergei Shtylyov @ 2014-06-18 14:20 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: linux-sh, Linux-ALSA, Simon, Kuninori Morimoto, Liam Girdwood

Hello.

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

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

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

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

[...]

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

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

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

WBR, Sergei


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

* Re: [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-18 14:20     ` Sergei Shtylyov
  0 siblings, 0 replies; 76+ messages in thread
From: Sergei Shtylyov @ 2014-06-18 14:20 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: linux-sh, Linux-ALSA, Simon, Kuninori Morimoto, Liam Girdwood

Hello.

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

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

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

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

[...]

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

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

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

WBR, Sergei

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

* Re: [PATCH 11/12] ASoC: rsnd: DMA start address is properly used for each DMAC
  2014-06-18  8:57   ` Kuninori Morimoto
@ 2014-06-18 14:22     ` Sergei Shtylyov
  -1 siblings, 0 replies; 76+ messages in thread
From: Sergei Shtylyov @ 2014-06-18 14:22 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

> R-Car sound uses Audio DMAC and Audio DMAC peri peri.
> Audio DMAC peri peri transfers data inside circuit.

> DMA transfer needs source / destination address,
> and destination address can be set via dmaengine_slave_config().
> The source address can be set when starting DMAEngine.
> Because Audio DMAC peri peri always ignores its value,
> current driver always used same source address for
> Audio DMAC / Audio DMAC peri peri
> (Audio DMAC peri peri source / destination address
> is always fixed value)
> But, This is not good match for DT booting.
> This patch properly uses DMA start address
> for Audio DMAC / Audio DMAC peri peri.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/sh/rcar/core.c |    2 ++
>   sound/soc/sh/rcar/rsnd.h |    1 +
>   2 files changed, 3 insertions(+)

> diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
> index 36895eb..6fb89fc 100644
> --- a/sound/soc/sh/rcar/core.c
> +++ b/sound/soc/sh/rcar/core.c
> @@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
>   	struct dma_async_tx_descriptor *desc;
>
>   	desc = dmaengine_prep_dma_cyclic(dma->chan,
> +					 (dma->addr) ? dma->addr :

    () not needed at all.

[...]

WBR, Sergei


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

* Re: [PATCH 11/12] ASoC: rsnd: DMA start address is properly used for each DMAC
@ 2014-06-18 14:22     ` Sergei Shtylyov
  0 siblings, 0 replies; 76+ messages in thread
From: Sergei Shtylyov @ 2014-06-18 14:22 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

> R-Car sound uses Audio DMAC and Audio DMAC peri peri.
> Audio DMAC peri peri transfers data inside circuit.

> DMA transfer needs source / destination address,
> and destination address can be set via dmaengine_slave_config().
> The source address can be set when starting DMAEngine.
> Because Audio DMAC peri peri always ignores its value,
> current driver always used same source address for
> Audio DMAC / Audio DMAC peri peri
> (Audio DMAC peri peri source / destination address
> is always fixed value)
> But, This is not good match for DT booting.
> This patch properly uses DMA start address
> for Audio DMAC / Audio DMAC peri peri.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/sh/rcar/core.c |    2 ++
>   sound/soc/sh/rcar/rsnd.h |    1 +
>   2 files changed, 3 insertions(+)

> diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
> index 36895eb..6fb89fc 100644
> --- a/sound/soc/sh/rcar/core.c
> +++ b/sound/soc/sh/rcar/core.c
> @@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
>   	struct dma_async_tx_descriptor *desc;
>
>   	desc = dmaengine_prep_dma_cyclic(dma->chan,
> +					 (dma->addr) ? dma->addr :

    () not needed at all.

[...]

WBR, Sergei


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

* Re: [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
  2014-06-18 14:20     ` Sergei Shtylyov
@ 2014-06-19  0:54       ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-19  0:54 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Mark Brown, Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon,
	linux-sh


Hi Sergei

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

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

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-19  0:54       ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-19  0:54 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Mark Brown, Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon,
	linux-sh


Hi Sergei

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

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

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 0/10 v2] ASoC: rsnd: fixup and DT support patches
  2014-06-18  8:53 ` Kuninori Morimoto
@ 2014-06-23  0:54   ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:54 UTC (permalink / raw)
  Cc: Mark Brown, Linux-ALSA, Liam Girdwood, Simon, linux-sh


Hi Mark

These are v2 patches of R-Car sound fixup and DMA DT support patches.
These are based on 

      mark/fix/rcar + mark/topic/rcar

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

 .../devicetree/bindings/sound/renesas,rsnd.txt     |   11 +-
 arch/arm/mach-shmobile/board-armadillo800eva.c     |    4 +
 arch/arm/mach-shmobile/board-kzm9g.c               |    2 +
 arch/arm/mach-shmobile/board-mackerel.c            |    4 +
 arch/sh/boards/mach-ecovec24/setup.c               |    2 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/fsi.c                                 |  189 ++++++--------------
 sound/soc/sh/rcar/core.c                           |  154 ++++++++--------
 sound/soc/sh/rcar/dvc.c                            |   50 +++++-
 sound/soc/sh/rcar/gen.c                            |  109 +++++------
 sound/soc/sh/rcar/rsnd.h                           |   22 +--
 sound/soc/sh/rcar/src.c                            |   51 ++++--
 sound/soc/sh/rcar/ssi.c                            |   33 +++-
 13 files changed, 331 insertions(+), 301 deletions(-)

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

* Re: [PATCH 0/10 v2] ASoC: rsnd: fixup and DT support patches
@ 2014-06-23  0:54   ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:54 UTC (permalink / raw)
  Cc: Mark Brown, Linux-ALSA, Liam Girdwood, Simon, linux-sh


Hi Mark

These are v2 patches of R-Car sound fixup and DMA DT support patches.
These are based on 

      mark/fix/rcar + mark/topic/rcar

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

 .../devicetree/bindings/sound/renesas,rsnd.txt     |   11 +-
 arch/arm/mach-shmobile/board-armadillo800eva.c     |    4 +
 arch/arm/mach-shmobile/board-kzm9g.c               |    2 +
 arch/arm/mach-shmobile/board-mackerel.c            |    4 +
 arch/sh/boards/mach-ecovec24/setup.c               |    2 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/fsi.c                                 |  189 ++++++--------------
 sound/soc/sh/rcar/core.c                           |  154 ++++++++--------
 sound/soc/sh/rcar/dvc.c                            |   50 +++++-
 sound/soc/sh/rcar/gen.c                            |  109 +++++------
 sound/soc/sh/rcar/rsnd.h                           |   22 +--
 sound/soc/sh/rcar/src.c                            |   51 ++++--
 sound/soc/sh/rcar/ssi.c                            |   33 +++-
 13 files changed, 331 insertions(+), 301 deletions(-)

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

* [PATCH 01/10 v2] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:55     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
for snd_pcm_lib_preallocate_pages_for_all().
But, it came from original dma-sh7760.c,
and no longer needed.
This patch exchange its parameter, and removed
original dma mapping and un-needed
dma_sync_single_xxx() from driver.

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

- no change

 arch/arm/mach-shmobile/board-armadillo800eva.c |    4 +++
 arch/arm/mach-shmobile/board-kzm9g.c           |    2 ++
 arch/arm/mach-shmobile/board-mackerel.c        |    4 +++
 arch/sh/boards/mach-ecovec24/setup.c           |    2 ++
 sound/soc/sh/fsi.c                             |   42 +++---------------------
 5 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 395638d..4afe6ae 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1032,6 +1032,8 @@ static struct platform_device fsi_wm8978_device = {
 	.id	= 0,
 	.dev	= {
 		.platform_data	= &fsi_wm8978_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -1055,6 +1057,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index fff330f..bd60fba 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4648_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ece865..fa5e3eb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -521,6 +521,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -917,6 +919,8 @@ static struct platform_device fsi_ak4643_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4643_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 85d5255..0d30492 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi_da7210_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 710a079..7a6b632 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -233,7 +233,6 @@ struct fsi_stream {
 	 */
 	struct dma_chan		*chan;
 	struct work_struct	work;
-	dma_addr_t		dma;
 	int			dma_id;
 	int			loop_cnt;
 	int			additional_pos;
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
  */
 static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-				DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
 	/*
 	 * 24bit data : 24bit bus / package in back
 	 * 16bit data : 16bit bus / stream mode
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 
 	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
 	io->additional_pos = 0;
-	io->dma = dma_map_single(dai->dev, runtime->dma_area,
-				 snd_pcm_lib_buffer_bytes(io->substream), dir);
-	return 0;
-}
-
-static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
-	dma_unmap_single(dai->dev, io->dma,
-			 snd_pcm_lib_buffer_bytes(io->substream), dir);
 	return 0;
 }
 
@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
 	if (period >= runtime->periods)
 		period = 0;
 
-	return io->dma + samples_to_bytes(runtime, period * io->period_samples);
+	return runtime->dma_addr +
+		samples_to_bytes(runtime, period * io->period_samples);
 }
 
 static void fsi_dma_complete(void *data)
@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data)
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
 	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-	dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0),
-			samples_to_bytes(runtime, io->period_samples), dir);
 
 	io->buff_sample_pos += io->period_samples;
 	io->period_pos++;
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
 	for (i = 0; i < io->loop_cnt; i++) {
 		buf	= fsi_dma_get_area(io, io->additional_pos);
 
-		dma_sync_single_for_device(dai->dev, buf, len, dir);
-
 		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc) {
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 
 static struct fsi_stream_handler fsi_dma_push_handler = {
 	.init		= fsi_dma_init,
-	.quit		= fsi_dma_quit,
 	.probe		= fsi_dma_probe,
 	.transfer	= fsi_dma_transfer,
 	.remove		= fsi_dma_remove,
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
 
 static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
-	struct snd_pcm *pcm = rtd->pcm;
-
-	/*
-	 * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
-	 * in MMAP mode (i.e. aplay -M)
-	 */
 	return snd_pcm_lib_preallocate_pages_for_all(
-		pcm,
-		SNDRV_DMA_TYPE_CONTINUOUS,
-		snd_dma_continuous_data(GFP_KERNEL),
+		rtd->pcm,
+		SNDRV_DMA_TYPE_DEV,
+		rtd->card->snd_card->dev,
 		PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
 }
 
-- 
1.7.9.5


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

* [PATCH 01/10 v2] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
@ 2014-06-23  0:55     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
for snd_pcm_lib_preallocate_pages_for_all().
But, it came from original dma-sh7760.c,
and no longer needed.
This patch exchange its parameter, and removed
original dma mapping and un-needed
dma_sync_single_xxx() from driver.

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

- no change

 arch/arm/mach-shmobile/board-armadillo800eva.c |    4 +++
 arch/arm/mach-shmobile/board-kzm9g.c           |    2 ++
 arch/arm/mach-shmobile/board-mackerel.c        |    4 +++
 arch/sh/boards/mach-ecovec24/setup.c           |    2 ++
 sound/soc/sh/fsi.c                             |   42 +++---------------------
 5 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 395638d..4afe6ae 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1032,6 +1032,8 @@ static struct platform_device fsi_wm8978_device = {
 	.id	= 0,
 	.dev	= {
 		.platform_data	= &fsi_wm8978_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -1055,6 +1057,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index fff330f..bd60fba 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -603,6 +603,8 @@ static struct platform_device fsi_ak4648_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4648_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0ece865..fa5e3eb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -521,6 +521,8 @@ static struct platform_device fsi_hdmi_device = {
 	.id	= 1,
 	.dev	= {
 		.platform_data	= &fsi2_hdmi_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
 	},
 };
 
@@ -917,6 +919,8 @@ static struct platform_device fsi_ak4643_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi2_ak4643_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 85d5255..0d30492 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
 	.name	= "asoc-simple-card",
 	.dev	= {
 		.platform_data	= &fsi_da7210_info,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
 	},
 };
 
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 710a079..7a6b632 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -233,7 +233,6 @@ struct fsi_stream {
 	 */
 	struct dma_chan		*chan;
 	struct work_struct	work;
-	dma_addr_t		dma;
 	int			dma_id;
 	int			loop_cnt;
 	int			additional_pos;
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
  */
 static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-				DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
 	/*
 	 * 24bit data : 24bit bus / package in back
 	 * 16bit data : 16bit bus / stream mode
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 
 	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
 	io->additional_pos = 0;
-	io->dma = dma_map_single(dai->dev, runtime->dma_area,
-				 snd_pcm_lib_buffer_bytes(io->substream), dir);
-	return 0;
-}
-
-static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
 
-	dma_unmap_single(dai->dev, io->dma,
-			 snd_pcm_lib_buffer_bytes(io->substream), dir);
 	return 0;
 }
 
@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
 	if (period >= runtime->periods)
 		period = 0;
 
-	return io->dma + samples_to_bytes(runtime, period * io->period_samples);
+	return runtime->dma_addr +
+		samples_to_bytes(runtime, period * io->period_samples);
 }
 
 static void fsi_dma_complete(void *data)
@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data)
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
 	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
-	enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
-		DMA_TO_DEVICE : DMA_FROM_DEVICE;
-
-	dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0),
-			samples_to_bytes(runtime, io->period_samples), dir);
 
 	io->buff_sample_pos += io->period_samples;
 	io->period_pos++;
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
 	for (i = 0; i < io->loop_cnt; i++) {
 		buf	= fsi_dma_get_area(io, io->additional_pos);
 
-		dma_sync_single_for_device(dai->dev, buf, len, dir);
-
 		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc) {
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 
 static struct fsi_stream_handler fsi_dma_push_handler = {
 	.init		= fsi_dma_init,
-	.quit		= fsi_dma_quit,
 	.probe		= fsi_dma_probe,
 	.transfer	= fsi_dma_transfer,
 	.remove		= fsi_dma_remove,
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
 
 static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
-	struct snd_pcm *pcm = rtd->pcm;
-
-	/*
-	 * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
-	 * in MMAP mode (i.e. aplay -M)
-	 */
 	return snd_pcm_lib_preallocate_pages_for_all(
-		pcm,
-		SNDRV_DMA_TYPE_CONTINUOUS,
-		snd_dma_continuous_data(GFP_KERNEL),
+		rtd->pcm,
+		SNDRV_DMA_TYPE_DEV,
+		rtd->card->snd_card->dev,
 		PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
 }
 
-- 
1.7.9.5


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

* [PATCH 02/10 v2] ASoC: fsi: add fsi_pointer_update() for common pointer method
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:55     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

fsi PIO/DMA handler are using each own pointer update method,
but these can be share.

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

- no change

 sound/soc/sh/fsi.c |   57 ++++++++++++++++++++--------------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7a6b632..820a408 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1041,6 +1041,26 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
 	return ret;
 }
 
+static void fsi_pointer_update(struct fsi_stream *io, int size)
+{
+	io->buff_sample_pos += size;
+
+	if (io->buff_sample_pos >+	    io->period_samples * (io->period_pos + 1)) {
+		struct snd_pcm_substream *substream = io->substream;
+		struct snd_pcm_runtime *runtime = substream->runtime;
+
+		io->period_pos++;
+
+		if (io->period_pos >= runtime->periods) {
+			io->buff_sample_pos = 0;
+			io->period_pos = 0;
+		}
+
+		snd_pcm_period_elapsed(substream);
+	}
+}
+
 /*
  *		pio data transfer handler
  */
@@ -1107,31 +1127,11 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples),
 		int samples)
 {
-	struct snd_pcm_runtime *runtime;
-	struct snd_pcm_substream *substream;
 	u8 *buf;
-	int over_period;
 
 	if (!fsi_stream_is_working(fsi, io))
 		return -EINVAL;
 
-	over_period	= 0;
-	substream	= io->substream;
-	runtime		= substream->runtime;
-
-	/* FSI FIFO has limit.
-	 * So, this driver can not send periods data at a time
-	 */
-	if (io->buff_sample_pos >-	    io->period_samples * (io->period_pos + 1)) {
-
-		over_period = 1;
-		io->period_pos = (io->period_pos + 1) % runtime->periods;
-
-		if (0 = io->period_pos)
-			io->buff_sample_pos = 0;
-	}
-
 	buf = fsi_pio_get_area(fsi, io);
 
 	switch (io->sample_width) {
@@ -1145,11 +1145,7 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		return -EINVAL;
 	}
 
-	/* update buff_sample_pos */
-	io->buff_sample_pos += samples;
-
-	if (over_period)
-		snd_pcm_period_elapsed(substream);
+	fsi_pointer_update(io, samples);
 
 	return 0;
 }
@@ -1307,20 +1303,11 @@ static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
 
-	io->buff_sample_pos += io->period_samples;
-	io->period_pos++;
-
-	if (io->period_pos >= runtime->periods) {
-		io->period_pos = 0;
-		io->buff_sample_pos = 0;
-	}
+	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
 	fsi_stream_transfer(io);
-
-	snd_pcm_period_elapsed(io->substream);
 }
 
 static void fsi_dma_do_work(struct work_struct *work)
-- 
1.7.9.5


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

* [PATCH 02/10 v2] ASoC: fsi: add fsi_pointer_update() for common pointer method
@ 2014-06-23  0:55     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

fsi PIO/DMA handler are using each own pointer update method,
but these can be share.

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

- no change

 sound/soc/sh/fsi.c |   57 ++++++++++++++++++++--------------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7a6b632..820a408 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1041,6 +1041,26 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
 	return ret;
 }
 
+static void fsi_pointer_update(struct fsi_stream *io, int size)
+{
+	io->buff_sample_pos += size;
+
+	if (io->buff_sample_pos >=
+	    io->period_samples * (io->period_pos + 1)) {
+		struct snd_pcm_substream *substream = io->substream;
+		struct snd_pcm_runtime *runtime = substream->runtime;
+
+		io->period_pos++;
+
+		if (io->period_pos >= runtime->periods) {
+			io->buff_sample_pos = 0;
+			io->period_pos = 0;
+		}
+
+		snd_pcm_period_elapsed(substream);
+	}
+}
+
 /*
  *		pio data transfer handler
  */
@@ -1107,31 +1127,11 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples),
 		int samples)
 {
-	struct snd_pcm_runtime *runtime;
-	struct snd_pcm_substream *substream;
 	u8 *buf;
-	int over_period;
 
 	if (!fsi_stream_is_working(fsi, io))
 		return -EINVAL;
 
-	over_period	= 0;
-	substream	= io->substream;
-	runtime		= substream->runtime;
-
-	/* FSI FIFO has limit.
-	 * So, this driver can not send periods data at a time
-	 */
-	if (io->buff_sample_pos >=
-	    io->period_samples * (io->period_pos + 1)) {
-
-		over_period = 1;
-		io->period_pos = (io->period_pos + 1) % runtime->periods;
-
-		if (0 == io->period_pos)
-			io->buff_sample_pos = 0;
-	}
-
 	buf = fsi_pio_get_area(fsi, io);
 
 	switch (io->sample_width) {
@@ -1145,11 +1145,7 @@ static int fsi_pio_transfer(struct fsi_priv *fsi, struct fsi_stream *io,
 		return -EINVAL;
 	}
 
-	/* update buff_sample_pos */
-	io->buff_sample_pos += samples;
-
-	if (over_period)
-		snd_pcm_period_elapsed(substream);
+	fsi_pointer_update(io, samples);
 
 	return 0;
 }
@@ -1307,20 +1303,11 @@ static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
 	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
 
-	io->buff_sample_pos += io->period_samples;
-	io->period_pos++;
-
-	if (io->period_pos >= runtime->periods) {
-		io->period_pos = 0;
-		io->buff_sample_pos = 0;
-	}
+	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
 	fsi_stream_transfer(io);
-
-	snd_pcm_period_elapsed(io->substream);
 }
 
 static void fsi_dma_do_work(struct work_struct *work)
-- 
1.7.9.5


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

* [PATCH 03/10] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:55     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current FSI driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

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

- no change

 sound/soc/sh/fsi.c |   94 +++++++++++++++-------------------------------------
 1 file changed, 27 insertions(+), 67 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 820a408..a57eb96 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -232,10 +232,7 @@ struct fsi_stream {
 	 * these are for DMAEngine
 	 */
 	struct dma_chan		*chan;
-	struct work_struct	work;
 	int			dma_id;
-	int			loop_cnt;
-	int			additional_pos;
 };
 
 struct fsi_clk {
@@ -1281,24 +1278,9 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 	io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
 			 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
 
-	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
-	io->additional_pos = 0;
-
 	return 0;
 }
 
-static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
-{
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	int period = io->period_pos + additional;
-
-	if (period >= runtime->periods)
-		period = 0;
-
-	return runtime->dma_addr +
-		samples_to_bytes(runtime, period * io->period_samples);
-}
-
 static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1307,53 +1289,37 @@ static void fsi_dma_complete(void *data)
 	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
-	fsi_stream_transfer(io);
 }
 
-static void fsi_dma_do_work(struct work_struct *work)
+static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct fsi_stream *io = container_of(work, struct fsi_stream, work);
-	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_soc_dai *dai;
+	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+	struct snd_pcm_substream *substream = io->substream;
 	struct dma_async_tx_descriptor *desc;
-	struct snd_pcm_runtime *runtime;
-	enum dma_data_direction dir;
 	int is_play = fsi_stream_is_play(fsi, io);
-	int len, i;
-	dma_addr_t buf;
-
-	if (!fsi_stream_is_working(fsi, io))
-		return;
-
-	dai	= fsi_get_dai(io->substream);
-	runtime	= io->substream->runtime;
-	dir	= is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	len	= samples_to_bytes(runtime, io->period_samples);
-
-	for (i = 0; i < io->loop_cnt; i++) {
-		buf	= fsi_dma_get_area(io, io->additional_pos);
-
-		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
-					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= fsi_dma_complete;
-		desc->callback_param	= io;
-
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dai->dev, "tx_submit() fail\n");
-			return;
-		}
+	enum dma_data_direction dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	int ret = -EIO;
+
+	desc = dmaengine_prep_dma_cyclic(io->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+	if (!desc) {
+		dev_err(dai->dev, "dmaengine_prep_dma_cyclic() fail\n");
+		goto fsi_dma_transfer_err;
+	}
 
-		dma_async_issue_pending(io->chan);
+	desc->callback		= fsi_dma_complete;
+	desc->callback_param	= io;
 
-		io->additional_pos = 1;
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dai->dev, "tx_submit() fail\n");
+		goto fsi_dma_transfer_err;
 	}
 
-	io->loop_cnt = 1;
+	dma_async_issue_pending(io->chan);
 
 	/*
 	 * FIXME
@@ -1370,13 +1336,11 @@ static void fsi_dma_do_work(struct work_struct *work)
 			fsi_reg_write(fsi, DIFF_ST, 0);
 		}
 	}
-}
 
-static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	schedule_work(&io->work);
+	ret = 0;
 
-	return 0;
+fsi_dma_transfer_err:
+	return ret;
 }
 
 static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
@@ -1437,15 +1401,11 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
 		return fsi_stream_probe(fsi, dev);
 	}
 
-	INIT_WORK(&io->work, fsi_dma_do_work);
-
 	return 0;
 }
 
 static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	cancel_work_sync(&io->work);
-
 	fsi_stream_stop(fsi, io);
 
 	if (io->chan)
@@ -1618,9 +1578,9 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		if (!ret)
 			ret = fsi_hw_startup(fsi, io, dai->dev);
 		if (!ret)
-			ret = fsi_stream_transfer(io);
+			ret = fsi_stream_start(fsi, io);
 		if (!ret)
-			fsi_stream_start(fsi, io);
+			ret = fsi_stream_transfer(io);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (!ret)
-- 
1.7.9.5


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

* [PATCH 03/10] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer
@ 2014-06-23  0:55     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current FSI driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

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

- no change

 sound/soc/sh/fsi.c |   94 +++++++++++++++-------------------------------------
 1 file changed, 27 insertions(+), 67 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 820a408..a57eb96 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -232,10 +232,7 @@ struct fsi_stream {
 	 * these are for DMAEngine
 	 */
 	struct dma_chan		*chan;
-	struct work_struct	work;
 	int			dma_id;
-	int			loop_cnt;
-	int			additional_pos;
 };
 
 struct fsi_clk {
@@ -1281,24 +1278,9 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
 	io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
 			 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
 
-	io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
-	io->additional_pos = 0;
-
 	return 0;
 }
 
-static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
-{
-	struct snd_pcm_runtime *runtime = io->substream->runtime;
-	int period = io->period_pos + additional;
-
-	if (period >= runtime->periods)
-		period = 0;
-
-	return runtime->dma_addr +
-		samples_to_bytes(runtime, period * io->period_samples);
-}
-
 static void fsi_dma_complete(void *data)
 {
 	struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1307,53 +1289,37 @@ static void fsi_dma_complete(void *data)
 	fsi_pointer_update(io, io->period_samples);
 
 	fsi_count_fifo_err(fsi);
-	fsi_stream_transfer(io);
 }
 
-static void fsi_dma_do_work(struct work_struct *work)
+static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	struct fsi_stream *io = container_of(work, struct fsi_stream, work);
-	struct fsi_priv *fsi = fsi_stream_to_priv(io);
-	struct snd_soc_dai *dai;
+	struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+	struct snd_pcm_substream *substream = io->substream;
 	struct dma_async_tx_descriptor *desc;
-	struct snd_pcm_runtime *runtime;
-	enum dma_data_direction dir;
 	int is_play = fsi_stream_is_play(fsi, io);
-	int len, i;
-	dma_addr_t buf;
-
-	if (!fsi_stream_is_working(fsi, io))
-		return;
-
-	dai	= fsi_get_dai(io->substream);
-	runtime	= io->substream->runtime;
-	dir	= is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
-	len	= samples_to_bytes(runtime, io->period_samples);
-
-	for (i = 0; i < io->loop_cnt; i++) {
-		buf	= fsi_dma_get_area(io, io->additional_pos);
-
-		desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
-					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= fsi_dma_complete;
-		desc->callback_param	= io;
-
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dai->dev, "tx_submit() fail\n");
-			return;
-		}
+	enum dma_data_direction dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
+	int ret = -EIO;
+
+	desc = dmaengine_prep_dma_cyclic(io->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+	if (!desc) {
+		dev_err(dai->dev, "dmaengine_prep_dma_cyclic() fail\n");
+		goto fsi_dma_transfer_err;
+	}
 
-		dma_async_issue_pending(io->chan);
+	desc->callback		= fsi_dma_complete;
+	desc->callback_param	= io;
 
-		io->additional_pos = 1;
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dai->dev, "tx_submit() fail\n");
+		goto fsi_dma_transfer_err;
 	}
 
-	io->loop_cnt = 1;
+	dma_async_issue_pending(io->chan);
 
 	/*
 	 * FIXME
@@ -1370,13 +1336,11 @@ static void fsi_dma_do_work(struct work_struct *work)
 			fsi_reg_write(fsi, DIFF_ST, 0);
 		}
 	}
-}
 
-static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
-{
-	schedule_work(&io->work);
+	ret = 0;
 
-	return 0;
+fsi_dma_transfer_err:
+	return ret;
 }
 
 static int fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
@@ -1437,15 +1401,11 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io, struct dev
 		return fsi_stream_probe(fsi, dev);
 	}
 
-	INIT_WORK(&io->work, fsi_dma_do_work);
-
 	return 0;
 }
 
 static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
 {
-	cancel_work_sync(&io->work);
-
 	fsi_stream_stop(fsi, io);
 
 	if (io->chan)
@@ -1618,9 +1578,9 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		if (!ret)
 			ret = fsi_hw_startup(fsi, io, dai->dev);
 		if (!ret)
-			ret = fsi_stream_transfer(io);
+			ret = fsi_stream_start(fsi, io);
 		if (!ret)
-			fsi_stream_start(fsi, io);
+			ret = fsi_stream_transfer(io);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		if (!ret)
-- 
1.7.9.5


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

* [PATCH 04/10 v2] ASoC: rsnd: SSI + DMA can select BUSIF
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:56     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

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

 - no change

 .../devicetree/bindings/sound/renesas,rsnd.txt     |    1 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/rcar/core.c                           |   22 ++++---
 sound/soc/sh/rcar/gen.c                            |   64 +++++++++++++-------
 sound/soc/sh/rcar/rsnd.h                           |   10 ++-
 sound/soc/sh/rcar/src.c                            |   37 ++++++++---
 sound/soc/sh/rcar/ssi.c                            |   33 +++++++++-
 7 files changed, 123 insertions(+), 45 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 8346cab..41a120c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,7 @@ SSI subnode properties:
 - interrupts			: Should contain SSI interrupt for PIO transfer
 - shared-pin			: if shared clock pin
 - pio-transfer			: use PIO transfer mode
+- no-busif			: BUSIF is not ussed when [mem -> SSI] via DMA case
 
 SRC subnode properties:
 no properties at this point
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index f4a706f..d76412b 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,6 +34,7 @@
  * B : SSI direction
  */
 #define RSND_SSI_CLK_PIN_SHARE		(1 << 31)
+#define RSND_SSI_NO_BUSIF		(1 << 30) /* SSI+DMA without BUSIF */
 
 #define RSND_SSI(_dma_id, _pio_irq, _flags)		\
 { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7f68b33..8c3707a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -138,6 +138,17 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
 	return mod->ops->name;
 }
 
+char *rsnd_mod_dma_name(struct rsnd_mod *mod)
+{
+	if (!mod || !mod->ops)
+		return "unknown";
+
+	if (!mod->ops->dma_name)
+		return mod->ops->name;
+
+	return mod->ops->dma_name(mod);
+}
+
 void rsnd_mod_init(struct rsnd_priv *priv,
 		   struct rsnd_mod *mod,
 		   struct rsnd_mod_ops *ops,
@@ -261,7 +272,7 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 {
 	if (mod)
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
-			 rsnd_mod_name(mod), rsnd_mod_id(mod));
+			 rsnd_mod_dma_name(mod), rsnd_mod_id(mod));
 	else
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
 
@@ -343,11 +354,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	if (dev->of_node)
-		rsnd_dma_of_name(dma, is_play, dma_name);
-	else
-		snprintf(dma_name, DMA_NAME_SIZE,
-			 is_play ? "tx" : "rx");
+	rsnd_dma_of_name(dma, is_play, dma_name);
+	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
 
 	dev_dbg(dev, "dma name : %s\n", dma_name);
 
@@ -359,8 +367,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		return -EIO;
 	}
 
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
-
 	ret = dmaengine_slave_config(dma->chan, &cfg);
 	if (ret < 0)
 		goto rsnd_dma_init_err;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 0280a11..46677af 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -165,15 +165,19 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *
  *	ex) R-Car H2 case
  *	      mod        / DMAC in    / DMAC out   / DMAC PP in / DMAC pp out
- *	SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
+ *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
+ *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
  *	CMD : 0xec500000 / 0xec008000                             0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
 
-#define RDMA_SSI_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
-#define RDMA_SSI_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_I_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+#define RDMA_SSIU_O_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+
+#define RDMA_SSIU_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
 
 #define RDMA_SRC_I_N(addr, i)	(addr ##_reg - 0x00500000 + (0x400 * i))
 #define RDMA_SRC_O_N(addr, i)	(addr ##_reg - 0x004fc000 + (0x400 * i))
@@ -204,26 +208,36 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	struct dma_addr {
 		dma_addr_t src_addr;
 		dma_addr_t dst_addr;
-	} dma_addrs[2][2][3] = {
-		{ /* SRC */
-			/* Capture */
-			{{ 0,				0 },
-			 { RDMA_SRC_O_N(src, id),	0 },
-			 { RDMA_CMD_O_N(src, id),	0 }},
-			/* Playback */
-			{{ 0,				0, },
-			 { 0,				RDMA_SRC_I_N(src, id) },
-			 { 0,				RDMA_SRC_I_N(src, id) }}
-		}, { /* SSI */
-			/* Capture */
-			{{ RDMA_SSI_O_N(ssi, id),	0 },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) }},
-			/* Playback */
-			{{ 0,				RDMA_SSI_I_N(ssi, id) },
-			 { RDMA_SRC_O_P(src, id),	RDMA_SSI_I_P(ssi, id) },
-			 { RDMA_CMD_O_P(src, id),	RDMA_SSI_I_P(ssi, id) }}
-		}
+	} dma_addrs[3][2][3] = {
+		/* SRC */
+		{{{ 0,				0 },
+		/* Capture */
+		  { RDMA_SRC_O_N(src, id),	0 },
+		  { RDMA_CMD_O_N(src, id),	0 } },
+		 /* Playback */
+		 {{ 0,				0, },
+		  { 0,				RDMA_SRC_I_N(src, id) },
+		  { 0,				RDMA_SRC_I_N(src, id) } }
+		},
+		/* SSI */
+		/* Capture */
+		{{{ RDMA_SSI_O_N(ssi, id),	0 },
+		  { 0,				0 },
+		  { 0,				0 } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
+		  { 0,				0 },
+		  { 0,				0 } }
+		},
+		/* SSIU */
+		/* Capture */
+		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
+		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
@@ -232,6 +246,10 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		return;
 	}
 
+	/* use SSIU or SSI ? */
+	if (is_ssi && (0 = strcmp(rsnd_mod_dma_name(mod), "ssiu")))
+		is_ssi++;
+
 	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
 	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 067a89e..a1466c1 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -185,6 +185,7 @@ enum rsnd_mod_type {
 
 struct rsnd_mod_ops {
 	char *name;
+	char* (*dma_name)(struct rsnd_mod *mod);
 	int (*probe)(struct rsnd_mod *mod,
 		     struct rsnd_dai *rdai);
 	int (*remove)(struct rsnd_mod *mod,
@@ -224,6 +225,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 		   enum rsnd_mod_type type,
 		   int id);
 char *rsnd_mod_name(struct rsnd_mod *mod);
+char *rsnd_mod_dma_name(struct rsnd_mod *mod);
 
 /*
  *	R-Car sound DAI
@@ -391,8 +393,12 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct rsnd_dai_stream *io,
 				   struct snd_pcm_runtime *runtime);
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai);
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif);
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+		       struct rsnd_dai *rdai,
+		       int use_busif);
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
 			    struct rsnd_dai *rdai);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 200eda0..4d39505 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -106,18 +106,17 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai)
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
 {
-	struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
 	 * SSI_MODE0
 	 */
 	rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
-		      src_mod ? 0 : (1 << ssi_id));
+		      !use_busif << ssi_id);
 
 	/*
 	 * SSI_MODE1
@@ -143,6 +142,29 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
 				      0x2 << shift : 0x1 << shift);
 	}
 
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif) {
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
+			       rsnd_get_adinr(ssi_mod));
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
+	}
+
+	return 0;
+}
+
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
+{
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif)
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0);
+
 	return 0;
 }
 
@@ -467,9 +489,6 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr(mod));
-	rsnd_mod_write(mod, SSI_BUSIF_MODE,  1);
-
 	rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
 
 	rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
@@ -554,7 +573,6 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
 
 	rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
 
-	rsnd_mod_write(mod, SSI_CTRL, 0x1);
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
 	return rsnd_src_start(mod, rdai);
@@ -565,7 +583,6 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
 {
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 
-	rsnd_mod_write(mod, SSI_CTRL, 0);
 	rsnd_mod_write(mod, SRC_CTRL, 0);
 
 	rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2df723d..34e8400 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -90,6 +90,20 @@ struct rsnd_ssi {
 #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
 #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
 
+static int rsnd_ssi_use_busif(struct rsnd_mod *mod)
+{
+	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+	int use_busif = 0;
+
+	if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF))
+		use_busif = 1;
+	if (rsnd_io_to_mod_src(io))
+		use_busif = 1;
+
+	return use_busif;
+}
+
 static void rsnd_ssi_status_check(struct rsnd_mod *mod,
 				  u32 bit)
 {
@@ -289,8 +303,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 	ssi->cr_own	= cr;
 	ssi->err	= -1; /* ignore 1st error */
 
-	rsnd_src_ssi_mode_init(mod, rdai);
-
 	return 0;
 }
 
@@ -389,6 +401,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
 	/* enable PIO IRQ */
 	ssi->cr_etc = UIEN | OIEN | DIEN;
 
+	rsnd_src_ssiu_start(mod, rdai, 0);
+
 	rsnd_src_enable_ssi_irq(mod, rdai);
 
 	rsnd_ssi_hw_start(ssi, rdai, io);
@@ -405,6 +419,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
 
 	rsnd_ssi_hw_stop(ssi, rdai);
 
+	rsnd_src_ssiu_stop(mod, rdai, 0);
+
 	return 0;
 }
 
@@ -457,6 +473,8 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
 	/* enable DMA transfer */
 	ssi->cr_etc = DMEN;
 
+	rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
+
 	rsnd_dma_start(dma);
 
 	rsnd_ssi_hw_start(ssi, ssi->rdai, io);
@@ -482,11 +500,19 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
 
 	rsnd_dma_stop(dma);
 
+	rsnd_src_ssiu_stop(mod, rdai, 1);
+
 	return 0;
 }
 
+static char *rsnd_ssi_dma_name(struct rsnd_mod *mod)
+{
+	return rsnd_ssi_use_busif(mod) ? "ssiu" : SSI_NAME;
+}
+
 static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
 	.name	= SSI_NAME,
+	.dma_name = rsnd_ssi_dma_name,
 	.probe	= rsnd_ssi_dma_probe,
 	.remove	= rsnd_ssi_dma_remove,
 	.init	= rsnd_ssi_init,
@@ -595,6 +621,9 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
 		 */
 		ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
 			0 : 1;
+
+		if (of_get_property(np, "no-busif", NULL))
+			ssi_info->flags |= RSND_SSI_NO_BUSIF;
 	}
 
 rsnd_of_parse_ssi_end:
-- 
1.7.9.5


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

* [PATCH 04/10 v2] ASoC: rsnd: SSI + DMA can select BUSIF
@ 2014-06-23  0:56     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

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

 - no change

 .../devicetree/bindings/sound/renesas,rsnd.txt     |    1 +
 include/sound/rcar_snd.h                           |    1 +
 sound/soc/sh/rcar/core.c                           |   22 ++++---
 sound/soc/sh/rcar/gen.c                            |   64 +++++++++++++-------
 sound/soc/sh/rcar/rsnd.h                           |   10 ++-
 sound/soc/sh/rcar/src.c                            |   37 ++++++++---
 sound/soc/sh/rcar/ssi.c                            |   33 +++++++++-
 7 files changed, 123 insertions(+), 45 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 8346cab..41a120c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -21,6 +21,7 @@ SSI subnode properties:
 - interrupts			: Should contain SSI interrupt for PIO transfer
 - shared-pin			: if shared clock pin
 - pio-transfer			: use PIO transfer mode
+- no-busif			: BUSIF is not ussed when [mem -> SSI] via DMA case
 
 SRC subnode properties:
 no properties at this point
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index f4a706f..d76412b 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,6 +34,7 @@
  * B : SSI direction
  */
 #define RSND_SSI_CLK_PIN_SHARE		(1 << 31)
+#define RSND_SSI_NO_BUSIF		(1 << 30) /* SSI+DMA without BUSIF */
 
 #define RSND_SSI(_dma_id, _pio_irq, _flags)		\
 { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7f68b33..8c3707a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -138,6 +138,17 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
 	return mod->ops->name;
 }
 
+char *rsnd_mod_dma_name(struct rsnd_mod *mod)
+{
+	if (!mod || !mod->ops)
+		return "unknown";
+
+	if (!mod->ops->dma_name)
+		return mod->ops->name;
+
+	return mod->ops->dma_name(mod);
+}
+
 void rsnd_mod_init(struct rsnd_priv *priv,
 		   struct rsnd_mod *mod,
 		   struct rsnd_mod_ops *ops,
@@ -261,7 +272,7 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 {
 	if (mod)
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
-			 rsnd_mod_name(mod), rsnd_mod_id(mod));
+			 rsnd_mod_dma_name(mod), rsnd_mod_id(mod));
 	else
 		return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
 
@@ -343,11 +354,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	if (dev->of_node)
-		rsnd_dma_of_name(dma, is_play, dma_name);
-	else
-		snprintf(dma_name, DMA_NAME_SIZE,
-			 is_play ? "tx" : "rx");
+	rsnd_dma_of_name(dma, is_play, dma_name);
+	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
 
 	dev_dbg(dev, "dma name : %s\n", dma_name);
 
@@ -359,8 +367,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		return -EIO;
 	}
 
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
-
 	ret = dmaengine_slave_config(dma->chan, &cfg);
 	if (ret < 0)
 		goto rsnd_dma_init_err;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 0280a11..46677af 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -165,15 +165,19 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *
  *	ex) R-Car H2 case
  *	      mod        / DMAC in    / DMAC out   / DMAC PP in / DMAC pp out
- *	SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
+ *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
+ *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
  *	CMD : 0xec500000 / 0xec008000                             0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
 
-#define RDMA_SSI_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
-#define RDMA_SSI_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_I_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+#define RDMA_SSIU_O_N(addr, i)	(addr ##_reg - 0x00441000 + (0x1000 * i))
+
+#define RDMA_SSIU_I_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
+#define RDMA_SSIU_O_P(addr, i)	(addr ##_reg - 0x00141000 + (0x1000 * i))
 
 #define RDMA_SRC_I_N(addr, i)	(addr ##_reg - 0x00500000 + (0x400 * i))
 #define RDMA_SRC_O_N(addr, i)	(addr ##_reg - 0x004fc000 + (0x400 * i))
@@ -204,26 +208,36 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	struct dma_addr {
 		dma_addr_t src_addr;
 		dma_addr_t dst_addr;
-	} dma_addrs[2][2][3] = {
-		{ /* SRC */
-			/* Capture */
-			{{ 0,				0 },
-			 { RDMA_SRC_O_N(src, id),	0 },
-			 { RDMA_CMD_O_N(src, id),	0 }},
-			/* Playback */
-			{{ 0,				0, },
-			 { 0,				RDMA_SRC_I_N(src, id) },
-			 { 0,				RDMA_SRC_I_N(src, id) }}
-		}, { /* SSI */
-			/* Capture */
-			{{ RDMA_SSI_O_N(ssi, id),	0 },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-			 { RDMA_SSI_O_P(ssi, id),	RDMA_SRC_I_P(src, id) }},
-			/* Playback */
-			{{ 0,				RDMA_SSI_I_N(ssi, id) },
-			 { RDMA_SRC_O_P(src, id),	RDMA_SSI_I_P(ssi, id) },
-			 { RDMA_CMD_O_P(src, id),	RDMA_SSI_I_P(ssi, id) }}
-		}
+	} dma_addrs[3][2][3] = {
+		/* SRC */
+		{{{ 0,				0 },
+		/* Capture */
+		  { RDMA_SRC_O_N(src, id),	0 },
+		  { RDMA_CMD_O_N(src, id),	0 } },
+		 /* Playback */
+		 {{ 0,				0, },
+		  { 0,				RDMA_SRC_I_N(src, id) },
+		  { 0,				RDMA_SRC_I_N(src, id) } }
+		},
+		/* SSI */
+		/* Capture */
+		{{{ RDMA_SSI_O_N(ssi, id),	0 },
+		  { 0,				0 },
+		  { 0,				0 } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
+		  { 0,				0 },
+		  { 0,				0 } }
+		},
+		/* SSIU */
+		/* Capture */
+		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		 /* Playback */
+		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
+		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
@@ -232,6 +246,10 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 		return;
 	}
 
+	/* use SSIU or SSI ? */
+	if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
+		is_ssi++;
+
 	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
 	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 067a89e..a1466c1 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -185,6 +185,7 @@ enum rsnd_mod_type {
 
 struct rsnd_mod_ops {
 	char *name;
+	char* (*dma_name)(struct rsnd_mod *mod);
 	int (*probe)(struct rsnd_mod *mod,
 		     struct rsnd_dai *rdai);
 	int (*remove)(struct rsnd_mod *mod,
@@ -224,6 +225,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 		   enum rsnd_mod_type type,
 		   int id);
 char *rsnd_mod_name(struct rsnd_mod *mod);
+char *rsnd_mod_dma_name(struct rsnd_mod *mod);
 
 /*
  *	R-Car sound DAI
@@ -391,8 +393,12 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
 unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct rsnd_dai_stream *io,
 				   struct snd_pcm_runtime *runtime);
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai);
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif);
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+		       struct rsnd_dai *rdai,
+		       int use_busif);
 int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
 			    struct rsnd_dai *rdai);
 
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 200eda0..4d39505 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -106,18 +106,17 @@ struct rsnd_src {
 /*
  *		Gen1/Gen2 common functions
  */
-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
-			   struct rsnd_dai *rdai)
+int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
 {
-	struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
-	struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
 	int ssi_id = rsnd_mod_id(ssi_mod);
 
 	/*
 	 * SSI_MODE0
 	 */
 	rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
-		      src_mod ? 0 : (1 << ssi_id));
+		      !use_busif << ssi_id);
 
 	/*
 	 * SSI_MODE1
@@ -143,6 +142,29 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
 				      0x2 << shift : 0x1 << shift);
 	}
 
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif) {
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
+			       rsnd_get_adinr(ssi_mod));
+		rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE,  1);
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
+	}
+
+	return 0;
+}
+
+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
+			struct rsnd_dai *rdai,
+			int use_busif)
+{
+	/*
+	 * DMA settings for SSIU
+	 */
+	if (use_busif)
+		rsnd_mod_write(ssi_mod, SSI_CTRL, 0);
+
 	return 0;
 }
 
@@ -467,9 +489,6 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr(mod));
-	rsnd_mod_write(mod, SSI_BUSIF_MODE,  1);
-
 	rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
 
 	rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
@@ -554,7 +573,6 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
 
 	rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
 
-	rsnd_mod_write(mod, SSI_CTRL, 0x1);
 	rsnd_mod_write(mod, SRC_CTRL, val);
 
 	return rsnd_src_start(mod, rdai);
@@ -565,7 +583,6 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
 {
 	struct rsnd_src *src = rsnd_mod_to_src(mod);
 
-	rsnd_mod_write(mod, SSI_CTRL, 0);
 	rsnd_mod_write(mod, SRC_CTRL, 0);
 
 	rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 2df723d..34e8400 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -90,6 +90,20 @@ struct rsnd_ssi {
 #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
 #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
 
+static int rsnd_ssi_use_busif(struct rsnd_mod *mod)
+{
+	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+	int use_busif = 0;
+
+	if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF))
+		use_busif = 1;
+	if (rsnd_io_to_mod_src(io))
+		use_busif = 1;
+
+	return use_busif;
+}
+
 static void rsnd_ssi_status_check(struct rsnd_mod *mod,
 				  u32 bit)
 {
@@ -289,8 +303,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
 	ssi->cr_own	= cr;
 	ssi->err	= -1; /* ignore 1st error */
 
-	rsnd_src_ssi_mode_init(mod, rdai);
-
 	return 0;
 }
 
@@ -389,6 +401,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
 	/* enable PIO IRQ */
 	ssi->cr_etc = UIEN | OIEN | DIEN;
 
+	rsnd_src_ssiu_start(mod, rdai, 0);
+
 	rsnd_src_enable_ssi_irq(mod, rdai);
 
 	rsnd_ssi_hw_start(ssi, rdai, io);
@@ -405,6 +419,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
 
 	rsnd_ssi_hw_stop(ssi, rdai);
 
+	rsnd_src_ssiu_stop(mod, rdai, 0);
+
 	return 0;
 }
 
@@ -457,6 +473,8 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
 	/* enable DMA transfer */
 	ssi->cr_etc = DMEN;
 
+	rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
+
 	rsnd_dma_start(dma);
 
 	rsnd_ssi_hw_start(ssi, ssi->rdai, io);
@@ -482,11 +500,19 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
 
 	rsnd_dma_stop(dma);
 
+	rsnd_src_ssiu_stop(mod, rdai, 1);
+
 	return 0;
 }
 
+static char *rsnd_ssi_dma_name(struct rsnd_mod *mod)
+{
+	return rsnd_ssi_use_busif(mod) ? "ssiu" : SSI_NAME;
+}
+
 static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
 	.name	= SSI_NAME,
+	.dma_name = rsnd_ssi_dma_name,
 	.probe	= rsnd_ssi_dma_probe,
 	.remove	= rsnd_ssi_dma_remove,
 	.init	= rsnd_ssi_init,
@@ -595,6 +621,9 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
 		 */
 		ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
 			0 : 1;
+
+		if (of_get_property(np, "no-busif", NULL))
+			ssi_info->flags |= RSND_SSI_NO_BUSIF;
 	}
 
 rsnd_of_parse_ssi_end:
-- 
1.7.9.5


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

* [PATCH 05/10 v2] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:56     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

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

 - no change

 sound/soc/sh/rcar/core.c |   76 +++++++++++-----------------------------------
 sound/soc/sh/rcar/rsnd.h |    4 ---
 2 files changed, 18 insertions(+), 62 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 8c3707a..5149fe2d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -164,26 +164,8 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 /*
  *	rsnd_dma functions
  */
-static void __rsnd_dma_start(struct rsnd_dma *dma);
-static void rsnd_dma_continue(struct rsnd_dma *dma)
-{
-	/* push next A or B plane */
-	dma->submit_loop = 1;
-	schedule_work(&dma->work);
-}
-
-void rsnd_dma_start(struct rsnd_dma *dma)
-{
-	/* push both A and B plane*/
-	dma->offset = 0;
-	dma->submit_loop = 2;
-	__rsnd_dma_start(dma);
-}
-
 void rsnd_dma_stop(struct rsnd_dma *dma)
 {
-	dma->submit_loop = 0;
-	cancel_work_sync(&dma->work);
 	dmaengine_terminate_all(dma->chan);
 }
 
@@ -191,11 +173,7 @@ static void rsnd_dma_complete(void *data)
 {
 	struct rsnd_dma *dma = (struct rsnd_dma *)data;
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	unsigned long flags;
-
-	rsnd_lock(priv, flags);
 
 	/*
 	 * Renesas sound Gen1 needs 1 DMAC,
@@ -208,57 +186,40 @@ static void rsnd_dma_complete(void *data)
 	 * rsnd_dai_pointer_update() will be called twice,
 	 * ant it will breaks io->byte_pos
 	 */
-	if (dma->submit_loop)
-		rsnd_dma_continue(dma);
-
-	rsnd_unlock(priv, flags);
 
 	rsnd_dai_pointer_update(io, io->byte_per_period);
 }
 
-static void __rsnd_dma_start(struct rsnd_dma *dma)
+void rsnd_dma_start(struct rsnd_dma *dma)
 {
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct snd_pcm_substream *substream = io->substream;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_async_tx_descriptor *desc;
-	dma_addr_t buf;
-	size_t len = io->byte_per_period;
-	int i;
-
-	for (i = 0; i < dma->submit_loop; i++) {
 
-		buf = runtime->dma_addr +
-			rsnd_dai_pointer_offset(io, dma->offset + len);
-		dma->offset = len;
+	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dma->dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
-		desc = dmaengine_prep_slave_single(
-			dma->chan, buf, len, dma->dir,
-			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= rsnd_dma_complete;
-		desc->callback_param	= dma;
+	if (!desc) {
+		dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
+		return;
+	}
 
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dev, "dmaengine_submit() fail\n");
-			return;
-		}
+	desc->callback		= rsnd_dma_complete;
+	desc->callback_param	= dma;
 
-		dma_async_issue_pending(dma->chan);
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dev, "dmaengine_submit() fail\n");
+		return;
 	}
-}
-
-static void rsnd_dma_do_work(struct work_struct *work)
-{
-	struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
 
-	__rsnd_dma_start(dma);
+	dma_async_issue_pending(dma->chan);
 }
 
 int rsnd_dma_available(struct rsnd_dma *dma)
@@ -372,7 +333,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		goto rsnd_dma_init_err;
 
 	dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-	INIT_WORK(&dma->work, rsnd_dma_do_work);
 
 	return 0;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index a1466c1..60b5e92 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -156,12 +156,8 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod);
  */
 struct rsnd_dma {
 	struct sh_dmae_slave	slave;
-	struct work_struct	work;
 	struct dma_chan		*chan;
 	enum dma_transfer_direction dir;
-
-	int submit_loop;
-	int offset; /* it cares A/B plane */
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 05/10 v2] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
@ 2014-06-23  0:56     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

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

 - no change

 sound/soc/sh/rcar/core.c |   76 +++++++++++-----------------------------------
 sound/soc/sh/rcar/rsnd.h |    4 ---
 2 files changed, 18 insertions(+), 62 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 8c3707a..5149fe2d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -164,26 +164,8 @@ void rsnd_mod_init(struct rsnd_priv *priv,
 /*
  *	rsnd_dma functions
  */
-static void __rsnd_dma_start(struct rsnd_dma *dma);
-static void rsnd_dma_continue(struct rsnd_dma *dma)
-{
-	/* push next A or B plane */
-	dma->submit_loop = 1;
-	schedule_work(&dma->work);
-}
-
-void rsnd_dma_start(struct rsnd_dma *dma)
-{
-	/* push both A and B plane*/
-	dma->offset = 0;
-	dma->submit_loop = 2;
-	__rsnd_dma_start(dma);
-}
-
 void rsnd_dma_stop(struct rsnd_dma *dma)
 {
-	dma->submit_loop = 0;
-	cancel_work_sync(&dma->work);
 	dmaengine_terminate_all(dma->chan);
 }
 
@@ -191,11 +173,7 @@ static void rsnd_dma_complete(void *data)
 {
 	struct rsnd_dma *dma = (struct rsnd_dma *)data;
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	unsigned long flags;
-
-	rsnd_lock(priv, flags);
 
 	/*
 	 * Renesas sound Gen1 needs 1 DMAC,
@@ -208,57 +186,40 @@ static void rsnd_dma_complete(void *data)
 	 * rsnd_dai_pointer_update() will be called twice,
 	 * ant it will breaks io->byte_pos
 	 */
-	if (dma->submit_loop)
-		rsnd_dma_continue(dma);
-
-	rsnd_unlock(priv, flags);
 
 	rsnd_dai_pointer_update(io, io->byte_per_period);
 }
 
-static void __rsnd_dma_start(struct rsnd_dma *dma)
+void rsnd_dma_start(struct rsnd_dma *dma)
 {
 	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct snd_pcm_substream *substream = io->substream;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_async_tx_descriptor *desc;
-	dma_addr_t buf;
-	size_t len = io->byte_per_period;
-	int i;
-
-	for (i = 0; i < dma->submit_loop; i++) {
 
-		buf = runtime->dma_addr +
-			rsnd_dai_pointer_offset(io, dma->offset + len);
-		dma->offset = len;
+	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 substream->runtime->dma_addr,
+					 snd_pcm_lib_buffer_bytes(substream),
+					 snd_pcm_lib_period_bytes(substream),
+					 dma->dir,
+					 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
-		desc = dmaengine_prep_slave_single(
-			dma->chan, buf, len, dma->dir,
-			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc) {
-			dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
-			return;
-		}
-
-		desc->callback		= rsnd_dma_complete;
-		desc->callback_param	= dma;
+	if (!desc) {
+		dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
+		return;
+	}
 
-		if (dmaengine_submit(desc) < 0) {
-			dev_err(dev, "dmaengine_submit() fail\n");
-			return;
-		}
+	desc->callback		= rsnd_dma_complete;
+	desc->callback_param	= dma;
 
-		dma_async_issue_pending(dma->chan);
+	if (dmaengine_submit(desc) < 0) {
+		dev_err(dev, "dmaengine_submit() fail\n");
+		return;
 	}
-}
-
-static void rsnd_dma_do_work(struct work_struct *work)
-{
-	struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
 
-	__rsnd_dma_start(dma);
+	dma_async_issue_pending(dma->chan);
 }
 
 int rsnd_dma_available(struct rsnd_dma *dma)
@@ -372,7 +333,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 		goto rsnd_dma_init_err;
 
 	dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-	INIT_WORK(&dma->work, rsnd_dma_do_work);
 
 	return 0;
 
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index a1466c1..60b5e92 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -156,12 +156,8 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod);
  */
 struct rsnd_dma {
 	struct sh_dmae_slave	slave;
-	struct work_struct	work;
 	struct dma_chan		*chan;
 	enum dma_transfer_direction dir;
-
-	int submit_loop;
-	int offset; /* it cares A/B plane */
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 06/10 v2] ASoC: rsnd: enable DVC when capture
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:57     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

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

 - no change

 sound/soc/sh/rcar/dvc.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index ed00070..deef310 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -191,24 +191,20 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct snd_soc_pcm_runtime *rtd)
 {
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-	struct device *dev = rsnd_priv_to_dev(priv);
 	struct snd_card *card = rtd->card->snd_card;
 	struct snd_kcontrol *kctrl;
 	static struct snd_kcontrol_new knew = {
 		.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name		= "Playback Volume",
 		.info		= rsnd_dvc_volume_info,
 		.get		= rsnd_dvc_volume_get,
 		.put		= rsnd_dvc_volume_put,
 	};
 	int ret;
 
-	if (!rsnd_dai_is_play(rdai, io)) {
-		dev_err(dev, "DVC%d is connected to Capture DAI\n",
-			rsnd_mod_id(mod));
-		return -EINVAL;
-	}
+	if (rsnd_dai_is_play(rdai, io))
+		knew.name = "Playback Volume";
+	else
+		knew.name = "Capture Volume";
 
 	kctrl = snd_ctl_new1(&knew, mod);
 	if (!kctrl)
-- 
1.7.9.5


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

* [PATCH 06/10 v2] ASoC: rsnd: enable DVC when capture
@ 2014-06-23  0:57     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

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

 - no change

 sound/soc/sh/rcar/dvc.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index ed00070..deef310 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -191,24 +191,20 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct snd_soc_pcm_runtime *rtd)
 {
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-	struct device *dev = rsnd_priv_to_dev(priv);
 	struct snd_card *card = rtd->card->snd_card;
 	struct snd_kcontrol *kctrl;
 	static struct snd_kcontrol_new knew = {
 		.iface		= SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name		= "Playback Volume",
 		.info		= rsnd_dvc_volume_info,
 		.get		= rsnd_dvc_volume_get,
 		.put		= rsnd_dvc_volume_put,
 	};
 	int ret;
 
-	if (!rsnd_dai_is_play(rdai, io)) {
-		dev_err(dev, "DVC%d is connected to Capture DAI\n",
-			rsnd_mod_id(mod));
-		return -EINVAL;
-	}
+	if (rsnd_dai_is_play(rdai, io))
+		knew.name = "Playback Volume";
+	else
+		knew.name = "Capture Volume";
 
 	kctrl = snd_ctl_new1(&knew, mod);
 	if (!kctrl)
-- 
1.7.9.5


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

* [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:57     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

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

 - src_node -> np on of_property_read_u32()

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

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


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

* [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-23  0:57     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

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

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

 - src_node -> np on of_property_read_u32()

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

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


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

* [PATCH 08/10 v2] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:58     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

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

 - based on latest mark/topic/rcar

 sound/soc/sh/rcar/core.c |   45 +++++++++++++++++++----------
 sound/soc/sh/rcar/gen.c  |   71 ++++++++++++++++++++--------------------------
 sound/soc/sh/rcar/rsnd.h |    7 ++---
 3 files changed, 64 insertions(+), 59 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 5149fe2d..4435a31e 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -239,8 +239,21 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 
 }
 
-static void rsnd_dma_of_name(struct rsnd_dma *dma,
-			     int is_play, char *dma_name)
+static void rsnd_dma_of_name(struct rsnd_mod *mod_from,
+			     struct rsnd_mod *mod_to,
+			     char *dma_name)
+{
+	int index = 0;
+
+	index = _rsnd_dma_of_name(dma_name + index, mod_from);
+	*(dma_name + index++) = '_';
+	index = _rsnd_dma_of_name(dma_name + index, mod_to);
+}
+
+static void rsnd_dma_of_path(struct rsnd_dma *dma,
+			     int is_play,
+			     struct rsnd_mod **mod_from,
+			     struct rsnd_mod **mod_to)
 {
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
@@ -248,7 +261,6 @@ static void rsnd_dma_of_name(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];
-	struct rsnd_mod *src_mod, *dst_mod;
 	int i, index;
 
 
@@ -285,17 +297,12 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	}
 
 	if (is_play) {
-		src_mod = mod[index - 1];
-		dst_mod = mod[index];
+		*mod_from = mod[index - 1];
+		*mod_to   = mod[index];
 	} else {
-		src_mod = mod[index];
-		dst_mod = mod[index - 1];
+		*mod_from = mod[index];
+		*mod_to   = mod[index - 1];
 	}
-
-	index = 0;
-	index = _rsnd_dma_of_name(dma_name + index, src_mod);
-	*(dma_name + index++) = '_';
-	index = _rsnd_dma_of_name(dma_name + index, dst_mod);
 }
 
 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
@@ -303,6 +310,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_slave_config cfg;
+	struct rsnd_mod *mod_from;
+	struct rsnd_mod *mod_to;
 	char dma_name[DMA_NAME_SIZE];
 	dma_cap_mask_t mask;
 	int ret;
@@ -315,10 +324,16 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	rsnd_dma_of_name(dma, is_play, dma_name);
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+	rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
+	rsnd_dma_of_name(mod_from, mod_to, dma_name);
+
+	cfg.slave_id	= id;
+	cfg.direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	cfg.src_addr	= rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
+	cfg.dst_addr	= rsnd_gen_dma_addr(priv, mod_to,   is_play, 0);
 
-	dev_dbg(dev, "dma name : %s\n", dma_name);
+	dev_dbg(dev, "dma : %s %pad -> %pad\n",
+		dma_name, &cfg.src_addr, &cfg.dst_addr);
 
 	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
 						     (void *)id, dev,
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 46677af..73ce4c9 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -168,7 +168,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
  *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
- *	CMD : 0xec500000 / 0xec008000                             0xec308000
+ *	CMD : 0xec500000 /            / 0xec008000                0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
@@ -188,14 +188,13 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+static dma_addr_t
+rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+		   struct rsnd_mod *mod,
+		   int is_play, int is_from)
 {
 	struct platform_device *pdev = rsnd_priv_to_pdev(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 	dma_addr_t ssi_reg = platform_get_resource(pdev,
 				IORESOURCE_MEM, RSND_GEN2_SSI)->start;
@@ -206,76 +205,68 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	int use_dvc = !!rsnd_io_to_mod_dvc(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
-		dma_addr_t src_addr;
-		dma_addr_t dst_addr;
+		dma_addr_t out_addr;
+		dma_addr_t in_addr;
 	} dma_addrs[3][2][3] = {
 		/* SRC */
 		{{{ 0,				0 },
 		/* Capture */
-		  { RDMA_SRC_O_N(src, id),	0 },
-		  { RDMA_CMD_O_N(src, id),	0 } },
+		  { RDMA_SRC_O_N(src, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_CMD_O_N(src, id),	RDMA_SRC_I_P(src, id) } },
 		 /* Playback */
 		 {{ 0,				0, },
-		  { 0,				RDMA_SRC_I_N(src, id) },
-		  { 0,				RDMA_SRC_I_N(src, id) } }
+		  { RDMA_SRC_O_P(src, id),	RDMA_SRC_I_N(src, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SRC_I_N(src, id) } }
 		},
 		/* SSI */
 		/* Capture */
 		{{{ RDMA_SSI_O_N(ssi, id),	0 },
-		  { 0,				0 },
-		  { 0,				0 } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
-		  { 0,				0 },
-		  { 0,				0 } }
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } }
 		},
 		/* SSIU */
 		/* Capture */
 		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
-		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
-		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc & !use_src) {
+	if (use_dvc & !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
-		return;
-	}
 
 	/* use SSIU or SSI ? */
 	if (is_ssi && (0 = strcmp(rsnd_mod_dma_name(mod), "ssiu")))
 		is_ssi++;
 
-	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
-	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
-
-	dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
-		id, cfg->src_addr, cfg->dst_addr);
+	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;
 }
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+			     struct rsnd_mod *mod,
+			     int is_play, int is_from)
 {
-	cfg->slave_id   = slave_id;
-	cfg->src_addr   = 0;
-	cfg->dst_addr   = 0;
-	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
 	/*
 	 * gen1 uses default DMA addr
 	 */
 	if (rsnd_is_gen1(priv))
-		return;
+		return 0;
 
-	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
-}
+	if (!mod)
+		return 0;
 
+	return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
+}
 
 /*
  *		Gen2
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 60b5e92..425b22e 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -279,10 +279,9 @@ int rsnd_gen_probe(struct platform_device *pdev,
 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
 			       struct rsnd_mod *mod,
 			       enum rsnd_reg reg);
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play,  int slave_id);
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_mod *mod,
+		       int is_play,  int is_from);
 
 #define rsnd_is_gen1(s)		(((s)->info->flags & RSND_GEN_MASK) = RSND_GEN1)
 #define rsnd_is_gen2(s)		(((s)->info->flags & RSND_GEN_MASK) = RSND_GEN2)
-- 
1.7.9.5


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

* [PATCH 08/10 v2] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
@ 2014-06-23  0:58     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

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

 - based on latest mark/topic/rcar

 sound/soc/sh/rcar/core.c |   45 +++++++++++++++++++----------
 sound/soc/sh/rcar/gen.c  |   71 ++++++++++++++++++++--------------------------
 sound/soc/sh/rcar/rsnd.h |    7 ++---
 3 files changed, 64 insertions(+), 59 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 5149fe2d..4435a31e 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -239,8 +239,21 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
 
 }
 
-static void rsnd_dma_of_name(struct rsnd_dma *dma,
-			     int is_play, char *dma_name)
+static void rsnd_dma_of_name(struct rsnd_mod *mod_from,
+			     struct rsnd_mod *mod_to,
+			     char *dma_name)
+{
+	int index = 0;
+
+	index = _rsnd_dma_of_name(dma_name + index, mod_from);
+	*(dma_name + index++) = '_';
+	index = _rsnd_dma_of_name(dma_name + index, mod_to);
+}
+
+static void rsnd_dma_of_path(struct rsnd_dma *dma,
+			     int is_play,
+			     struct rsnd_mod **mod_from,
+			     struct rsnd_mod **mod_to)
 {
 	struct rsnd_mod *this = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
@@ -248,7 +261,6 @@ static void rsnd_dma_of_name(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];
-	struct rsnd_mod *src_mod, *dst_mod;
 	int i, index;
 
 
@@ -285,17 +297,12 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
 	}
 
 	if (is_play) {
-		src_mod = mod[index - 1];
-		dst_mod = mod[index];
+		*mod_from = mod[index - 1];
+		*mod_to   = mod[index];
 	} else {
-		src_mod = mod[index];
-		dst_mod = mod[index - 1];
+		*mod_from = mod[index];
+		*mod_to   = mod[index - 1];
 	}
-
-	index = 0;
-	index = _rsnd_dma_of_name(dma_name + index, src_mod);
-	*(dma_name + index++) = '_';
-	index = _rsnd_dma_of_name(dma_name + index, dst_mod);
 }
 
 int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
@@ -303,6 +310,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 {
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct dma_slave_config cfg;
+	struct rsnd_mod *mod_from;
+	struct rsnd_mod *mod_to;
 	char dma_name[DMA_NAME_SIZE];
 	dma_cap_mask_t mask;
 	int ret;
@@ -315,10 +324,16 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	rsnd_dma_of_name(dma, is_play, dma_name);
-	rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+	rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
+	rsnd_dma_of_name(mod_from, mod_to, dma_name);
+
+	cfg.slave_id	= id;
+	cfg.direction	= is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+	cfg.src_addr	= rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
+	cfg.dst_addr	= rsnd_gen_dma_addr(priv, mod_to,   is_play, 0);
 
-	dev_dbg(dev, "dma name : %s\n", dma_name);
+	dev_dbg(dev, "dma : %s %pad -> %pad\n",
+		dma_name, &cfg.src_addr, &cfg.dst_addr);
 
 	dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
 						     (void *)id, dev,
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 46677af..73ce4c9 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -168,7 +168,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
  *	SSI : 0xec541000 / 0xec241008 / 0xec24100c
  *	SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
  *	SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
- *	CMD : 0xec500000 / 0xec008000                             0xec308000
+ *	CMD : 0xec500000 /            / 0xec008000                0xec308000
  */
 #define RDMA_SSI_I_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
 #define RDMA_SSI_O_N(addr, i)	(addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
@@ -188,14 +188,13 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
 #define RDMA_CMD_O_N(addr, i)	(addr ##_reg - 0x004f8000 + (0x400 * i))
 #define RDMA_CMD_O_P(addr, i)	(addr ##_reg - 0x001f8000 + (0x400 * i))
 
-static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+static dma_addr_t
+rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+		   struct rsnd_mod *mod,
+		   int is_play, int is_from)
 {
 	struct platform_device *pdev = rsnd_priv_to_pdev(priv);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
 	struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
 	dma_addr_t ssi_reg = platform_get_resource(pdev,
 				IORESOURCE_MEM, RSND_GEN2_SSI)->start;
@@ -206,76 +205,68 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
 	int use_dvc = !!rsnd_io_to_mod_dvc(io);
 	int id = rsnd_mod_id(mod);
 	struct dma_addr {
-		dma_addr_t src_addr;
-		dma_addr_t dst_addr;
+		dma_addr_t out_addr;
+		dma_addr_t in_addr;
 	} dma_addrs[3][2][3] = {
 		/* SRC */
 		{{{ 0,				0 },
 		/* Capture */
-		  { RDMA_SRC_O_N(src, id),	0 },
-		  { RDMA_CMD_O_N(src, id),	0 } },
+		  { RDMA_SRC_O_N(src, id),	RDMA_SRC_I_P(src, id) },
+		  { RDMA_CMD_O_N(src, id),	RDMA_SRC_I_P(src, id) } },
 		 /* Playback */
 		 {{ 0,				0, },
-		  { 0,				RDMA_SRC_I_N(src, id) },
-		  { 0,				RDMA_SRC_I_N(src, id) } }
+		  { RDMA_SRC_O_P(src, id),	RDMA_SRC_I_N(src, id) },
+		  { RDMA_CMD_O_P(src, id),	RDMA_SRC_I_N(src, id) } }
 		},
 		/* SSI */
 		/* Capture */
 		{{{ RDMA_SSI_O_N(ssi, id),	0 },
-		  { 0,				0 },
-		  { 0,				0 } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSI_I_N(ssi, id) },
-		  { 0,				0 },
-		  { 0,				0 } }
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } }
 		},
 		/* SSIU */
 		/* Capture */
 		{{{ RDMA_SSIU_O_N(ssi, id),	0 },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) },
-		  { RDMA_SSIU_O_P(ssi, id),	RDMA_SRC_I_P(src, id) } },
+		  { RDMA_SSIU_O_P(ssi, id),	0 },
+		  { RDMA_SSIU_O_P(ssi, id),	0 } },
 		 /* Playback */
 		 {{ 0,				RDMA_SSIU_I_N(ssi, id) },
-		  { RDMA_SRC_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) },
-		  { RDMA_CMD_O_P(src, id),	RDMA_SSIU_I_P(ssi, id) } } },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) },
+		  { 0,				RDMA_SSIU_I_P(ssi, id) } } },
 	};
 
 	/* it shouldn't happen */
-	if (use_dvc & !use_src) {
+	if (use_dvc & !use_src)
 		dev_err(dev, "DVC is selected without SRC\n");
-		return;
-	}
 
 	/* use SSIU or SSI ? */
 	if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
 		is_ssi++;
 
-	cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
-	cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
-
-	dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
-		id, cfg->src_addr, cfg->dst_addr);
+	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;
 }
 
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play, int slave_id)
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+			     struct rsnd_mod *mod,
+			     int is_play, int is_from)
 {
-	cfg->slave_id   = slave_id;
-	cfg->src_addr   = 0;
-	cfg->dst_addr   = 0;
-	cfg->direction  = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
-
 	/*
 	 * gen1 uses default DMA addr
 	 */
 	if (rsnd_is_gen1(priv))
-		return;
+		return 0;
 
-	rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
-}
+	if (!mod)
+		return 0;
 
+	return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
+}
 
 /*
  *		Gen2
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 60b5e92..425b22e 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -279,10 +279,9 @@ int rsnd_gen_probe(struct platform_device *pdev,
 void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
 			       struct rsnd_mod *mod,
 			       enum rsnd_reg reg);
-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
-		       struct rsnd_dma *dma,
-		       struct dma_slave_config *cfg,
-		       int is_play,  int slave_id);
+dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+		       struct rsnd_mod *mod,
+		       int is_play,  int is_from);
 
 #define rsnd_is_gen1(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
 #define rsnd_is_gen2(s)		(((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
-- 
1.7.9.5


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

* [PATCH 09/10 v2] ASoC: rsnd: DMA start address is properly used for each DMAC
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:59     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

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

 - based on latest mark/topic/rcar

 sound/soc/sh/rcar/core.c |    2 ++
 sound/soc/sh/rcar/rsnd.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 4435a31e..49d9b31 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
 	struct dma_async_tx_descriptor *desc;
 
 	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 (dma->addr) ? dma->addr :
 					 substream->runtime->dma_addr,
 					 snd_pcm_lib_buffer_bytes(substream),
 					 snd_pcm_lib_period_bytes(substream),
@@ -347,6 +348,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	if (ret < 0)
 		goto rsnd_dma_init_err;
 
+	dma->addr = is_play ? cfg.src_addr : cfg.dst_addr;
 	dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
 
 	return 0;
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 425b22e..631b149 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -158,6 +158,7 @@ struct rsnd_dma {
 	struct sh_dmae_slave	slave;
 	struct dma_chan		*chan;
 	enum dma_transfer_direction dir;
+	dma_addr_t		addr;
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 09/10 v2] ASoC: rsnd: DMA start address is properly used for each DMAC
@ 2014-06-23  0:59     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

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

 - based on latest mark/topic/rcar

 sound/soc/sh/rcar/core.c |    2 ++
 sound/soc/sh/rcar/rsnd.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 4435a31e..49d9b31 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
 	struct dma_async_tx_descriptor *desc;
 
 	desc = dmaengine_prep_dma_cyclic(dma->chan,
+					 (dma->addr) ? dma->addr :
 					 substream->runtime->dma_addr,
 					 snd_pcm_lib_buffer_bytes(substream),
 					 snd_pcm_lib_period_bytes(substream),
@@ -347,6 +348,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
 	if (ret < 0)
 		goto rsnd_dma_init_err;
 
+	dma->addr = is_play ? cfg.src_addr : cfg.dst_addr;
 	dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
 
 	return 0;
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 425b22e..631b149 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -158,6 +158,7 @@ struct rsnd_dma {
 	struct sh_dmae_slave	slave;
 	struct dma_chan		*chan;
 	enum dma_transfer_direction dir;
+	dma_addr_t		addr;
 };
 
 void rsnd_dma_start(struct rsnd_dma *dma);
-- 
1.7.9.5


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

* [PATCH 10/10 v2] ASoC: rsnd: add DT support to DVC
  2014-06-23  0:54   ` Kuninori Morimoto
@ 2014-06-23  0:59     ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Now, DVC can use DT

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

 - no change

 .../devicetree/bindings/sound/renesas,rsnd.txt     |    8 +++++
 sound/soc/sh/rcar/core.c                           |   13 +++++--
 sound/soc/sh/rcar/dvc.c                            |   38 ++++++++++++++++++++
 3 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 1d88d42..652573e 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -13,6 +13,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,dvc		: Should contain DVC feature.
+				  The number of DVC subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dai		: DAI contents.
 				  The number of DAI subnode should be same as HW.
 				  see below for detail.
@@ -40,6 +43,11 @@ rcar_sound: rcar_sound@0xffd90000 {
 		<0 0xec540000 0 0x1000>, /* SSIU */
 		<0 0xec541000 0 0x1280>; /* SSI */
 
+	rcar_sound,dvc {
+		dvc0: dvc@0 { };
+		dvc1: dvc@1 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 { };
 		src1: src@1 { };
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 49d9b31..907d480 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -286,7 +286,13 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			mod[i] = src;
 			src = NULL;
 		} else {
-			mod[i] = dvc;
+			if ((!is_play) && (this = src))
+				this = dvc;
+
+			mod[i] = (is_play) ? src : dvc;
+			i++;
+			mod[i] = (is_play) ? dvc : src;
+			src = NULL;
 			dvc = NULL;
 		}
 
@@ -719,12 +725,13 @@ 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 *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;
+	int dai_i, ssi_i, src_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -750,6 +757,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");
+	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
 if (name##_node) {							\
@@ -785,6 +793,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(dvc);
 
 			if (playback)
 				of_node_put(playback);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index deef310..9096fb0 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
 	return &((struct rsnd_dvc *)(priv->dvc) + id)->mod;
 }
 
+static void rsnd_of_parse_dvc(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_dvc_platform_info *dvc_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,dvc");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_dvc_end;
+
+	dvc_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_dvc_platform_info) * nr,
+				GFP_KERNEL);
+	if (!dvc_info) {
+		dev_err(dev, "dvc info allocation error\n");
+		goto rsnd_of_parse_dvc_end;
+	}
+
+	info->dvc_info		= dvc_info;
+	info->dvc_info_nr	= nr;
+
+rsnd_of_parse_dvc_end:
+	of_node_put(node);
+}
+
 int rsnd_dvc_probe(struct platform_device *pdev,
 		   const struct rsnd_of_data *of_data,
 		   struct rsnd_priv *priv)
@@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr;
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
 	nr = info->dvc_info_nr;
 	if (!nr)
 		return 0;
-- 
1.7.9.5


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

* [PATCH 10/10 v2] ASoC: rsnd: add DT support to DVC
@ 2014-06-23  0:59     ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-23  0:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

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

Now, DVC can use DT

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

 - no change

 .../devicetree/bindings/sound/renesas,rsnd.txt     |    8 +++++
 sound/soc/sh/rcar/core.c                           |   13 +++++--
 sound/soc/sh/rcar/dvc.c                            |   38 ++++++++++++++++++++
 3 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 1d88d42..652573e 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -13,6 +13,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,dvc		: Should contain DVC feature.
+				  The number of DVC subnode should be same as HW.
+				  see below for detail.
 - rcar_sound,dai		: DAI contents.
 				  The number of DAI subnode should be same as HW.
 				  see below for detail.
@@ -40,6 +43,11 @@ rcar_sound: rcar_sound@0xffd90000 {
 		<0 0xec540000 0 0x1000>, /* SSIU */
 		<0 0xec541000 0 0x1280>; /* SSI */
 
+	rcar_sound,dvc {
+		dvc0: dvc@0 { };
+		dvc1: dvc@1 { };
+	};
+
 	rcar_sound,src {
 		src0: src@0 { };
 		src1: src@1 { };
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 49d9b31..907d480 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -286,7 +286,13 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
 			mod[i] = src;
 			src = NULL;
 		} else {
-			mod[i] = dvc;
+			if ((!is_play) && (this == src))
+				this = dvc;
+
+			mod[i] = (is_play) ? src : dvc;
+			i++;
+			mod[i] = (is_play) ? dvc : src;
+			src = NULL;
 			dvc = NULL;
 		}
 
@@ -719,12 +725,13 @@ 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 *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;
+	int dai_i, ssi_i, src_i, dvc_i;
 
 	if (!of_data)
 		return;
@@ -750,6 +757,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");
+	dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
 
 #define mod_parse(name)							\
 if (name##_node) {							\
@@ -785,6 +793,7 @@ if (name##_node) {							\
 
 			mod_parse(ssi);
 			mod_parse(src);
+			mod_parse(dvc);
 
 			if (playback)
 				of_node_put(playback);
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index deef310..9096fb0 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
 	return &((struct rsnd_dvc *)(priv->dvc) + id)->mod;
 }
 
+static void rsnd_of_parse_dvc(struct platform_device *pdev,
+			      const struct rsnd_of_data *of_data,
+			      struct rsnd_priv *priv)
+{
+	struct device_node *node;
+	struct rsnd_dvc_platform_info *dvc_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,dvc");
+	if (!node)
+		return;
+
+	nr = of_get_child_count(node);
+	if (!nr)
+		goto rsnd_of_parse_dvc_end;
+
+	dvc_info = devm_kzalloc(dev,
+				sizeof(struct rsnd_dvc_platform_info) * nr,
+				GFP_KERNEL);
+	if (!dvc_info) {
+		dev_err(dev, "dvc info allocation error\n");
+		goto rsnd_of_parse_dvc_end;
+	}
+
+	info->dvc_info		= dvc_info;
+	info->dvc_info_nr	= nr;
+
+rsnd_of_parse_dvc_end:
+	of_node_put(node);
+}
+
 int rsnd_dvc_probe(struct platform_device *pdev,
 		   const struct rsnd_of_data *of_data,
 		   struct rsnd_priv *priv)
@@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
 	char name[RSND_DVC_NAME_SIZE];
 	int i, nr;
 
+	rsnd_of_parse_dvc(pdev, of_data, priv);
+
 	nr = info->dvc_info_nr;
 	if (!nr)
 		return 0;
-- 
1.7.9.5


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

* Re: [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
  2014-06-23  0:57     ` Kuninori Morimoto
@ 2014-06-28 13:40       ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-28 13:40 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Sun, Jun 22, 2014 at 05:57:42PM -0700, Kuninori Morimoto wrote:

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

It's not clear to me why this is something that we'd control in the
device tree.  Are there some systems which can't support this, if the
hardware can do it it's hard to see why someone wouldn't want to use it
(and why it wouldn't be a runtime decision anyway).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-28 13:40       ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-28 13:40 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

On Sun, Jun 22, 2014 at 05:57:42PM -0700, Kuninori Morimoto wrote:

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

It's not clear to me why this is something that we'd control in the
device tree.  Are there some systems which can't support this, if the
hardware can do it it's hard to see why someone wouldn't want to use it
(and why it wouldn't be a runtime decision anyway).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 06/10 v2] ASoC: rsnd: enable DVC when capture
  2014-06-23  0:57     ` Kuninori Morimoto
@ 2014-06-28 13:41       ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-28 13:41 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Sun, Jun 22, 2014 at 05:57:04PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current DVC can be enabled only when playback,
> but, this came from misunderstanding.
> It is not correct.

Applied up to here, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 06/10 v2] ASoC: rsnd: enable DVC when capture
@ 2014-06-28 13:41       ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-06-28 13:41 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Sun, Jun 22, 2014 at 05:57:04PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current DVC can be enabled only when playback,
> but, this came from misunderstanding.
> It is not correct.

Applied up to here, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
  2014-06-28 13:40       ` Mark Brown
@ 2014-06-30  0:41         ` Kuninori Morimoto
  -1 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-30  0:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh


Hi Mark

Thank you for your feedback

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

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

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

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

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

Now, this patch-set is...

o : accepted
x : this patch
- : not accepted

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

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

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

* Re: [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT
@ 2014-06-30  0:41         ` Kuninori Morimoto
  0 siblings, 0 replies; 76+ messages in thread
From: Kuninori Morimoto @ 2014-06-30  0:41 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh


Hi Mark

Thank you for your feedback

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

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

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

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

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

Now, this patch-set is...

o : accepted
x : this patch
- : not accepted

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

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

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

* Re: [PATCH 08/10 v2] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
  2014-06-23  0:58     ` Kuninori Morimoto
@ 2014-07-02 11:25       ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:25 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: linux-sh, Linux-ALSA, Simon, Kuninori Morimoto, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

On Sun, Jun 22, 2014 at 05:58:26PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current R-Car sound SSI/SRC/DVC selection has feature limit.
> (It is assuming that SSI/SRC are using same index number)

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 08/10 v2] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
@ 2014-07-02 11:25       ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:25 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: linux-sh, Linux-ALSA, Simon, Kuninori Morimoto, Liam Girdwood


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

On Sun, Jun 22, 2014 at 05:58:26PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Current R-Car sound SSI/SRC/DVC selection has feature limit.
> (It is assuming that SSI/SRC are using same index number)

Applied, thanks.

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

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



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

* Re: [PATCH 09/10 v2] ASoC: rsnd: DMA start address is properly used for each DMAC
  2014-06-23  0:59     ` Kuninori Morimoto
@ 2014-07-02 11:36       ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

On Sun, Jun 22, 2014 at 05:59:02PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> R-Car sound uses Audio DMAC and Audio DMAC peri peri.
> Audio DMAC peri peri transfers data inside circuit.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 09/10 v2] ASoC: rsnd: DMA start address is properly used for each DMAC
@ 2014-07-02 11:36       ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

On Sun, Jun 22, 2014 at 05:59:02PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> R-Car sound uses Audio DMAC and Audio DMAC peri peri.
> Audio DMAC peri peri transfers data inside circuit.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 10/10 v2] ASoC: rsnd: add DT support to DVC
  2014-06-23  0:59     ` Kuninori Morimoto
@ 2014-07-02 11:36       ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

On Sun, Jun 22, 2014 at 05:59:28PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Now, DVC can use DT

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 10/10 v2] ASoC: rsnd: add DT support to DVC
@ 2014-07-02 11:36       ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-02 11:36 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Kuninori Morimoto, Linux-ALSA, Liam Girdwood, Simon, linux-sh

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

On Sun, Jun 22, 2014 at 05:59:28PM -0700, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Now, DVC can use DT

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
  2014-06-18 10:06     ` Mark Brown
@ 2014-07-28 12:58       ` Simon Horman
  -1 siblings, 0 replies; 76+ messages in thread
From: Simon Horman @ 2014-07-28 12:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:
> On Wed, Jun 18, 2014 at 05:54:43PM +0900, Kuninori Morimoto wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > ad32d0c7b0e993433df152ae747652647eb65a27
> > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > added rsnd_gen_dma_addr() to calculate DMA addr,
> 
> Applied, thanks.

Hi,

I guess its a little too late in the cycle and I apologise
for not having noticed this earlier. It seems that while
this problem was added in v3.16-rc1 (by the patch detailed above)
the fix (this patch) is not present in v3.16-rc7.



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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
@ 2014-07-28 12:58       ` Simon Horman
  0 siblings, 0 replies; 76+ messages in thread
From: Simon Horman @ 2014-07-28 12:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:
> On Wed, Jun 18, 2014 at 05:54:43PM +0900, Kuninori Morimoto wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > ad32d0c7b0e993433df152ae747652647eb65a27
> > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > added rsnd_gen_dma_addr() to calculate DMA addr,
> 
> Applied, thanks.

Hi,

I guess its a little too late in the cycle and I apologise
for not having noticed this earlier. It seems that while
this problem was added in v3.16-rc1 (by the patch detailed above)
the fix (this patch) is not present in v3.16-rc7.



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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
  2014-07-28 12:58       ` Simon Horman
@ 2014-07-28 13:48         ` Mark Brown
  -1 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-28 13:48 UTC (permalink / raw)
  To: Simon Horman
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

On Mon, Jul 28, 2014 at 09:58:43PM +0900, Simon Horman wrote:
> On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:

> > > ad32d0c7b0e993433df152ae747652647eb65a27
> > > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > > added rsnd_gen_dma_addr() to calculate DMA addr,

> > Applied, thanks.

> I guess its a little too late in the cycle and I apologise
> for not having noticed this earlier. It seems that while
> this problem was added in v3.16-rc1 (by the patch detailed above)
> the fix (this patch) is not present in v3.16-rc7.

Yeah, I've got too big a backlog of fixes to actually send to Linus at
this point.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
@ 2014-07-28 13:48         ` Mark Brown
  0 siblings, 0 replies; 76+ messages in thread
From: Mark Brown @ 2014-07-28 13:48 UTC (permalink / raw)
  To: Simon Horman
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

On Mon, Jul 28, 2014 at 09:58:43PM +0900, Simon Horman wrote:
> On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:

> > > ad32d0c7b0e993433df152ae747652647eb65a27
> > > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > > added rsnd_gen_dma_addr() to calculate DMA addr,

> > Applied, thanks.

> I guess its a little too late in the cycle and I apologise
> for not having noticed this earlier. It seems that while
> this problem was added in v3.16-rc1 (by the patch detailed above)
> the fix (this patch) is not present in v3.16-rc7.

Yeah, I've got too big a backlog of fixes to actually send to Linus at
this point.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
  2014-07-28 13:48         ` Mark Brown
@ 2014-07-29  0:52           ` Simon Horman
  -1 siblings, 0 replies; 76+ messages in thread
From: Simon Horman @ 2014-07-29  0:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

On Mon, Jul 28, 2014 at 02:48:04PM +0100, Mark Brown wrote:
> On Mon, Jul 28, 2014 at 09:58:43PM +0900, Simon Horman wrote:
> > On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:
> 
> > > > ad32d0c7b0e993433df152ae747652647eb65a27
> > > > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > > > added rsnd_gen_dma_addr() to calculate DMA addr,
> 
> > > Applied, thanks.
> 
> > I guess its a little too late in the cycle and I apologise
> > for not having noticed this earlier. It seems that while
> > this problem was added in v3.16-rc1 (by the patch detailed above)
> > the fix (this patch) is not present in v3.16-rc7.
> 
> Yeah, I've got too big a backlog of fixes to actually send to Linus at
> this point.

Thanks. So long as it isn't completely lost I'm happy :)


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

* Re: [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
@ 2014-07-29  0:52           ` Simon Horman
  0 siblings, 0 replies; 76+ messages in thread
From: Simon Horman @ 2014-07-29  0:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kuninori Morimoto, Kuninori Morimoto, Linux-ALSA, Liam Girdwood,
	linux-sh

On Mon, Jul 28, 2014 at 02:48:04PM +0100, Mark Brown wrote:
> On Mon, Jul 28, 2014 at 09:58:43PM +0900, Simon Horman wrote:
> > On Wed, Jun 18, 2014 at 11:06:54AM +0100, Mark Brown wrote:
> 
> > > > ad32d0c7b0e993433df152ae747652647eb65a27
> > > > (ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
> > > > added rsnd_gen_dma_addr() to calculate DMA addr,
> 
> > > Applied, thanks.
> 
> > I guess its a little too late in the cycle and I apologise
> > for not having noticed this earlier. It seems that while
> > this problem was added in v3.16-rc1 (by the patch detailed above)
> > the fix (this patch) is not present in v3.16-rc7.
> 
> Yeah, I've got too big a backlog of fixes to actually send to Linus at
> this point.

Thanks. So long as it isn't completely lost I'm happy :)


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

end of thread, other threads:[~2014-07-29  0:52 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-18  8:53 [PATCH 0/12] ASoC: rsnd: fixup and DT support patches Kuninori Morimoto
2014-06-18  8:53 ` Kuninori Morimoto
2014-06-18  8:54 ` [PATCH 01/12] ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1 Kuninori Morimoto
2014-06-18  8:54   ` Kuninori Morimoto
2014-06-18 10:06   ` Mark Brown
2014-06-18 10:06     ` Mark Brown
2014-07-28 12:58     ` Simon Horman
2014-07-28 12:58       ` Simon Horman
2014-07-28 13:48       ` Mark Brown
2014-07-28 13:48         ` Mark Brown
2014-07-29  0:52         ` Simon Horman
2014-07-29  0:52           ` Simon Horman
2014-06-18  8:55 ` [PATCH 02/12] ASoC: rsnd: fixup loop exit timing of dma name search Kuninori Morimoto
2014-06-18  8:55   ` Kuninori Morimoto
2014-06-18 10:07   ` Mark Brown
2014-06-18 10:07     ` Mark Brown
2014-06-18  8:55 ` [PATCH 03/12] ASoC: rsnd: SSI + DMA can select BUSIF Kuninori Morimoto
2014-06-18  8:55   ` Kuninori Morimoto
2014-06-18  8:55 ` [PATCH 04/12] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer Kuninori Morimoto
2014-06-18  8:55   ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 05/12] ASoC: fsi: add fsi_pointer_update() for common pointer method Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 06/12] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 07/12] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 08/12] ASoC: rsnd: enable DVC when capture Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 09/12] ASoC: rsnd: enable SRC setting via DT Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18 14:20   ` Sergei Shtylyov
2014-06-18 14:20     ` Sergei Shtylyov
2014-06-19  0:54     ` Kuninori Morimoto
2014-06-19  0:54       ` Kuninori Morimoto
2014-06-18  8:56 ` [PATCH 10/12] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection Kuninori Morimoto
2014-06-18  8:56   ` Kuninori Morimoto
2014-06-18  8:57 ` [PATCH 11/12] ASoC: rsnd: DMA start address is properly used for each DMAC Kuninori Morimoto
2014-06-18  8:57   ` Kuninori Morimoto
2014-06-18 14:22   ` Sergei Shtylyov
2014-06-18 14:22     ` Sergei Shtylyov
2014-06-18  8:57 ` [PATCH 12/12] ASoC: rsnd: add DT support to DVC Kuninori Morimoto
2014-06-18  8:57   ` Kuninori Morimoto
2014-06-23  0:54 ` [PATCH 0/10 v2] ASoC: rsnd: fixup and DT support patches Kuninori Morimoto
2014-06-23  0:54   ` Kuninori Morimoto
2014-06-23  0:55   ` [PATCH 01/10 v2] ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer Kuninori Morimoto
2014-06-23  0:55     ` Kuninori Morimoto
2014-06-23  0:55   ` [PATCH 02/10 v2] ASoC: fsi: add fsi_pointer_update() for common pointer method Kuninori Morimoto
2014-06-23  0:55     ` Kuninori Morimoto
2014-06-23  0:55   ` [PATCH 03/10] ASoC: fsi: use dmaengine_prep_dma_cyclic() for DMA transfer Kuninori Morimoto
2014-06-23  0:55     ` Kuninori Morimoto
2014-06-23  0:56   ` [PATCH 04/10 v2] ASoC: rsnd: SSI + DMA can select BUSIF Kuninori Morimoto
2014-06-23  0:56     ` Kuninori Morimoto
2014-06-23  0:56   ` [PATCH 05/10 v2] ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method Kuninori Morimoto
2014-06-23  0:56     ` Kuninori Morimoto
2014-06-23  0:57   ` [PATCH 06/10 v2] ASoC: rsnd: enable DVC when capture Kuninori Morimoto
2014-06-23  0:57     ` Kuninori Morimoto
2014-06-28 13:41     ` Mark Brown
2014-06-28 13:41       ` Mark Brown
2014-06-23  0:57   ` [PATCH 07/10 v2] ASoC: rsnd: enable SRC setting via DT Kuninori Morimoto
2014-06-23  0:57     ` Kuninori Morimoto
2014-06-28 13:40     ` Mark Brown
2014-06-28 13:40       ` Mark Brown
2014-06-30  0:41       ` Kuninori Morimoto
2014-06-30  0:41         ` Kuninori Morimoto
2014-06-23  0:58   ` [PATCH 08/10 v2] ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection Kuninori Morimoto
2014-06-23  0:58     ` Kuninori Morimoto
2014-07-02 11:25     ` Mark Brown
2014-07-02 11:25       ` Mark Brown
2014-06-23  0:59   ` [PATCH 09/10 v2] ASoC: rsnd: DMA start address is properly used for each DMAC Kuninori Morimoto
2014-06-23  0:59     ` Kuninori Morimoto
2014-07-02 11:36     ` Mark Brown
2014-07-02 11:36       ` Mark Brown
2014-06-23  0:59   ` [PATCH 10/10 v2] ASoC: rsnd: add DT support to DVC Kuninori Morimoto
2014-06-23  0:59     ` Kuninori Morimoto
2014-07-02 11:36     ` Mark Brown
2014-07-02 11:36       ` 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.