All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/12] ASoC: rsnd: add Multi channel support
@ 2015-12-17  2:52 Kuninori Morimoto
  2015-12-17  2:55 ` [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing Kuninori Morimoto
                   ` (9 more replies)
  0 siblings, 10 replies; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


Hi Mark

These are Multi channel support for Renesas R-Car sound.
These patches are tested on Salvator-X board, but it can't use Multi channel,
because supported format is different between codec chip and R-Car.
Thus, it was tested on board which doesn't mount codec chip,
with oscilloscope.

Kuninori Morimoto (12):
       1) ASoC: rsnd: fixup SSIU control timing
       2) ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()
       3) ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()
       4) ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod
       5) ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM
       6) ASoC: rsnd: remove rsnd_get_slot_runtime()
       7) ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming
       8) ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()
       9) ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro
      10) ASoC: rsnd: add missing DT example for Simple Card
      11) ASoC: rsnd: add missing DT example for Simple Card with TDM
      12) ASoC: rsnd: add Multi channel support

 Documentation/devicetree/bindings/sound/renesas,rsnd.txt |  77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/sh/rcar/core.c                                 | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------
 sound/soc/sh/rcar/dma.c                                  |  10 ++++-----
 sound/soc/sh/rcar/dvc.c                                  |   3 +--
 sound/soc/sh/rcar/gen.c                                  |   3 +++
 sound/soc/sh/rcar/rsnd.h                                 |  45 +++++++++++++++++++++++++++++++++------
 sound/soc/sh/rcar/ssi.c                                  | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 sound/soc/sh/rcar/ssiu.c                                 |  57 +++++++++++++++++++++++++++++++++++++++++---------
 8 files changed, 351 insertions(+), 73 deletions(-)

Best regards
---
Kuninori Morimoto

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

