All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	Kuninori Morimoto
	<kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linux-ALSA <alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
	Simon <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [alsa-devel] [PATCH 8/8] ASoC: add snd-soc-dummy DT support
Date: Tue, 26 Aug 2014 01:34:21 -0700 (PDT)	[thread overview]
Message-ID: <87wq9vmyyc.wl%kuninori.morimoto.gx@gmail.com> (raw)
In-Reply-To: <20140826062558.GR17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>


Hi Mark, Lars

> > > That's something we need to fix, but I don't think removing the stream names 
> > > is the right way to do this. In a multi CODEC environment you'll quite 
> > > likely end up with widgets of the same name. Ideally a route endpoint would 
> > > be expressed by a tuple of DT node and pin name. But I don't think it is 
> > > possible to mix integer and string elements in a property.
> 
> It's not.  Now that we have preprocessor support it's a lot easier to
> just use numbers though - the legibility problems from just using raw
> numbers in big tables don't apply so much any more.
> 
> > Thank you for your advice.
> > "DT node and name" seems nice idea, but it works on DT case only ?
> > Anyway, I re-consider about this too.
> > It can be trial and error...
> 
> I think that for hardware which has fairly monolithic audio blocks using
> DPCM it might be worth thinking about providing a way for the DT to look
> like the DT for a simple I2S DAI with the driver for the IP in the SoC
> filling in all the structure needed by DPCM.

I expended route setting method like below, but what do you think ? 
I guess it can use not only DT case, and it is readable ?


--------------------------
Subject: [PATCH] ASoC: dapm: enable DAI name on DAPM route

DAPM route setting is using name matching.
but, it can't match correctly if codec/platform
driver have same name.
This can be very serious issue on DAPM.

    FE CPU   (ec500000.rcar_sound): "DAI0 Playback"
       Codec (snd-soc-dummy-dai):   "Playback"

    BE CPU   (snd-soc-dummy-dai):   "Playback"
       Codec (ak4642-hifi):         "Playback"

This patch expand route setting by using DAI name.
You can select "ak4642-hifi" side "Playback" by below.

DT
	simple-audio-card,routing =
		"ak4642-hifi Playback", "DAI0 Playback";

non DT
	struct snd_soc_dapm_route route[] = {
		{ "ak4642-hifi Playback", NULL, "DAI0 Playback"},
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 sound/soc/soc-dapm.c |   47 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 37 insertions(+), 10 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b24f70a..084f15b 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2395,6 +2395,30 @@ err:
 	return ret;
 }
 
