alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Subject: Applied "ASoC: rsnd: attach Audio-DMAC-periperi correctly" to the asoc tree
Date: Fri, 22 Jan 2016 18:26:43 +0000	[thread overview]
Message-ID: <E1aMgPz-00047C-3F@debutante> (raw)
In-Reply-To: <87d1sv4rym.wl%kuninori.morimoto.gx@renesas.com>

The patch

   ASoC: rsnd: attach Audio-DMAC-periperi correctly

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 355cb84fbe1f098f80c17dad9027ad2c6aec3fa0 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Thu, 21 Jan 2016 01:58:33 +0000
Subject: [PATCH] ASoC: rsnd: attach Audio-DMAC-periperi correctly

SSI/SRC will try to attach DMAC as Audio-DMAC or Audio-DMAC-periperi.
It is fixed IP, but will be attached to each streams as different module
in case of MUX (= multi sound path will be merged).
This patch solves this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/dma.c  | 56 +++++++++++++++++++++++++-----------------------
 sound/soc/sh/rcar/rsnd.h |  4 ++--
 sound/soc/sh/rcar/src.c  |  4 +---
 sound/soc/sh/rcar/ssi.c  |  5 ++---
 4 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index d1cb3c177572..7658e8fd7bdc 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -622,15 +622,13 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,
 	}
 }
 
-struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
-				 struct rsnd_mod *mod, int id)
+int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
+		    struct rsnd_mod **dma_mod, int id)
 {
-	struct rsnd_mod *dma_mod;
 	struct rsnd_mod *mod_from = NULL;
 	struct rsnd_mod *mod_to = NULL;
 	struct rsnd_priv *priv = rsnd_io_to_priv(io);
 	struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
-	struct rsnd_dma *dma;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct rsnd_mod_ops *ops;
 	enum rsnd_mod_type type;
@@ -646,17 +644,10 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
 	 *	rsnd_rdai_continuance_probe()
 	 */
 	if (!dmac)
-		return ERR_PTR(-EAGAIN);
-
-	dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
-	if (!dma)
-		return ERR_PTR(-ENOMEM);
+		return -EAGAIN;
 
 	rsnd_dma_of_path(mod, io, is_play, &mod_from, &mod_to);
 
-	dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
-	dma->dst_addr = rsnd_dma_addr(io, mod_to,   is_play, 0);
-
 	/* for Gen2 */
 	if (mod_from && mod_to) {
 		ops	= &rsnd_dmapp_ops;
@@ -678,27 +669,38 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
 		type	= RSND_MOD_AUDMA;
 	}
 
-	dma_mod = rsnd_mod_get(dma);
+	if (!(*dma_mod)) {
+		struct rsnd_dma *dma;
 
-	ret = rsnd_mod_init(priv, dma_mod,
-			    ops, NULL, rsnd_mod_get_status, type, dma_id);
-	if (ret < 0)
-		return ERR_PTR(ret);
+		dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL);
+		if (!dma)
+			return -ENOMEM;
 
-	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));
+		*dma_mod = rsnd_mod_get(dma);
 
-	ret = attach(io, dma, id, mod_from, mod_to);
-	if (ret < 0)
-		return ERR_PTR(ret);
+		dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
+		dma->dst_addr = rsnd_dma_addr(io, mod_to,   is_play, 0);
+
+		ret = rsnd_mod_init(priv, *dma_mod, ops, NULL,
+				    rsnd_mod_get_status, type, dma_id);
+		if (ret < 0)
+			return ret;
 
-	ret = rsnd_dai_connect(dma_mod, io, type);
+		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 ret;
+	}
+
+	ret = rsnd_dai_connect(*dma_mod, io, type);
 	if (ret < 0)
-		return ERR_PTR(ret);
+		return ret;
 
-	return rsnd_mod_get(dma);
+	return 0;
 }
 
 int rsnd_dma_probe(struct rsnd_priv *priv)
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 28602607cf5e..90c732e265a2 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -166,8 +166,8 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
 /*
  *	R-Car DMA
  */
-struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io,
-			       struct rsnd_mod *mod, int id);
+int rsnd_dma_attach(struct rsnd_dai_stream *io,
+		    struct rsnd_mod *mod, struct rsnd_mod **dma_mod, int id);
 int rsnd_dma_probe(struct rsnd_priv *priv);
 struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
 					  struct rsnd_mod *mod, char *name);
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 516b0c05451c..8dc9b483b5fa 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -495,9 +495,7 @@ static int rsnd_src_probe_(struct rsnd_mod *mod,
 			return ret;
 	}
 
-	src->dma = rsnd_dma_attach(io, mod, 0);
-	if (IS_ERR(src->dma))
-		return PTR_ERR(src->dma);
+	ret = rsnd_dma_attach(io, mod, &src->dma, 0);
 
 	return ret;
 }
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index e68f3a1c9cb4..90674137aa90 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -704,9 +704,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 	if (ret)
 		return ret;
 
-	ssi->dma = rsnd_dma_attach(io, mod, dma_id);
-	if (IS_ERR(ssi->dma))
-		return PTR_ERR(ssi->dma);
+	/* SSI probe might be called many times in MUX multi path */
+	ret = rsnd_dma_attach(io, mod, &ssi->dma, dma_id);
 
 	return ret;
 }
-- 
2.7.0.rc3

  reply	other threads:[~2016-01-22 18:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21  1:54 [PATCH 0/15] ASoC: rsnd: Ensure CTU/MUX works Kuninori Morimoto
2016-01-21  1:55 ` [PATCH 01/15] ASoC: rsnd: remove unsed *parent Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: remove unsed *parent" to the asoc tree Mark Brown
2016-01-21  1:55 ` [PATCH 02/15] ASoC: rsnd: use rsnd_mod_init() for ADG Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: use rsnd_mod_init() for ADG" to the asoc tree Mark Brown
2016-01-21  1:55 ` [PATCH 03/15] ASoC: rsnd: add debug message for rsnd_mod_call() Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: add debug message for rsnd_mod_call()" to the asoc tree Mark Brown
2016-01-21  1:56 ` [PATCH 04/15] ASoC: rsnd: don't update status if rsnd_mod_call() doesn't match Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: don't update status if rsnd_mod_call() doesn't match" to the asoc tree Mark Brown
2016-01-21  1:56 ` [PATCH 05/15] ASoC: rsnd: try to connect connected mod is not error Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: try to connect connected mod is not error" to the asoc tree Mark Brown
2016-01-21  1:56 ` [PATCH 06/15] ASoC: rsnd: always call probe/remove for MUX Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: always call probe/remove for MUX" to the asoc tree Mark Brown
2016-01-21  1:57 ` [PATCH 07/15] ASoC: rsnd: don't overwrite io on rsnd_cmd_init() Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: don't overwrite io on rsnd_cmd_init()" to the asoc tree Mark Brown
2016-01-21  1:57 ` [PATCH 08/15] ASoC: rsnd: select each SRC correctly for CMD data path Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: select each SRC correctly for CMD data path" to the asoc tree Mark Brown
2016-01-21  1:58 ` [PATCH 09/15] ASoC: rsnd: each mod has status again for CTU/MUX support Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: each mod has status again for CTU/MUX support" to the asoc tree Mark Brown
2016-01-21  1:58 ` [PATCH 10/15] ASoC: rsnd: attach Audio-DMAC-periperi correctly Kuninori Morimoto
2016-01-22 18:26   ` Mark Brown [this message]
2016-01-21  1:58 ` [PATCH 11/15] ASoC: rsnd: ctu: add rsnd_mix_activation() Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: ctu: add rsnd_mix_activation()" to the asoc tree Mark Brown
2016-01-21  1:59 ` [PATCH 12/15] ASoC: rsnd: ctu: add rsnd_ctu_halt() Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: ctu: add rsnd_ctu_halt()" to the asoc tree Mark Brown
2016-01-21  1:59 ` [PATCH 13/15] ASoC: rsnd: ctu: settings matches to datasheet Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: ctu: settings matches to datasheet" to the asoc tree Mark Brown
2016-01-21  1:59 ` [PATCH 14/15] ASoC: rsnd: tidyup Playback/Capture sequence Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: tidyup Playback/Capture sequence" to the asoc tree Mark Brown
2016-01-21  2:00 ` [PATCH 15/15] ASoC: rsnd: disable SRC.out/in in same time Kuninori Morimoto
2016-01-22 18:26   ` Applied "ASoC: rsnd: disable SRC.out/in in same time" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1aMgPz-00047C-3F@debutante \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).