* [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
@ 2015-12-17  2:55 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: fixup SSIU control timing" to the asoc tree Mark Brown
  2015-12-17  2:55 ` [PATCH 02/12] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit() Kuninori Morimoto
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


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

SSIU should be controlled after SSI. This patch fix up it

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

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index ad854d6..4b677e0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -181,9 +181,9 @@ enum rsnd_mod_type {
 	RSND_MOD_CTU,
 	RSND_MOD_CMD,
 	RSND_MOD_SRC,
-	RSND_MOD_SSIU,
 	RSND_MOD_SSIP, /* SSI parent */
 	RSND_MOD_SSI,
+	RSND_MOD_SSIU,
 	RSND_MOD_MAX,
 };
 
-- 
1.9.1

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

* [PATCH 02/12] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
  2015-12-17  2:55 ` [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing Kuninori Morimoto
@ 2015-12-17  2:55 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()" to the asoc tree Mark Brown
  2015-12-17  2:56 ` [PATCH 03/12] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach() Kuninori Morimoto
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


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

Renesas sound driver has rsnd_get_adinr_bit/chan() functions.
It is assuming _bit() returns ADINR :: OTBL,
and _chan() returns ADINR :: CHNUM.
Current _bit() returns both OTBL and CHNUM. This patch fixup it.

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 849c1ad..44f32c1 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -227,21 +227,17 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	u32 adinr = runtime->channels;
 
 	switch (runtime->sample_bits) {
 	case 16:
-		adinr |= (8 << 16);
-		break;
+		return 8 << 16;
 	case 32:
-		adinr |= (0 << 16);
-		break;
-	default:
-		dev_warn(dev, "not supported sample bits\n");
-		return 0;
+		return 0 << 16;
 	}
 
-	return adinr;
+	dev_warn(dev, "not supported sample bits\n");
+
+	return 0;
 }
 
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-- 
1.9.1

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

* [PATCH 03/12] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
  2015-12-17  2:55 ` [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing Kuninori Morimoto
  2015-12-17  2:55 ` [PATCH 02/12] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit() Kuninori Morimoto
@ 2015-12-17  2:56 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()" to the asoc tree Mark Brown
  2015-12-17  2:56 ` [PATCH 04/12] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod Kuninori Morimoto
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood

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

It can't output corrent dma name *before* rsnd_mod_init().
It goes to *after* rsnd_mod_init() by this patch

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

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 33eb373..418e6fd 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -680,16 +680,16 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
 
 	dma_mod = rsnd_mod_get(dma);
 
-	dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
-		rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod),
-		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
-		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
-
 	ret = rsnd_mod_init(priv, dma_mod,
 			    ops, NULL, type, dma_id);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
+	dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
+		rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod),
+		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
+		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
+
 	ret = attach(io, dma, id, mod_from, mod_to);
 	if (ret < 0)
 		return ERR_PTR(ret);
-- 
1.9.1

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

* [PATCH 04/12] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2015-12-17  2:56 ` [PATCH 03/12] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach() Kuninori Morimoto
@ 2015-12-17  2:56 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod" to the asoc tree Mark Brown
  2015-12-17  2:56 ` [PATCH 05/12] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM Kuninori Morimoto
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood

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

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 44f32c1..e59dc8a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -354,6 +354,9 @@ int rsnd_dai_connect(struct rsnd_mod *mod,
 	if (!mod)
 		return -EIO;
 
+	if (io->mod[type])
+		return -EINVAL;
+
 	priv = rsnd_mod_to_priv(mod);
 	dev = rsnd_priv_to_dev(priv);
 
-- 
1.9.1

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

* [PATCH 05/12] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2015-12-17  2:56 ` [PATCH 04/12] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod Kuninori Morimoto
@ 2015-12-17  2:56 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM" to the asoc tree Mark Brown
  2015-12-17  2:57 ` [PATCH 06/12] ASoC: rsnd: remove rsnd_get_slot_runtime() Kuninori Morimoto
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood

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

Current SSI/SSIU are using rsnd_get_slot_runtime() to check TDM,
but using rsnd_get_slot_extend() is more sane.
This patch fix it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/ssi.c  | 2 +-
 sound/soc/sh/rcar/ssiu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 79c3211..7481bc3 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -267,7 +267,7 @@ static int rsnd_ssi_config_init(struct rsnd_ssi *ssi,
 	u32 wsr;
 	int is_tdm;
 
-	is_tdm = (rsnd_get_slot_runtime(io) >= 6) ? 1 : 0;
+	is_tdm = (rsnd_get_slot_extend(io) >= 6) ? 1 : 0;
 
 	/*
 	 * always use 32bit system word.
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 3265501..c7f89be 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -78,7 +78,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	if (rsnd_get_slot_runtime(io) >= 6) {
+	if (rsnd_get_slot_extend(io) >= 6) {
 		/*
 		 * TDM Extend Mode
 		 * see
-- 
1.9.1

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

* [PATCH 06/12] ASoC: rsnd: remove rsnd_get_slot_runtime()
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2015-12-17  2:56 ` [PATCH 05/12] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM Kuninori Morimoto
@ 2015-12-17  2:57 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: remove rsnd_get_slot_runtime()" to the asoc tree Mark Brown
  2015-12-17  2:57 ` [PATCH 07/12] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming Kuninori Morimoto
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


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

Current Renesas sound driver is using rsnd_get_slot_runtime(), but
it is same as runtime->channels. This patch removes
rsnd_get_slot_runtime()

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index e59dc8a..7f3a7ed 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -196,21 +196,10 @@ int rsnd_get_slot_rdai(struct rsnd_dai *rdai)
 	return rdai->slots;
 }
 
-int rsnd_get_slot_runtime(struct rsnd_dai_stream *io)
-{
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = rsnd_get_slot_rdai(rdai);
-
-	if (runtime->channels < chan)
-		chan = runtime->channels;
-
-	return chan;
-}
-
 int rsnd_get_slot_extend(struct rsnd_dai_stream *io)
 {
-	int chan = rsnd_get_slot_runtime(io);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	int chan = runtime->channels;
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
@@ -243,9 +232,9 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 {
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	u32 chan = rsnd_get_slot_rdai(rdai);
+	u32 chan = runtime->channels;
 
 	switch (chan) {
 	case 1:
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 4b677e0..e9909a4 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -294,7 +294,6 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
 int rsnd_get_slot_rdai(struct rsnd_dai *rdai);
-int rsnd_get_slot_runtime(struct rsnd_dai_stream *io);
 int rsnd_get_slot_extend(struct rsnd_dai_stream *io);
 
 /*
-- 
1.9.1

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

* [PATCH 07/12] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2015-12-17  2:57 ` [PATCH 06/12] ASoC: rsnd: remove rsnd_get_slot_runtime() Kuninori Morimoto
@ 2015-12-17  2:57 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming" to the asoc tree Mark Brown
  2015-12-17  2:57 ` [PATCH 08/12] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num() Kuninori Morimoto
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


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

rsnd_get_slot_rdai() returns total slots (it returns 6 if total 6
channels) , and rsnd_get_slot_extend() returns extended SSI width
(it returns 8 if total 6 channels). This will be used on SSI multi
channel support too (It will return 2 if total 6 channels with 3 SSI).
But, it is using confusable naming.
This patch changes rsnd_get_slot_rdai() -> rsnd_get_slot(),
rsnd_get_slot_extend() -> rsnd_get_slot_width()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/core.c | 6 ++++--
 sound/soc/sh/rcar/dvc.c  | 3 +--
 sound/soc/sh/rcar/rsnd.h | 4 ++--
 sound/soc/sh/rcar/ssi.c  | 4 ++--
 sound/soc/sh/rcar/ssiu.c | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7f3a7ed..76af416 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -191,12 +191,14 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 	return !!io->substream;
 }
 
-int rsnd_get_slot_rdai(struct rsnd_dai *rdai)
+int rsnd_get_slot(struct rsnd_dai_stream *io)
 {
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+
 	return rdai->slots;
 }
 
-int rsnd_get_slot_extend(struct rsnd_dai_stream *io)
+int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	int chan = runtime->channels;
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 42e6a23..d45ffe4 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -242,10 +242,9 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct rsnd_dai_stream *io,
 			    struct snd_soc_pcm_runtime *rtd)
 {
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
 	struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
 	int is_play = rsnd_io_is_play(io);
-	int slots = rsnd_get_slot_rdai(rdai);
+	int slots = rsnd_get_slot(io);
 	int ret;
 
 	/* Volume */
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index e9909a4..804f2f5 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -293,8 +293,8 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
-int rsnd_get_slot_rdai(struct rsnd_dai *rdai);
-int rsnd_get_slot_extend(struct rsnd_dai_stream *io);
+int rsnd_get_slot(struct rsnd_dai_stream *io);
+int rsnd_get_slot_width(struct rsnd_dai_stream *io);
 
 /*
  *	R-Car sound DAI
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 7481bc3..0b91692 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -180,7 +180,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
 	struct rsnd_mod *mod = rsnd_mod_get(ssi);
 	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
-	int slots = rsnd_get_slot_extend(io);
+	int slots = rsnd_get_slot_width(io);
 	int j, ret;
 	int ssi_clk_mul_table[] = {
 		1, 2, 4, 8, 16, 6, 12,
@@ -267,7 +267,7 @@ static int rsnd_ssi_config_init(struct rsnd_ssi *ssi,
 	u32 wsr;
 	int is_tdm;
 
-	is_tdm = (rsnd_get_slot_extend(io) >= 6) ? 1 : 0;
+	is_tdm = (rsnd_get_slot_width(io) >= 6) ? 1 : 0;
 
 	/*
 	 * always use 32bit system word.
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index c7f89be..7ae05a7 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -78,7 +78,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	if (rsnd_get_slot_extend(io) >= 6) {
+	if (rsnd_get_slot_width(io) >= 6) {
 		/*
 		 * TDM Extend Mode
 		 * see
-- 
1.9.1

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

* [PATCH 08/12] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2015-12-17  2:57 ` [PATCH 07/12] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming Kuninori Morimoto
@ 2015-12-17  2:57 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()" to the asoc tree Mark Brown
  2015-12-17  2:58 ` [PATCH 09/12] ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro Kuninori Morimoto
       [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood


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

TDM will use 6 or 8 slots on 1 SSI, and Multi channel will use
6 or 8 slots on few SSI (each SSI uses 2 slots).
Thus, this adds new slot control functions which can be prepare
for Multi channel support.

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 76af416..528041e 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -191,6 +191,13 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 	return !!io->substream;
 }
 
+void rsnd_set_slot(struct rsnd_dai *rdai,
+		   int slots, int num)
+{
+	rdai->slots	= slots;
+	rdai->slots_num	= num;
+}
+
 int rsnd_get_slot(struct rsnd_dai_stream *io)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
@@ -198,10 +205,17 @@ int rsnd_get_slot(struct rsnd_dai_stream *io)
 	return rdai->slots;
 }
 
+int rsnd_get_slot_num(struct rsnd_dai_stream *io)
+{
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+
+	return rdai->slots_num;
+}
+
 int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = runtime->channels;
+	int chan = runtime->channels / rsnd_get_slot_num(io);
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
@@ -579,7 +593,7 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	switch (slots) {
 	case 6:
 		/* TDM Extend Mode */
-		rdai->slots = slots;
+		rsnd_set_slot(rdai, slots, 1);
 		break;
 	default:
 		dev_err(dev, "unsupported TDM slots (%d)\n", slots);
@@ -660,7 +674,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 
 		rdai->playback.rdai		= rdai;
 		rdai->capture.rdai		= rdai;
-		rdai->slots			= 2; /* default */
+		rsnd_set_slot(rdai, 2, 1); /* default */
 
 #define mod_parse(name)							\
 node = rsnd_##name##_of_node(priv);					\
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 804f2f5..c9aef23 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -293,8 +293,11 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
+void rsnd_set_slot(struct rsnd_dai *rdai,
+		   int slots, int slots_total);
 int rsnd_get_slot(struct rsnd_dai_stream *io);
 int rsnd_get_slot_width(struct rsnd_dai_stream *io);
+int rsnd_get_slot_num(struct rsnd_dai_stream *io);
 
 /*
  *	R-Car sound DAI
@@ -334,6 +337,7 @@ struct rsnd_dai {
 	struct rsnd_priv *priv;
 
 	int slots;
+	int slots_num;
 
 	unsigned int clk_master:1;
 	unsigned int bit_clk_inv:1;
-- 
1.9.1

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

* [PATCH 09/12] ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro
  2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2015-12-17  2:57 ` [PATCH 08/12] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num() Kuninori Morimoto
@ 2015-12-17  2:58 ` Kuninori Morimoto
  2015-12-18 12:15   ` Applied "ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro" to the asoc tree Mark Brown
       [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  9 siblings, 1 reply; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood

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

Current rsnd driver is using complex macro to parse DAI connection.
This patch adds new rsnd_parse_connect_common() and replace current
macro to it.
This is prepare for multi channel support

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 528041e..7781cef 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -609,17 +609,44 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	.set_tdm_slot	= rsnd_soc_set_dai_tdm_slot,
 };
 
+void rsnd_parse_connect_common(struct rsnd_dai *rdai,
+		struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
+		struct device_node *node,
+		struct device_node *playback,
+		struct device_node *capture)
+{
+	struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
+	struct device_node *np;
+	struct rsnd_mod *mod;
+	int i;
+
+	if (!node)
+		return;
+
+	i = 0;
+	for_each_child_of_node(node, np) {
+		mod = mod_get(priv, i);
+		if (np == playback)
+			rsnd_dai_connect(mod, &rdai->playback, mod->type);
+		if (np == capture)
+			rsnd_dai_connect(mod, &rdai->capture, mod->type);
+		i++;
+	}
+
+	of_node_put(node);
+}
+
 static int rsnd_dai_probe(struct rsnd_priv *priv)
 {
 	struct device_node *dai_node;
-	struct device_node *dai_np, *np, *node;
+	struct device_node *dai_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_stream *io_playback;
 	struct rsnd_dai_stream *io_capture;
 	struct snd_soc_dai_driver *rdrv, *drv;
 	struct rsnd_dai *rdai;
 	struct device *dev = rsnd_priv_to_dev(priv);
-	int nr, dai_i, io_i, np_i;
+	int nr, dai_i, io_i;
 	int ret;
 
 	dai_node = rsnd_dai_of_node(priv);
@@ -676,22 +703,6 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 		rdai->capture.rdai		= rdai;
 		rsnd_set_slot(rdai, 2, 1); /* default */
 
-#define mod_parse(name)							\
-node = rsnd_##name##_of_node(priv);					\
-if (node) {								\
-	struct rsnd_mod *mod;						\
-	np_i = 0;							\
-	for_each_child_of_node(node, np) {				\
-		mod = rsnd_##name##_mod_get(priv, np_i);		\
-		if (np == playback)					\
-			rsnd_dai_connect(mod, io_playback, mod->type);	\
-		if (np == capture)					\
-			rsnd_dai_connect(mod, io_capture, mod->type);	\
-		np_i++;							\
-	}								\
-	of_node_put(node);						\
-}
-
 		for (io_i = 0;; io_i++) {
 			playback = of_parse_phandle(dai_np, "playback", io_i);
 			capture  = of_parse_phandle(dai_np, "capture", io_i);
@@ -699,11 +710,11 @@ if (node) {								\
 			if (!playback && !capture)
 				break;
 
-			mod_parse(ssi);
-			mod_parse(src);
-			mod_parse(ctu);
-			mod_parse(mix);
-			mod_parse(dvc);
+			rsnd_parse_connect_ssi(rdai, playback, capture);
+			rsnd_parse_connect_src(rdai, playback, capture);
+			rsnd_parse_connect_ctu(rdai, playback, capture);
+			rsnd_parse_connect_mix(rdai, playback, capture);
+			rsnd_parse_connect_dvc(rdai, playback, capture);
 
 			of_node_put(playback);
 			of_node_put(capture);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c9aef23..f803e14 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -292,6 +292,11 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
 void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
+void rsnd_parse_connect_common(struct rsnd_dai *rdai,
+		struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
+		struct device_node *node,
+		struct device_node *playback,
+		struct device_node *capture);
 
 void rsnd_set_slot(struct rsnd_dai *rdai,
 		   int slots, int slots_total);
@@ -544,6 +549,10 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
 
 #define rsnd_ssi_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
+#define rsnd_parse_connect_ssi(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_ssi_mod_get,		\
+				  rsnd_ssi_of_node(rsnd_rdai_to_priv(rdai)), \
+				  playback, capture)
 
 /*
  *	R-Car SSIU
@@ -564,6 +573,10 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct snd_pcm_runtime *runtime);
 #define rsnd_src_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src")
+#define rsnd_parse_connect_src(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_src_mod_get,		\
+				  rsnd_src_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car CTU
@@ -573,6 +586,10 @@ void rsnd_ctu_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_ctu_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ctu")
+#define rsnd_parse_connect_ctu(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_ctu_mod_get,		\
+				  rsnd_ctu_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car MIX
@@ -582,6 +599,10 @@ void rsnd_mix_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_mix_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,mix")
+#define rsnd_parse_connect_mix(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_mix_mod_get,		\
+				  rsnd_mix_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car DVC
@@ -591,6 +612,10 @@ void rsnd_dvc_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_dvc_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,dvc")
+#define rsnd_parse_connect_dvc(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_dvc_mod_get,		\
+				  rsnd_dvc_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car CMD
-- 
1.9.1

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

* [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card
       [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-17  2:59   ` Kuninori Morimoto
  2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card" to the asoc tree Mark Brown
                       ` (2 more replies)
  2015-12-17  2:59   ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Kuninori Morimoto
  2015-12-17  3:00   ` [PATCH 12/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
  2 siblings, 3 replies; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Simon, Linux-DT, Linux-ALSA, Liam Girdwood


From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 59cebfb..bb9f33405 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -249,3 +249,43 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 };
+
+Example: simple sound card
+
+	rsnd_ak4643: sound {
+		compatible = "simple-audio-card";
+
+		simple-audio-card,format = "left_j";
+		simple-audio-card,bitclock-master = <&sndcodec>;
+		simple-audio-card,frame-master = <&sndcodec>;
+
+		sndcpu: simple-audio-card,cpu {
+			sound-dai = <&rcar_sound>;
+		};
+
+		sndcodec: simple-audio-card,codec {
+			sound-dai = <&ak4643>;
+			clocks = <&audio_clock>;
+		};
+	};
+
+&rcar_sound {
+	pinctrl-0 = <&sound_pins &sound_clk_pins>;
+	pinctrl-names = "default";
+
+	/* Single DAI */
+	#sound-dai-cells = <0>;
+
+	status = "okay";
+
+	rcar_sound,dai {
+		dai0 {
+			playback = <&ssi0 &src2 &dvc0>;
+			capture  = <&ssi1 &src3 &dvc1>;
+		};
+	};
+};
+
+&ssi1 {
+	shared-pin;
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM
       [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2015-12-17  2:59   ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Kuninori Morimoto
@ 2015-12-17  2:59   ` Kuninori Morimoto
  2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card with TDM" to the asoc tree Mark Brown
                       ` (2 more replies)
  2015-12-17  3:00   ` [PATCH 12/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
  2 siblings, 3 replies; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  2:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Simon, Linux-DT, Linux-ALSA, Liam Girdwood

From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt        | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index bb9f33405..162e94c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -289,3 +289,22 @@ Example: simple sound card
 &ssi1 {
 	shared-pin;
 };
+
+Example: simple sound card for TDM
+
+	rsnd_tdm: sound {
+		compatible = "simple-audio-card";
+
+		simple-audio-card,format = "left_j";
+		simple-audio-card,bitclock-master = <&sndcodec>;
+		simple-audio-card,frame-master = <&sndcodec>;
+
+		sndcpu: simple-audio-card,cpu {
+			sound-dai = <&rcar_sound>;
+			dai-tdm-slot-num = <6>;
+		};
+
+		sndcodec: simple-audio-card,codec {
+			sound-dai = <&xxx>;
+		};
+	};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 12/12] ASoC: rsnd: add Multi channel support
       [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2015-12-17  2:59   ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Kuninori Morimoto
  2015-12-17  2:59   ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Kuninori Morimoto
@ 2015-12-17  3:00   ` Kuninori Morimoto
  2015-12-18 20:04     ` Rob Herring
                       ` (2 more replies)
  2 siblings, 3 replies; 33+ messages in thread
From: Kuninori Morimoto @ 2015-12-17  3:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Simon, Linux-DT, Linux-ALSA, Liam Girdwood


From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>

This patch adds Multi channel support on Renesas R-Car sound.
This patch is tested on Salvator-X board, but it can't use
Multi channel, because supported format is different between
codec chip and R-Car.
Thus, it was tested on board which doesn't mount codec chip,
with oscilloscope.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++
 sound/soc/sh/rcar/core.c                           |   6 +-
 sound/soc/sh/rcar/gen.c                            |   3 +
 sound/soc/sh/rcar/rsnd.h                           |  15 ++-
 sound/soc/sh/rcar/ssi.c                            | 114 ++++++++++++++++++++-
 sound/soc/sh/rcar/ssiu.c                           |  55 ++++++++--
 6 files changed, 194 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 162e94c..8ee0fa9 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -308,3 +308,21 @@ Example: simple sound card for TDM
 			sound-dai = <&xxx>;
 		};
 	};
+
+Example: simple sound card for Multi channel
+
+&rcar_sound {
+	pinctrl-0 = <&sound_pins &sound_clk_pins>;
+	pinctrl-names = "default";
+
+	/* Single DAI */
+	#sound-dai-cells = <0>;
+
+	status = "okay";
+
+	rcar_sound,dai {
+		dai0 {
+			playback = <&ssi0 &ssi1 &ssi2 &src0 &dvc0>;
+		};
+	};
+};
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7781cef..ca05a0a 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -215,7 +215,11 @@ int rsnd_get_slot_num(struct rsnd_dai_stream *io)
 int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = runtime->channels / rsnd_get_slot_num(io);
+	int chan = runtime->channels;
+
+	/* Multi channel Mode */
+	if (rsnd_ssi_multi_slaves(io))
+		chan /= rsnd_get_slot_num(io);
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 7c5485e..c7aee9e 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -226,6 +226,9 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
 	const static struct rsnd_regmap_field_conf conf_ssiu[] = {
 		RSND_GEN_S_REG(SSI_MODE0,	0x800),
 		RSND_GEN_S_REG(SSI_MODE1,	0x804),
+		RSND_GEN_S_REG(SSI_MODE2,	0x808),
+		RSND_GEN_S_REG(SSI_CONTROL,	0x810),
+
 		/* FIXME: it needs SSI_MODE2/3 in the future */
 		RSND_GEN_M_REG(SSI_BUSIF_MODE,	0x0,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f803e14..317dd79 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -47,6 +47,8 @@ enum rsnd_reg {
 	RSND_REG_SSI_MODE,		/* Gen2 only */
 	RSND_REG_SSI_MODE0,
 	RSND_REG_SSI_MODE1,
+	RSND_REG_SSI_MODE2,
+	RSND_REG_SSI_CONTROL,
 	RSND_REG_SSI_CTRL,		/* Gen2 only */
 	RSND_REG_SSI_BUSIF_MODE,	/* Gen2 only */
 	RSND_REG_SSI_BUSIF_ADINR,	/* Gen2 only */
@@ -181,7 +183,10 @@ enum rsnd_mod_type {
 	RSND_MOD_CTU,
 	RSND_MOD_CMD,
 	RSND_MOD_SRC,
-	RSND_MOD_SSIP, /* SSI parent */
+	RSND_MOD_SSIM3,		/* SSI multi 3 */
+	RSND_MOD_SSIM2,		/* SSI multi 2 */
+	RSND_MOD_SSIM1,		/* SSI multi 1 */
+	RSND_MOD_SSIP,		/* SSI parent */
 	RSND_MOD_SSI,
 	RSND_MOD_SSIU,
 	RSND_MOD_MAX,
@@ -542,6 +547,7 @@ void rsnd_ssi_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
+u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io);
 
 #define rsnd_ssi_is_pin_sharing(io)	\
 	__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
@@ -549,10 +555,9 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
 
 #define rsnd_ssi_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
-#define rsnd_parse_connect_ssi(rdai, playback, capture)			\
-	rsnd_parse_connect_common(rdai, rsnd_ssi_mod_get,		\
-				  rsnd_ssi_of_node(rsnd_rdai_to_priv(rdai)), \
-				  playback, capture)
+void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
+			    struct device_node *playback,
+			    struct device_node *capture);
 
 /*
  *	R-Car SSIU
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 0b91692..7db05fd 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -96,6 +96,7 @@ struct rsnd_ssi {
 #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
 #define rsnd_ssi_mode_flags(p) ((p)->flags)
 #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
+#define rsnd_ssi_is_multi_slave(ssi, io) ((mod) != rsnd_io_to_mod_ssi(io))
 
 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
 {
@@ -171,6 +172,41 @@ static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod)
 	return 0;
 }
 
+u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *mod;
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct rsnd_priv *priv = rsnd_io_to_priv(io);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	enum rsnd_mod_type types[] = {
+		RSND_MOD_SSIM1,
+		RSND_MOD_SSIM2,
+		RSND_MOD_SSIM3,
+	};
+	int i, mask;
+
+	switch (runtime->channels) {
+	case 2: /* Multi channel is not needed for Stereo */
+		return 0;
+	case 6:
+		break;
+	default:
+		dev_err(dev, "unsupported channel\n");
+		return 0;
+	}
+
+	mask = 0;
+	for (i = 0; i < ARRAY_SIZE(types); i++) {
+		mod = rsnd_io_to_mod(io, types[i]);
+		if (!mod)
+			continue;
+
+		mask |= 1 << rsnd_mod_id(mod);
+	}
+
+	return mask;
+}
+
 static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 				     struct rsnd_dai_stream *io)
 {
@@ -194,6 +230,9 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 	if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io))
 		return 0;
 
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	if (ssi->usrcnt > 1) {
 		if (ssi->rate != rate) {
 			dev_err(dev, "SSI parent/child should use same rate\n");
@@ -437,8 +476,14 @@ static int __rsnd_ssi_start(struct rsnd_mod *mod,
 
 	cr  =	ssi->cr_own	|
 		ssi->cr_clk	|
-		ssi->cr_mode	|
-		EN;
+		ssi->cr_mode;
+
+	/*
+	 * EN will be set via SSIU :: SSI_CONTROL
+	 * if Multi channel mode
+	 */
+	if (!rsnd_ssi_multi_slaves(io))
+		cr |= EN;
 
 	rsnd_mod_write(mod, SSICR, cr);
 	rsnd_mod_write(mod, SSIWSR, ssi->wsr);
@@ -609,6 +654,13 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
 	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
 	int ret;
 
+	/*
+	 * SSIP/SSIU/IRQ are not needed on
+	 * SSI Multi slaves
+	 */
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	rsnd_ssi_parent_attach(mod, io, priv);
 
 	ret = rsnd_ssiu_attach(io, mod);
@@ -641,6 +693,13 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 	int dma_id = 0; /* not needed */
 	int ret;
 
+	/*
+	 * SSIP/SSIU/IRQ/DMA are not needed on
+	 * SSI Multi slaves
+	 */
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	ret = rsnd_ssi_common_probe(mod, io, priv);
 	if (ret)
 		return ret;
@@ -732,6 +791,57 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = {
 /*
  *		ssi mod function
  */
+static void rsnd_ssi_connect(struct rsnd_mod *mod,
+			     struct rsnd_dai_stream *io)
+{
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+	enum rsnd_mod_type types[] = {
+		RSND_MOD_SSI,
+		RSND_MOD_SSIM1,
+		RSND_MOD_SSIM2,
+		RSND_MOD_SSIM3,
+	};
+	enum rsnd_mod_type type;
+	int i;
+
+	/* try SSI -> SSIM1 -> SSIM2 -> SSIM3 */
+	for (i = 0; i < ARRAY_SIZE(types); i++) {
+		type = types[i];
+		if (!rsnd_io_to_mod(io, type)) {
+			rsnd_dai_connect(mod, io, type);
+			rsnd_set_slot(rdai, 2 * (i + 1), (i + 1));
+			return;
+		}
+	}
+}
+
+void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
+			    struct device_node *playback,
+			    struct device_node *capture)
+{
+	struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
+	struct device_node *node;
+	struct device_node *np;
+	struct rsnd_mod *mod;
+	int i;
+
+	node = rsnd_ssi_of_node(priv);
+	if (!node)
+		return;
+
+	i = 0;
+	for_each_child_of_node(node, np) {
+		mod = rsnd_ssi_mod_get(priv, i);
+		if (np == playback)
+			rsnd_ssi_connect(mod, &rdai->playback);
+		if (np == capture)
+			rsnd_ssi_connect(mod, &rdai->capture);
+		i++;
+	}
+
+	of_node_put(node);
+}
+
 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)
 {
 	if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv)))
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 7ae05a7..3fe9e08 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -27,8 +27,11 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 			  struct rsnd_priv *priv)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+	u32 multi_ssi_slaves = rsnd_ssi_multi_slaves(io);
 	int use_busif = rsnd_ssi_use_busif(io);
 	int id = rsnd_mod_id(mod);