+static void snd_soc_dapm_route_scan(struct snd_soc_dapm_widget *w,
+				    struct snd_soc_dapm_widget **wsource,
+				    struct snd_soc_dapm_widget **wsink,
+				    struct snd_soc_dapm_widget **wtsource,
+				    struct snd_soc_dapm_widget **wtsink,
+				    struct snd_soc_dapm_context *dapm,
+				    const char *sink,
+				    const char *source,
+				    const char *name)
+{
+	if (!*wsink && !(strcmp(name, sink))) {
+		*wtsink = w;
+		if (w->dapm == dapm)
+			*wsink = w;
+		return;
+	}
+
+	if (!*wsource && !(strcmp(name, source))) {
+		*wtsource = w;
+		if (w->dapm == dapm)
+			*wsource = w;
+	}
+}
+
 static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
 				  const struct snd_soc_dapm_route *route)
 {
@@ -2425,17 +2449,20 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
 	 * current DAPM context
 	 */
 	list_for_each_entry(w, &dapm->card->widgets, list) {
-		if (!wsink && !(strcmp(w->name, sink))) {
-			wtsink = w;
-			if (w->dapm == dapm)
-				wsink = w;
-			continue;
-		}
-		if (!wsource && !(strcmp(w->name, source))) {
-			wtsource = w;
-			if (w->dapm == dapm)
-				wsource = w;
+		if (w->dai) {
+			char w_name[80];
+
+			snprintf(w_name, sizeof(w_name), "%s %s",
+				 w->dai->name, w->name);
+
+			snd_soc_dapm_route_scan(w, &wsource, &wsink,
+						&wtsource, &wtsink, dapm,
+						sink, source, w_name);
 		}
+
+		snd_soc_dapm_route_scan(w, &wsource, &wsink,
+					&wtsource, &wtsink, dapm,
+					sink, source, w->name);
 	}
 	/* use widget from another DAPM context if not found from this */
 	if (!wsink)


Best regards
---
Kuninori Morimoto
--
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

  parent reply	other threads:[~2014-08-26  8:34 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  7:06 [PATCH 0/8] ASoC: simple-card: DPCM support Kuninori Morimoto
     [not found] ` <87fvgriqrb.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-20  7:07   ` [PATCH 1/8] ASoC: simple-card: use asoc_simple_xxx prefix Kuninori Morimoto
2014-08-20  7:07   ` [PATCH 2/8] ASoC: simple-card: remove dai_link->cpu_dai_name when DT Kuninori Morimoto
2014-08-20  7:09   ` [PATCH 3/8] ASoC: simple-card: dai_link->init should be cared when multi DAI Kuninori Morimoto
2014-08-20  7:09   ` [PATCH 4/8] ASoC: simple-card: use common for_each_child_of_node() for loop Kuninori Morimoto
2014-08-20  7:11   ` [PATCH 5/8] ASoC: simple-card: add DPCM support when DT case Kuninori Morimoto
2014-08-20  7:11   ` [PATCH 6/8] ASoC: simple-card: remove is_top_level_node from asoc_simple_card_sub_parse_of() Kuninori Morimoto
2014-08-20  7:11   ` [PATCH 7/8] ASoC: rsnd: add dai_link stream name Kuninori Morimoto
2014-08-20  7:13   ` [PATCH 8/8] ASoC: add snd-soc-dummy DT support Kuninori Morimoto
     [not found]     ` <874mx7iqgt.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2014-08-24  8:48       ` [alsa-devel] " Lars-Peter Clausen
     [not found]         ` <53F9A6EE.5070005-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-08-26  0:04           ` Kuninori Morimoto
     [not found]             ` <871ts4nmki.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-26  6:25               ` Mark Brown
     [not found]                 ` <20140826062558.GR17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-08-26  8:34                   ` Kuninori Morimoto [this message]
     [not found]                     ` <87wq9vmyyc.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-26  9:11                       ` Mark Brown
     [not found]                         ` <20140826091120.GC17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-08-26  9:19                           ` Lars-Peter Clausen
     [not found]                             ` <53FC5105.6070901-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-08-26  9:42                               ` Mark Brown
     [not found]                                 ` <20140826094211.GF17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-08-26 10:31                                   ` Kuninori Morimoto
     [not found]                                     ` <87r403mtip.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-26 10:50                                       ` Mark Brown
     [not found]                                         ` <20140826105028.GK17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-08-27  1:11                                           ` Kuninori Morimoto
     [not found]                                             ` <87d2bmpwi2.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-27  3:14                                               ` Kuninori Morimoto
     [not found]                                                 ` <87a96qpqsy.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-27  8:24                                                   ` Lars-Peter Clausen
     [not found]                                                     ` <53FD95AB.6080903-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-08-28  0:33                                                       ` Kuninori Morimoto
     [not found]                                                         ` <87fvghihaq.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-28  7:23                                                           ` Lars-Peter Clausen
     [not found]                                                             ` <53FED90B.8070308-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-08-28 10:41                                                               ` Kuninori Morimoto
2014-08-28  8:02                                                           ` Mark Brown
     [not found]                                                             ` <20140828080251.GG17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-08-28 10:56                                                               ` Kuninori Morimoto
     [not found]                                                                 ` <87sikghohq.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-29  0:41                                                                   ` Kuninori Morimoto
2014-08-26  0:08   ` [PATCH 0/8] ASoC: simple-card: DPCM support Kuninori Morimoto
     [not found]     ` <87zjesm7sp.wl%kuninori.morimoto.gx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-28  3:04       ` Kuninori Morimoto
2014-08-28  3:06 ` [PATCH 0/4 v2] ASoC: simple-card: fixup for DT Kuninori Morimoto
2014-08-28  3:07   ` [PATCH 1/4 v2] ASoC: simple-card: use asoc_simple_xxx prefix Kuninori Morimoto
2014-08-29 11:49     ` Mark Brown
2014-08-28  3:08   ` [PATCH 2/4 v2] ASoC: simple-card: remove dai_link->cpu_dai_name when DT Kuninori Morimoto
2014-08-29 11:51     ` Mark Brown
2014-08-28  3:08   ` [PATCH 3/4 v2] ASoC: simple-card: dai_link->init should be cared when multi DAI Kuninori Morimoto
2014-08-29 11:51     ` Mark Brown
2014-08-28  3:08   ` [PATCH 4/4 v2] ASoC: simple-card: use common for_each_child_of_node() for loop Kuninori Morimoto
2014-08-29 11:51     ` 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=87wq9vmyyc.wl%kuninori.morimoto.gx@gmail.com \
    --to=kuninori.morimoto.gx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
    --cc=kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 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.