+	u32 mask1, val1;
+	u32 mask2, val2;
 
 	/*
 	 * SSI_MODE0
@@ -38,6 +41,9 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 	/*
 	 * SSI_MODE1
 	 */
+	mask1 = (1 << 4) | (1 << 20);	/* mask sync bit */
+	mask2 = (1 << 4);		/* mask sync bit */
+	val1  = val2  = 0;
 	if (rsnd_ssi_is_pin_sharing(io)) {
 		int shift = -1;
 
@@ -51,15 +57,36 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 		case 4:
 			shift = 16;
 			break;
+		default:
+			return -EINVAL;
 		}
 
-		if (shift >= 0)
-			rsnd_mod_bset(mod, SSI_MODE1,
-				      0x3 << shift,
-				      rsnd_rdai_is_clk_master(rdai) ?
-				      0x2 << shift : 0x1 << shift);
+		mask1 |= 0x3 << shift;
+		val1 = rsnd_rdai_is_clk_master(rdai) ?
+			0x2 << shift : 0x1 << shift;
+
+	} else if (multi_ssi_slaves) {
+
+		mask2 |= 0x00000007;
+		mask1 |= 0x0000000f;
+
+		switch (multi_ssi_slaves) {
+		case 0x0206: /* SSI0/1/2/9 */
+			val2 = (1 << 4) | /* SSI0129 sync */
+				rsnd_rdai_is_clk_master(rdai) ? 0x2 : 0x1;
+			/* fall through */
+		case 0x0006: /* SSI0/1/2 */
+			val1 = rsnd_rdai_is_clk_master(rdai) ?
+				0xa : 0x5;
+
+			if (!val2)  /* SSI012 sync */
+				val1 |= (1 << 4);
+		}
 	}
 
+	rsnd_mod_bset(mod, SSI_MODE1, mask1, val1);
+	rsnd_mod_bset(mod, SSI_MODE2, mask2, val2);
+
 	return 0;
 }
 
@@ -104,8 +131,13 @@ static int rsnd_ssiu_start_gen2(struct rsnd_mod *mod,
 				struct rsnd_dai_stream *io,
 				struct rsnd_priv *priv)
 {
-	if (rsnd_ssi_use_busif(io))
-		rsnd_mod_write(mod, SSI_CTRL, 0x1);
+	if (!rsnd_ssi_use_busif(io))
+		return 0;
+
+	rsnd_mod_write(mod, SSI_CTRL, 0x1);
+
+	if (rsnd_ssi_multi_slaves(io))
+		rsnd_mod_write(mod, SSI_CONTROL, 0x1);
 
 	return 0;
 }
@@ -114,8 +146,13 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,
 			       struct rsnd_dai_stream *io,
 			       struct rsnd_priv *priv)
 {
-	if (rsnd_ssi_use_busif(io))
-		rsnd_mod_write(mod, SSI_CTRL, 0);
+	if (!rsnd_ssi_use_busif(io))
+		return 0;
+
+	rsnd_mod_write(mod, SSI_CTRL, 0);
+
+	if (rsnd_ssi_multi_slaves(io))
+		rsnd_mod_write(mod, SSI_CONTROL, 0);
 
 	return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "ASoC: rsnd: add missing DT example for Simple Card with TDM" to the asoc tree
  2015-12-17  2:59   ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Kuninori Morimoto
@ 2015-12-18 12:15     ` Mark Brown
  2015-12-18 20:15     ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Rob Herring
       [not found]     ` <87y4cthjf9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add missing DT example for Simple Card with TDM

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 44bf5361e21d507e23f8cf8d696c0600f3795e54 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:59:31 +0000
Subject: [PATCH] ASoC: rsnd: add missing DT example for Simple Card with TDM

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt        | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index bb9f33405d29..162e94c8305c 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -289,3 +289,22 @@ Example: simple sound card
 &ssi1 {
 	shared-pin;
 };
+
+Example: simple sound card for TDM
+
+	rsnd_tdm: sound {
+		compatible = "simple-audio-card";
+
+		simple-audio-card,format = "left_j";
+		simple-audio-card,bitclock-master = <&sndcodec>;
+		simple-audio-card,frame-master = <&sndcodec>;
+
+		sndcpu: simple-audio-card,cpu {
+			sound-dai = <&rcar_sound>;
+			dai-tdm-slot-num = <6>;
+		};
+
+		sndcodec: simple-audio-card,codec {
+			sound-dai = <&xxx>;
+		};
+	};
-- 
2.6.2

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

* Applied "ASoC: rsnd: add missing DT example for Simple Card" to the asoc tree
  2015-12-17  2:59   ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Kuninori Morimoto
@ 2015-12-18 12:15     ` Mark Brown
  2015-12-18 20:16     ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Rob Herring
       [not found]     ` <87zix9hjfx.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add missing DT example for Simple Card

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From f3f17d32fe0f3be9b1514c7e6245edee3673dccc Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:59:09 +0000
Subject: [PATCH] ASoC: rsnd: add missing DT example for Simple Card

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 59cebfbd7b6a..bb9f33405d29 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -249,3 +249,43 @@ rcar_sound: sound@ec500000 {
 		};
 	};
 };
+
+Example: simple sound card
+
+	rsnd_ak4643: sound {
+		compatible = "simple-audio-card";
+
+		simple-audio-card,format = "left_j";
+		simple-audio-card,bitclock-master = <&sndcodec>;
+		simple-audio-card,frame-master = <&sndcodec>;
+
+		sndcpu: simple-audio-card,cpu {
+			sound-dai = <&rcar_sound>;
+		};
+
+		sndcodec: simple-audio-card,codec {
+			sound-dai = <&ak4643>;
+			clocks = <&audio_clock>;
+		};
+	};
+
+&rcar_sound {
+	pinctrl-0 = <&sound_pins &sound_clk_pins>;
+	pinctrl-names = "default";
+
+	/* Single DAI */
+	#sound-dai-cells = <0>;
+
+	status = "okay";
+
+	rcar_sound,dai {
+		dai0 {
+			playback = <&ssi0 &src2 &dvc0>;
+			capture  = <&ssi1 &src3 &dvc1>;
+		};
+	};
+};
+
+&ssi1 {
+	shared-pin;
+};
-- 
2.6.2

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

* Applied "ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro" to the asoc tree
  2015-12-17  2:58 ` [PATCH 09/12] ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 89b66174eca6609020cc3d1ef32df7956fd16b34 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:58:14 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_parse_connect_common() and remove
 complex macro

Current rsnd driver is using complex macro to parse DAI connection.
This patch adds new rsnd_parse_connect_common() and replace current
macro to it.
This is prepare for multi channel support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 57 +++++++++++++++++++++++++++++-------------------
 sound/soc/sh/rcar/rsnd.h | 25 +++++++++++++++++++++
 2 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 528041eff704..7781cef634d4 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -609,17 +609,44 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
 	.set_tdm_slot	= rsnd_soc_set_dai_tdm_slot,
 };
 
+void rsnd_parse_connect_common(struct rsnd_dai *rdai,
+		struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
+		struct device_node *node,
+		struct device_node *playback,
+		struct device_node *capture)
+{
+	struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
+	struct device_node *np;
+	struct rsnd_mod *mod;
+	int i;
+
+	if (!node)
+		return;
+
+	i = 0;
+	for_each_child_of_node(node, np) {
+		mod = mod_get(priv, i);
+		if (np == playback)
+			rsnd_dai_connect(mod, &rdai->playback, mod->type);
+		if (np == capture)
+			rsnd_dai_connect(mod, &rdai->capture, mod->type);
+		i++;
+	}
+
+	of_node_put(node);
+}
+
 static int rsnd_dai_probe(struct rsnd_priv *priv)
 {
 	struct device_node *dai_node;
-	struct device_node *dai_np, *np, *node;
+	struct device_node *dai_np;
 	struct device_node *playback, *capture;
 	struct rsnd_dai_stream *io_playback;
 	struct rsnd_dai_stream *io_capture;
 	struct snd_soc_dai_driver *rdrv, *drv;
 	struct rsnd_dai *rdai;
 	struct device *dev = rsnd_priv_to_dev(priv);
-	int nr, dai_i, io_i, np_i;
+	int nr, dai_i, io_i;
 	int ret;
 
 	dai_node = rsnd_dai_of_node(priv);
@@ -676,22 +703,6 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 		rdai->capture.rdai		= rdai;
 		rsnd_set_slot(rdai, 2, 1); /* default */
 
-#define mod_parse(name)							\
-node = rsnd_##name##_of_node(priv);					\
-if (node) {								\
-	struct rsnd_mod *mod;						\
-	np_i = 0;							\
-	for_each_child_of_node(node, np) {				\
-		mod = rsnd_##name##_mod_get(priv, np_i);		\
-		if (np == playback)					\
-			rsnd_dai_connect(mod, io_playback, mod->type);	\
-		if (np == capture)					\
-			rsnd_dai_connect(mod, io_capture, mod->type);	\
-		np_i++;							\
-	}								\
-	of_node_put(node);						\
-}
-
 		for (io_i = 0;; io_i++) {
 			playback = of_parse_phandle(dai_np, "playback", io_i);
 			capture  = of_parse_phandle(dai_np, "capture", io_i);
@@ -699,11 +710,11 @@ if (node) {								\
 			if (!playback && !capture)
 				break;
 
-			mod_parse(ssi);
-			mod_parse(src);
-			mod_parse(ctu);
-			mod_parse(mix);
-			mod_parse(dvc);
+			rsnd_parse_connect_ssi(rdai, playback, capture);
+			rsnd_parse_connect_src(rdai, playback, capture);
+			rsnd_parse_connect_ctu(rdai, playback, capture);
+			rsnd_parse_connect_mix(rdai, playback, capture);
+			rsnd_parse_connect_dvc(rdai, playback, capture);
 
 			of_node_put(playback);
 			of_node_put(capture);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c9aef234d002..f803e140e733 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -292,6 +292,11 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
 void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
+void rsnd_parse_connect_common(struct rsnd_dai *rdai,
+		struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
+		struct device_node *node,
+		struct device_node *playback,
+		struct device_node *capture);
 
 void rsnd_set_slot(struct rsnd_dai *rdai,
 		   int slots, int slots_total);
@@ -544,6 +549,10 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
 
 #define rsnd_ssi_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
+#define rsnd_parse_connect_ssi(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_ssi_mod_get,		\
+				  rsnd_ssi_of_node(rsnd_rdai_to_priv(rdai)), \
+				  playback, capture)
 
 /*
  *	R-Car SSIU
@@ -564,6 +573,10 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
 				   struct snd_pcm_runtime *runtime);
 #define rsnd_src_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src")
+#define rsnd_parse_connect_src(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_src_mod_get,		\
+				  rsnd_src_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car CTU
@@ -573,6 +586,10 @@ void rsnd_ctu_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_ctu_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ctu")
+#define rsnd_parse_connect_ctu(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_ctu_mod_get,		\
+				  rsnd_ctu_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car MIX
@@ -582,6 +599,10 @@ void rsnd_mix_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_mix_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,mix")
+#define rsnd_parse_connect_mix(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_mix_mod_get,		\
+				  rsnd_mix_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car DVC
@@ -591,6 +612,10 @@ void rsnd_dvc_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
 #define rsnd_dvc_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,dvc")
+#define rsnd_parse_connect_dvc(rdai, playback, capture)			\
+	rsnd_parse_connect_common(rdai, rsnd_dvc_mod_get,		\
+				  rsnd_dvc_of_node(rsnd_rdai_to_priv(rdai)), \
+						   playback, capture)
 
 /*
  *	R-Car CMD
-- 
2.6.2

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

* Applied "ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()" to the asoc tree
  2015-12-17  2:57 ` [PATCH 08/12] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num() Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 750fd445ac53f1623cfcbf710d2bfc7aa1b7086d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:57:47 +0000
Subject: [PATCH] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()

TDM will use 6 or 8 slots on 1 SSI, and Multi channel will use
6 or 8 slots on few SSI (each SSI uses 2 slots).
Thus, this adds new slot control functions which can be prepare
for Multi channel support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 20 +++++++++++++++++---
 sound/soc/sh/rcar/rsnd.h |  4 ++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 76af41633f9f..528041eff704 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -191,6 +191,13 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 	return !!io->substream;
 }
 
+void rsnd_set_slot(struct rsnd_dai *rdai,
+		   int slots, int num)
+{
+	rdai->slots	= slots;
+	rdai->slots_num	= num;
+}
+
 int rsnd_get_slot(struct rsnd_dai_stream *io)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
@@ -198,10 +205,17 @@ int rsnd_get_slot(struct rsnd_dai_stream *io)
 	return rdai->slots;
 }
 
+int rsnd_get_slot_num(struct rsnd_dai_stream *io)
+{
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+
+	return rdai->slots_num;
+}
+
 int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = runtime->channels;
+	int chan = runtime->channels / rsnd_get_slot_num(io);
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
@@ -579,7 +593,7 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	switch (slots) {
 	case 6:
 		/* TDM Extend Mode */
-		rdai->slots = slots;
+		rsnd_set_slot(rdai, slots, 1);
 		break;
 	default:
 		dev_err(dev, "unsupported TDM slots (%d)\n", slots);
@@ -660,7 +674,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 
 		rdai->playback.rdai		= rdai;
 		rdai->capture.rdai		= rdai;
-		rdai->slots			= 2; /* default */
+		rsnd_set_slot(rdai, 2, 1); /* default */
 
 #define mod_parse(name)							\
 node = rsnd_##name##_of_node(priv);					\
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 804f2f5622e0..c9aef234d002 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -293,8 +293,11 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
+void rsnd_set_slot(struct rsnd_dai *rdai,
+		   int slots, int slots_total);
 int rsnd_get_slot(struct rsnd_dai_stream *io);
 int rsnd_get_slot_width(struct rsnd_dai_stream *io);
+int rsnd_get_slot_num(struct rsnd_dai_stream *io);
 
 /*
  *	R-Car sound DAI
@@ -334,6 +337,7 @@ struct rsnd_dai {
 	struct rsnd_priv *priv;
 
 	int slots;
+	int slots_num;
 
 	unsigned int clk_master:1;
 	unsigned int bit_clk_inv:1;
-- 
2.6.2

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

* Applied "ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming" to the asoc tree
  2015-12-17  2:57 ` [PATCH 07/12] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From c140284b8085e0fa07c24f4285db9dc107ad2ed3 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:57:27 +0000
Subject: [PATCH] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming

rsnd_get_slot_rdai() returns total slots (it returns 6 if total 6
channels) , and rsnd_get_slot_extend() returns extended SSI width
(it returns 8 if total 6 channels). This will be used on SSI multi
channel support too (It will return 2 if total 6 channels with 3 SSI).
But, it is using confusable naming.
This patch changes rsnd_get_slot_rdai() -> rsnd_get_slot(),
rsnd_get_slot_extend() -> rsnd_get_slot_width()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 6 ++++--
 sound/soc/sh/rcar/dvc.c  | 3 +--
 sound/soc/sh/rcar/rsnd.h | 4 ++--
 sound/soc/sh/rcar/ssi.c  | 4 ++--
 sound/soc/sh/rcar/ssiu.c | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7f3a7edba096..76af41633f9f 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -191,12 +191,14 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
 	return !!io->substream;
 }
 
-int rsnd_get_slot_rdai(struct rsnd_dai *rdai)
+int rsnd_get_slot(struct rsnd_dai_stream *io)
 {
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+
 	return rdai->slots;
 }
 
-int rsnd_get_slot_extend(struct rsnd_dai_stream *io)
+int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	int chan = runtime->channels;
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 42e6a230a3d1..d45ffe496397 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -242,10 +242,9 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
 			    struct rsnd_dai_stream *io,
 			    struct snd_soc_pcm_runtime *rtd)
 {
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
 	struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
 	int is_play = rsnd_io_is_play(io);
-	int slots = rsnd_get_slot_rdai(rdai);
+	int slots = rsnd_get_slot(io);
 	int ret;
 
 	/* Volume */
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index e9909a4ce754..804f2f5622e0 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -293,8 +293,8 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 			void (*callback)(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
-int rsnd_get_slot_rdai(struct rsnd_dai *rdai);
-int rsnd_get_slot_extend(struct rsnd_dai_stream *io);
+int rsnd_get_slot(struct rsnd_dai_stream *io);
+int rsnd_get_slot_width(struct rsnd_dai_stream *io);
 
 /*
  *	R-Car sound DAI
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 7481bc3e0dff..0b91692c5a66 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -180,7 +180,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
 	struct rsnd_mod *mod = rsnd_mod_get(ssi);
 	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
-	int slots = rsnd_get_slot_extend(io);
+	int slots = rsnd_get_slot_width(io);
 	int j, ret;
 	int ssi_clk_mul_table[] = {
 		1, 2, 4, 8, 16, 6, 12,
@@ -267,7 +267,7 @@ static int rsnd_ssi_config_init(struct rsnd_ssi *ssi,
 	u32 wsr;
 	int is_tdm;
 
-	is_tdm = (rsnd_get_slot_extend(io) >= 6) ? 1 : 0;
+	is_tdm = (rsnd_get_slot_width(io) >= 6) ? 1 : 0;
 
 	/*
 	 * always use 32bit system word.
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index c7f89beff44f..7ae05a7621ae 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -78,7 +78,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	if (rsnd_get_slot_extend(io) >= 6) {
+	if (rsnd_get_slot_width(io) >= 6) {
 		/*
 		 * TDM Extend Mode
 		 * see
-- 
2.6.2

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

* Applied "ASoC: rsnd: remove rsnd_get_slot_runtime()" to the asoc tree
  2015-12-17  2:57 ` [PATCH 06/12] ASoC: rsnd: remove rsnd_get_slot_runtime() Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: remove rsnd_get_slot_runtime()

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 5858a7d17e266945b9860768d0549aeb6a52d31f Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:57:07 +0000
Subject: [PATCH] ASoC: rsnd: remove rsnd_get_slot_runtime()

Current Renesas sound driver is using rsnd_get_slot_runtime(), but
it is same as runtime->channels. This patch removes
rsnd_get_slot_runtime()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/core.c | 19 ++++---------------
 sound/soc/sh/rcar/rsnd.h |  1 -
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index e59dc8a461bb..7f3a7edba096 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -196,21 +196,10 @@ int rsnd_get_slot_rdai(struct rsnd_dai *rdai)
 	return rdai->slots;
 }
 
-int rsnd_get_slot_runtime(struct rsnd_dai_stream *io)
-{
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = rsnd_get_slot_rdai(rdai);
-
-	if (runtime->channels < chan)
-		chan = runtime->channels;
-
-	return chan;
-}
-
 int rsnd_get_slot_extend(struct rsnd_dai_stream *io)
 {
-	int chan = rsnd_get_slot_runtime(io);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	int chan = runtime->channels;
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
@@ -243,9 +232,9 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 {
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-	u32 chan = rsnd_get_slot_rdai(rdai);
+	u32 chan = runtime->channels;
 
 	switch (chan) {
 	case 1:
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 4b677e074c7a..e9909a4ce754 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -294,7 +294,6 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
 					 struct rsnd_dai_stream *io));
 
 int rsnd_get_slot_rdai(struct rsnd_dai *rdai);
-int rsnd_get_slot_runtime(struct rsnd_dai_stream *io);
 int rsnd_get_slot_extend(struct rsnd_dai_stream *io);
 
 /*
-- 
2.6.2

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

* Applied "ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM" to the asoc tree
  2015-12-17  2:56 ` [PATCH 05/12] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 49ee73b441f5734c3da254c60e134f343b89911a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:56:50 +0000
Subject: [PATCH] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM

Current SSI/SSIU are using rsnd_get_slot_runtime() to check TDM,
but using rsnd_get_slot_extend() is more sane.
This patch fix it up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/ssi.c  | 2 +-
 sound/soc/sh/rcar/ssiu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 79c3211a1e7f..7481bc3e0dff 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -267,7 +267,7 @@ static int rsnd_ssi_config_init(struct rsnd_ssi *ssi,
 	u32 wsr;
 	int is_tdm;
 
-	is_tdm = (rsnd_get_slot_runtime(io) >= 6) ? 1 : 0;
+	is_tdm = (rsnd_get_slot_extend(io) >= 6) ? 1 : 0;
 
 	/*
 	 * always use 32bit system word.
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 326550114299..c7f89beff44f 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -78,7 +78,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 	if (ret < 0)
 		return ret;
 
-	if (rsnd_get_slot_runtime(io) >= 6) {
+	if (rsnd_get_slot_extend(io) >= 6) {
 		/*
 		 * TDM Extend Mode
 		 * see
-- 
2.6.2

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

* Applied "ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod" to the asoc tree
  2015-12-17  2:56 ` [PATCH 04/12] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 52dc68524327ed7bedfc2856bca4fa634f11141a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:56:31 +0000
Subject: [PATCH] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to
 existing mod

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 44f32c1db05d..e59dc8a461bb 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -354,6 +354,9 @@ int rsnd_dai_connect(struct rsnd_mod *mod,
 	if (!mod)
 		return -EIO;
 
+	if (io->mod[type])
+		return -EINVAL;
+
 	priv = rsnd_mod_to_priv(mod);
 	dev = rsnd_priv_to_dev(priv);
 
-- 
2.6.2

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

* Applied "ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()" to the asoc tree
  2015-12-17  2:56 ` [PATCH 03/12] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach() Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From c90269c1fbfcb3082d379237f0912ea231e90a24 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:56:11 +0000
Subject: [PATCH] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()

It can't output corrent dma name *before* rsnd_mod_init().
It goes to *after* rsnd_mod_init() by this patch

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dma.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 33eb37331498..418e6fdd06a3 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -680,16 +680,16 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
 
 	dma_mod = rsnd_mod_get(dma);
 
-	dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
-		rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod),
-		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
-		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
-
 	ret = rsnd_mod_init(priv, dma_mod,
 			    ops, NULL, type, dma_id);
 	if (ret < 0)
 		return ERR_PTR(ret);
 
+	dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n",
+		rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod),
+		rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
+		rsnd_mod_name(mod_to),   rsnd_mod_id(mod_to));
+
 	ret = attach(io, dma, id, mod_from, mod_to);
 	if (ret < 0)
 		return ERR_PTR(ret);
-- 
2.6.2

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

* Applied "ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()" to the asoc tree
  2015-12-17  2:55 ` [PATCH 02/12] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit() Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From 5e7b9edd928d22ffd4936fc61c80532ed6df5077 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:55:51 +0000
Subject: [PATCH] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()

Renesas sound driver has rsnd_get_adinr_bit/chan() functions.
It is assuming _bit() returns ADINR :: OTBL,
and _chan() returns ADINR :: CHNUM.
Current _bit() returns both OTBL and CHNUM. This patch fixup it.

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 849c1ad93df2..44f32c1db05d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -227,21 +227,17 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
 	struct device *dev = rsnd_priv_to_dev(priv);
-	u32 adinr = runtime->channels;
 
 	switch (runtime->sample_bits) {
 	case 16:
-		adinr |= (8 << 16);
-		break;
+		return 8 << 16;
 	case 32:
-		adinr |= (0 << 16);
-		break;
-	default:
-		dev_warn(dev, "not supported sample bits\n");
-		return 0;
+		return 0 << 16;
 	}
 
-	return adinr;
+	dev_warn(dev, "not supported sample bits\n");
+
+	return 0;
 }
 
 u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-- 
2.6.2

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

* Applied "ASoC: rsnd: fixup SSIU control timing" to the asoc tree
  2015-12-17  2:55 ` [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing Kuninori Morimoto
@ 2015-12-18 12:15   ` Mark Brown
  0 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-18 12:15 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: fixup SSIU control timing

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From cdf310ce119989353bb6848ca8327814ae1012e2 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 02:55:25 +0000
Subject: [PATCH] ASoC: rsnd: fixup SSIU control timing

SSIU should be controlled after SSI. This patch fix up it

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

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index ad854d6719ea..4b677e074c7a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -181,9 +181,9 @@ enum rsnd_mod_type {
 	RSND_MOD_CTU,
 	RSND_MOD_CMD,
 	RSND_MOD_SRC,
-	RSND_MOD_SSIU,
 	RSND_MOD_SSIP, /* SSI parent */
 	RSND_MOD_SSI,
+	RSND_MOD_SSIU,
 	RSND_MOD_MAX,
 };
 
-- 
2.6.2

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

* Re: [PATCH 12/12] ASoC: rsnd: add Multi channel support
  2015-12-17  3:00   ` [PATCH 12/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
@ 2015-12-18 20:04     ` Rob Herring
  2015-12-19 11:37       ` Mark Brown
       [not found]     ` <87wpsdhje9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2015-12-23  0:08     ` Applied "ASoC: rsnd: add Multi channel support" to the asoc tree Mark Brown
  2 siblings, 1 reply; 33+ messages in thread
From: Rob Herring @ 2015-12-18 20:04 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-DT, Linux-ALSA, Mark Brown, Liam Girdwood, Simon

On Thu, Dec 17, 2015 at 03:00:10AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch adds Multi channel support on Renesas R-Car sound.
> This patch is tested on Salvator-X board, but it can't use
> Multi channel, because supported format is different between
> codec chip and R-Car.
> Thus, it was tested on board which doesn't mount codec chip,
> with oscilloscope.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++

For the binding:

Acked-by: Rob Herring <robh@kernel.org>

>  sound/soc/sh/rcar/core.c                           |   6 +-
>  sound/soc/sh/rcar/gen.c                            |   3 +
>  sound/soc/sh/rcar/rsnd.h                           |  15 ++-
>  sound/soc/sh/rcar/ssi.c                            | 114 ++++++++++++++++++++-
>  sound/soc/sh/rcar/ssiu.c                           |  55 ++++++++--
>  6 files changed, 194 insertions(+), 17 deletions(-)

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

* Re: [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM
  2015-12-17  2:59   ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Kuninori Morimoto
  2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card with TDM" to the asoc tree Mark Brown
@ 2015-12-18 20:15     ` Rob Herring
       [not found]     ` <87y4cthjf9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-18 20:15 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-DT, Linux-ALSA, Mark Brown, Liam Girdwood, Simon

On Thu, Dec 17, 2015 at 02:59:31AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt        | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card
  2015-12-17  2:59   ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Kuninori Morimoto
  2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card" to the asoc tree Mark Brown
@ 2015-12-18 20:16     ` Rob Herring
       [not found]     ` <87zix9hjfx.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-18 20:16 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-DT, Linux-ALSA, Mark Brown, Liam Girdwood, Simon

On Thu, Dec 17, 2015 at 02:59:09AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt     | 40 ++++++++++++++++++++++
>  1 file changed, 40 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 12/12] ASoC: rsnd: add Multi channel support
       [not found]     ` <87wpsdhje9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-19  4:18       ` Rob Herring
  0 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-19  4:18 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown, Simon, Linux-DT, Linux-ALSA, Liam Girdwood

On Thu, Dec 17, 2015 at 03:00:10AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> 
> This patch adds Multi channel support on Renesas R-Car sound.
> This patch is tested on Salvator-X board, but it can't use
> Multi channel, because supported format is different between
> codec chip and R-Car.
> Thus, it was tested on board which doesn't mount codec chip,
> with oscilloscope.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++

For the binding:

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

>  sound/soc/sh/rcar/core.c                           |   6 +-
>  sound/soc/sh/rcar/gen.c                            |   3 +
>  sound/soc/sh/rcar/rsnd.h                           |  15 ++-
>  sound/soc/sh/rcar/ssi.c                            | 114 ++++++++++++++++++++-
>  sound/soc/sh/rcar/ssiu.c                           |  55 ++++++++--
>  6 files changed, 194 insertions(+), 17 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM
       [not found]     ` <87y4cthjf9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-19  4:18       ` Rob Herring
  0 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-19  4:18 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown, Simon, Linux-DT, Linux-ALSA, Liam Girdwood

On Thu, Dec 17, 2015 at 02:59:31AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt        | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card
       [not found]     ` <87zix9hjfx.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-19  4:18       ` Rob Herring
  0 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-19  4:18 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown, Simon, Linux-DT, Linux-ALSA, Liam Girdwood

On Thu, Dec 17, 2015 at 02:59:09AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> ---
>  .../devicetree/bindings/sound/renesas,rsnd.txt     | 40 ++++++++++++++++++++++
>  1 file changed, 40 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 12/12] ASoC: rsnd: add Multi channel support
  2015-12-18 20:04     ` Rob Herring
@ 2015-12-19 11:37       ` Mark Brown
       [not found]         ` <20151219113709.GG5727-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 33+ messages in thread
From: Mark Brown @ 2015-12-19 11:37 UTC (permalink / raw)
  To: Rob Herring; +Cc: Kuninori Morimoto, Simon, Linux-DT, Linux-ALSA, Liam Girdwood

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

On Fri, Dec 18, 2015 at 02:04:51PM -0600, Rob Herring wrote:
> On Thu, Dec 17, 2015 at 03:00:10AM +0000, Kuninori Morimoto wrote:

> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> > ---
> >  .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++

> For the binding:

> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Rob, it looks like something's up with your mail system - I'm getting
two copies of all your mails.  It looks like I'm getting one copy sent
with TLS and one copy sent without TLS both from rob-hp-laptop with
different message IDs:

Delivered-To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Received: from mail.kernel.org (localhost [127.0.0.1])
        by mail.kernel.org (Postfix) with ESMTP id 5C46E204A2;
        Sat, 19 Dec 2015 04:17:58 +0000 (UTC)
Received: from rob-hp-laptop (unknown [68.66.83.131])
        (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits))
        (No client certificate requested)
        by mail.kernel.org (Postfix) with ESMTPSA id F0AEF20490;
        Sat, 19 Dec 2015 04:17:56 +0000 (UTC)
Message-ID: <20151219041755.GG14936@rob-hp-laptop>
        (sfid-20151219_041801_069806_5E8B0949)

and

Delivered-To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Received: from mail.kernel.org (localhost [127.0.0.1])
        by mail.kernel.org (Postfix) with ESMTP id B6B4E204AF
        for <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>; Sat, 19 Dec 2015 04:19:20 +0000 (UTC)
Received: from rob-hp-laptop (unknown [68.66.83.131])
        by mail.kernel.org (Postfix) with ESMTP id 02201204D2
        for <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>; Sat, 19 Dec 2015 04:19:20 +0000 (UTC)
Received: by rob-hp-laptop (Postfix, from userid 1000)
        id D0F442C02FD; Fri, 18 Dec 2015 22:09:13 -0600 (CST)
...
Message-Id: <20151219040913.D0F442C02FD@rob-hp-laptop>
        (sfid-20151219_041922_802186_2104CD68)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 12/12] ASoC: rsnd: add Multi channel support
       [not found]         ` <20151219113709.GG5727-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-12-22 18:47           ` Rob Herring
  0 siblings, 0 replies; 33+ messages in thread
From: Rob Herring @ 2015-12-22 18:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kuninori Morimoto, Simon, Linux-DT, Linux-ALSA, Liam Girdwood

On Sat, Dec 19, 2015 at 5:37 AM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Fri, Dec 18, 2015 at 02:04:51PM -0600, Rob Herring wrote:
>> On Thu, Dec 17, 2015 at 03:00:10AM +0000, Kuninori Morimoto wrote:
>
>> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
>> > ---
>> >  .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++
>
>> For the binding:
>
>> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> Rob, it looks like something's up with your mail system - I'm getting
> two copies of all your mails.  It looks like I'm getting one copy sent
> with TLS and one copy sent without TLS both from rob-hp-laptop with
> different message IDs:

Yeah, I've been playing with my mail setup and messed up with this
batch mail I had accumulated offline. Thanks for letting me know.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "ASoC: rsnd: add Multi channel support" to the asoc tree
  2015-12-17  3:00   ` [PATCH 12/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
  2015-12-18 20:04     ` Rob Herring
       [not found]     ` <87wpsdhje9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2015-12-23  0:08     ` Mark Brown
  2 siblings, 0 replies; 33+ messages in thread
From: Mark Brown @ 2015-12-23  0:08 UTC (permalink / raw)
  To: Kuninori Morimoto, Rob Herring, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rsnd: add Multi channel support

has been applied to the asoc tree at

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

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

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

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

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

Thanks,
Mark

>From b4c83b171557815a0b31a36805900cc9f21c9ee4 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 17 Dec 2015 03:00:10 +0000
Subject: [PATCH] ASoC: rsnd: add Multi channel support

This patch adds Multi channel support on Renesas R-Car sound.
This patch is tested on Salvator-X board, but it can't use
Multi channel, because supported format is different between
codec chip and R-Car.
Thus, it was tested on board which doesn't mount codec chip,
with oscilloscope.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../devicetree/bindings/sound/renesas,rsnd.txt     |  18 ++++
 sound/soc/sh/rcar/core.c                           |   6 +-
 sound/soc/sh/rcar/gen.c                            |   3 +
 sound/soc/sh/rcar/rsnd.h                           |  15 ++-
 sound/soc/sh/rcar/ssi.c                            | 114 ++++++++++++++++++++-
 sound/soc/sh/rcar/ssiu.c                           |  55 ++++++++--
 6 files changed, 194 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
index 162e94c8305c..8ee0fa91e4a0 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -308,3 +308,21 @@ Example: simple sound card for TDM
 			sound-dai = <&xxx>;
 		};
 	};
+
+Example: simple sound card for Multi channel
+
+&rcar_sound {
+	pinctrl-0 = <&sound_pins &sound_clk_pins>;
+	pinctrl-names = "default";
+
+	/* Single DAI */
+	#sound-dai-cells = <0>;
+
+	status = "okay";
+
+	rcar_sound,dai {
+		dai0 {
+			playback = <&ssi0 &ssi1 &ssi2 &src0 &dvc0>;
+		};
+	};
+};
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7781cef634d4..ca05a0a95a4d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -215,7 +215,11 @@ int rsnd_get_slot_num(struct rsnd_dai_stream *io)
 int rsnd_get_slot_width(struct rsnd_dai_stream *io)
 {
 	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	int chan = runtime->channels / rsnd_get_slot_num(io);
+	int chan = runtime->channels;
+
+	/* Multi channel Mode */
+	if (rsnd_ssi_multi_slaves(io))
+		chan /= rsnd_get_slot_num(io);
 
 	/* TDM Extend Mode needs 8ch */
 	if (chan == 6)
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 7c5485e46fd7..c7aee9e59e86 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -226,6 +226,9 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
 	const static struct rsnd_regmap_field_conf conf_ssiu[] = {
 		RSND_GEN_S_REG(SSI_MODE0,	0x800),
 		RSND_GEN_S_REG(SSI_MODE1,	0x804),
+		RSND_GEN_S_REG(SSI_MODE2,	0x808),
+		RSND_GEN_S_REG(SSI_CONTROL,	0x810),
+
 		/* FIXME: it needs SSI_MODE2/3 in the future */
 		RSND_GEN_M_REG(SSI_BUSIF_MODE,	0x0,	0x80),
 		RSND_GEN_M_REG(SSI_BUSIF_ADINR,	0x4,	0x80),
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index f803e140e733..317dd793149a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -47,6 +47,8 @@ enum rsnd_reg {
 	RSND_REG_SSI_MODE,		/* Gen2 only */
 	RSND_REG_SSI_MODE0,
 	RSND_REG_SSI_MODE1,
+	RSND_REG_SSI_MODE2,
+	RSND_REG_SSI_CONTROL,
 	RSND_REG_SSI_CTRL,		/* Gen2 only */
 	RSND_REG_SSI_BUSIF_MODE,	/* Gen2 only */
 	RSND_REG_SSI_BUSIF_ADINR,	/* Gen2 only */
@@ -181,7 +183,10 @@ enum rsnd_mod_type {
 	RSND_MOD_CTU,
 	RSND_MOD_CMD,
 	RSND_MOD_SRC,
-	RSND_MOD_SSIP, /* SSI parent */
+	RSND_MOD_SSIM3,		/* SSI multi 3 */
+	RSND_MOD_SSIM2,		/* SSI multi 2 */
+	RSND_MOD_SSIM1,		/* SSI multi 1 */
+	RSND_MOD_SSIP,		/* SSI parent */
 	RSND_MOD_SSI,
 	RSND_MOD_SSIU,
 	RSND_MOD_MAX,
@@ -542,6 +547,7 @@ void rsnd_ssi_remove(struct rsnd_priv *priv);
 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
 int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
+u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io);
 
 #define rsnd_ssi_is_pin_sharing(io)	\
 	__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
@@ -549,10 +555,9 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
 
 #define rsnd_ssi_of_node(priv)						\
 	of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
-#define rsnd_parse_connect_ssi(rdai, playback, capture)			\
-	rsnd_parse_connect_common(rdai, rsnd_ssi_mod_get,		\
-				  rsnd_ssi_of_node(rsnd_rdai_to_priv(rdai)), \
-				  playback, capture)
+void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
+			    struct device_node *playback,
+			    struct device_node *capture);
 
 /*
  *	R-Car SSIU
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 0b91692c5a66..7db05fdfb656 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -96,6 +96,7 @@ struct rsnd_ssi {
 #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
 #define rsnd_ssi_mode_flags(p) ((p)->flags)
 #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
+#define rsnd_ssi_is_multi_slave(ssi, io) ((mod) != rsnd_io_to_mod_ssi(io))
 
 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
 {
@@ -171,6 +172,41 @@ static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod)
 	return 0;
 }
 
+u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
+{
+	struct rsnd_mod *mod;
+	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+	struct rsnd_priv *priv = rsnd_io_to_priv(io);
+	struct device *dev = rsnd_priv_to_dev(priv);
+	enum rsnd_mod_type types[] = {
+		RSND_MOD_SSIM1,
+		RSND_MOD_SSIM2,
+		RSND_MOD_SSIM3,
+	};
+	int i, mask;
+
+	switch (runtime->channels) {
+	case 2: /* Multi channel is not needed for Stereo */
+		return 0;
+	case 6:
+		break;
+	default:
+		dev_err(dev, "unsupported channel\n");
+		return 0;
+	}
+
+	mask = 0;
+	for (i = 0; i < ARRAY_SIZE(types); i++) {
+		mod = rsnd_io_to_mod(io, types[i]);
+		if (!mod)
+			continue;
+
+		mask |= 1 << rsnd_mod_id(mod);
+	}
+
+	return mask;
+}
+
 static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 				     struct rsnd_dai_stream *io)
 {
@@ -194,6 +230,9 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
 	if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io))
 		return 0;
 
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	if (ssi->usrcnt > 1) {
 		if (ssi->rate != rate) {
 			dev_err(dev, "SSI parent/child should use same rate\n");
@@ -437,8 +476,14 @@ static int __rsnd_ssi_start(struct rsnd_mod *mod,
 
 	cr  =	ssi->cr_own	|
 		ssi->cr_clk	|
-		ssi->cr_mode	|
-		EN;
+		ssi->cr_mode;
+
+	/*
+	 * EN will be set via SSIU :: SSI_CONTROL
+	 * if Multi channel mode
+	 */
+	if (!rsnd_ssi_multi_slaves(io))
+		cr |= EN;
 
 	rsnd_mod_write(mod, SSICR, cr);
 	rsnd_mod_write(mod, SSIWSR, ssi->wsr);
@@ -609,6 +654,13 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
 	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
 	int ret;
 
+	/*
+	 * SSIP/SSIU/IRQ are not needed on
+	 * SSI Multi slaves
+	 */
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	rsnd_ssi_parent_attach(mod, io, priv);
 
 	ret = rsnd_ssiu_attach(io, mod);
@@ -641,6 +693,13 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 	int dma_id = 0; /* not needed */
 	int ret;
 
+	/*
+	 * SSIP/SSIU/IRQ/DMA are not needed on
+	 * SSI Multi slaves
+	 */
+	if (rsnd_ssi_is_multi_slave(mod, io))
+		return 0;
+
 	ret = rsnd_ssi_common_probe(mod, io, priv);
 	if (ret)
 		return ret;
@@ -732,6 +791,57 @@ static struct rsnd_mod_ops rsnd_ssi_non_ops = {
 /*
  *		ssi mod function
  */
+static void rsnd_ssi_connect(struct rsnd_mod *mod,
+			     struct rsnd_dai_stream *io)
+{
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+	enum rsnd_mod_type types[] = {
+		RSND_MOD_SSI,
+		RSND_MOD_SSIM1,
+		RSND_MOD_SSIM2,
+		RSND_MOD_SSIM3,
+	};
+	enum rsnd_mod_type type;
+	int i;
+
+	/* try SSI -> SSIM1 -> SSIM2 -> SSIM3 */
+	for (i = 0; i < ARRAY_SIZE(types); i++) {
+		type = types[i];
+		if (!rsnd_io_to_mod(io, type)) {
+			rsnd_dai_connect(mod, io, type);
+			rsnd_set_slot(rdai, 2 * (i + 1), (i + 1));
+			return;
+		}
+	}
+}
+
+void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
+			    struct device_node *playback,
+			    struct device_node *capture)
+{
+	struct rsnd_priv *priv = rsnd_rdai_to_priv(rdai);
+	struct device_node *node;
+	struct device_node *np;
+	struct rsnd_mod *mod;
+	int i;
+
+	node = rsnd_ssi_of_node(priv);
+	if (!node)
+		return;
+
+	i = 0;
+	for_each_child_of_node(node, np) {
+		mod = rsnd_ssi_mod_get(priv, i);
+		if (np == playback)
+			rsnd_ssi_connect(mod, &rdai->playback);
+		if (np == capture)
+			rsnd_ssi_connect(mod, &rdai->capture);
+		i++;
+	}
+
+	of_node_put(node);
+}
+
 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)
 {
 	if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv)))
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 7ae05a7621ae..3fe9e08e81a3 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -27,8 +27,11 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 			  struct rsnd_priv *priv)
 {
 	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+	u32 multi_ssi_slaves = rsnd_ssi_multi_slaves(io);
 	int use_busif = rsnd_ssi_use_busif(io);
 	int id = rsnd_mod_id(mod);
+	u32 mask1, val1;
+	u32 mask2, val2;
 
 	/*
 	 * SSI_MODE0
@@ -38,6 +41,9 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 	/*
 	 * SSI_MODE1
 	 */
+	mask1 = (1 << 4) | (1 << 20);	/* mask sync bit */
+	mask2 = (1 << 4);		/* mask sync bit */
+	val1  = val2  = 0;
 	if (rsnd_ssi_is_pin_sharing(io)) {
 		int shift = -1;
 
@@ -51,15 +57,36 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
 		case 4:
 			shift = 16;
 			break;
+		default:
+			return -EINVAL;
 		}
 
-		if (shift >= 0)
-			rsnd_mod_bset(mod, SSI_MODE1,
-				      0x3 << shift,
-				      rsnd_rdai_is_clk_master(rdai) ?
-				      0x2 << shift : 0x1 << shift);
+		mask1 |= 0x3 << shift;
+		val1 = rsnd_rdai_is_clk_master(rdai) ?
+			0x2 << shift : 0x1 << shift;
+
+	} else if (multi_ssi_slaves) {
+
+		mask2 |= 0x00000007;
+		mask1 |= 0x0000000f;
+
+		switch (multi_ssi_slaves) {
+		case 0x0206: /* SSI0/1/2/9 */
+			val2 = (1 << 4) | /* SSI0129 sync */
+				rsnd_rdai_is_clk_master(rdai) ? 0x2 : 0x1;
+			/* fall through */
+		case 0x0006: /* SSI0/1/2 */
+			val1 = rsnd_rdai_is_clk_master(rdai) ?
+				0xa : 0x5;
+
+			if (!val2)  /* SSI012 sync */
+				val1 |= (1 << 4);
+		}
 	}
 
+	rsnd_mod_bset(mod, SSI_MODE1, mask1, val1);
+	rsnd_mod_bset(mod, SSI_MODE2, mask2, val2);
+
 	return 0;
 }
 
@@ -104,8 +131,13 @@ static int rsnd_ssiu_start_gen2(struct rsnd_mod *mod,
 				struct rsnd_dai_stream *io,
 				struct rsnd_priv *priv)
 {
-	if (rsnd_ssi_use_busif(io))
-		rsnd_mod_write(mod, SSI_CTRL, 0x1);
+	if (!rsnd_ssi_use_busif(io))
+		return 0;
+
+	rsnd_mod_write(mod, SSI_CTRL, 0x1);
+
+	if (rsnd_ssi_multi_slaves(io))
+		rsnd_mod_write(mod, SSI_CONTROL, 0x1);
 
 	return 0;
 }
@@ -114,8 +146,13 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,
 			       struct rsnd_dai_stream *io,
 			       struct rsnd_priv *priv)
 {
-	if (rsnd_ssi_use_busif(io))
-		rsnd_mod_write(mod, SSI_CTRL, 0);
+	if (!rsnd_ssi_use_busif(io))
+		return 0;
+
+	rsnd_mod_write(mod, SSI_CTRL, 0);
+
+	if (rsnd_ssi_multi_slaves(io))
+		rsnd_mod_write(mod, SSI_CONTROL, 0);
 
 	return 0;
 }
-- 
2.6.2

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

end of thread, other threads:[~2015-12-23  0:09 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-17  2:52 [PATCH 0/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
2015-12-17  2:55 ` [PATCH 01/12] ASoC: rsnd: fixup SSIU control timing Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: fixup SSIU control timing" to the asoc tree Mark Brown
2015-12-17  2:55 ` [PATCH 02/12] ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit() Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup return value of rsnd_get_adinr_bit()" to the asoc tree Mark Brown
2015-12-17  2:56 ` [PATCH 03/12] ASoC: rsnd: tidyup debug print position on rsnd_dma_attach() Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup debug print position on rsnd_dma_attach()" to the asoc tree Mark Brown
2015-12-17  2:56 ` [PATCH 04/12] ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: rsnd_dai_connect() returns error if it connect to existing mod" to the asoc tree Mark Brown
2015-12-17  2:56 ` [PATCH 05/12] ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: SSI/SSIU use rsnd_get_slot_extend() to check TDM" to the asoc tree Mark Brown
2015-12-17  2:57 ` [PATCH 06/12] ASoC: rsnd: remove rsnd_get_slot_runtime() Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: remove rsnd_get_slot_runtime()" to the asoc tree Mark Brown
2015-12-17  2:57 ` [PATCH 07/12] ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: tidyup rsnd_get_slot_xxx() naming" to the asoc tree Mark Brown
2015-12-17  2:57 ` [PATCH 08/12] ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num() Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: add rsnd_set_slot() / rsnd_get_slot_num()" to the asoc tree Mark Brown
2015-12-17  2:58 ` [PATCH 09/12] ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro Kuninori Morimoto
2015-12-18 12:15   ` Applied "ASoC: rsnd: add rsnd_parse_connect_common() and remove complex macro" to the asoc tree Mark Brown
     [not found] ` <87egeliyaz.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-17  2:59   ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Kuninori Morimoto
2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card" to the asoc tree Mark Brown
2015-12-18 20:16     ` [PATCH 10/12] ASoC: rsnd: add missing DT example for Simple Card Rob Herring
     [not found]     ` <87zix9hjfx.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-19  4:18       ` Rob Herring
2015-12-17  2:59   ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Kuninori Morimoto
2015-12-18 12:15     ` Applied "ASoC: rsnd: add missing DT example for Simple Card with TDM" to the asoc tree Mark Brown
2015-12-18 20:15     ` [PATCH 11/12] ASoC: rsnd: add missing DT example for Simple Card with TDM Rob Herring
     [not found]     ` <87y4cthjf9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-19  4:18       ` Rob Herring
2015-12-17  3:00   ` [PATCH 12/12] ASoC: rsnd: add Multi channel support Kuninori Morimoto
2015-12-18 20:04     ` Rob Herring
2015-12-19 11:37       ` Mark Brown
     [not found]         ` <20151219113709.GG5727-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-12-22 18:47           ` Rob Herring
     [not found]     ` <87wpsdhje9.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-19  4:18       ` Rob Herring
2015-12-23  0:08     ` Applied "ASoC: rsnd: add Multi channel support" to the asoc tree 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.