From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: Re: [alsa-devel] [PATCH 8/8] ASoC: add snd-soc-dummy DT support Date: Tue, 26 Aug 2014 01:34:21 -0700 (PDT) Message-ID: <87wq9vmyyc.wl%kuninori.morimoto.gx@gmail.com> References: <87fvgriqrb.wl%kuninori.morimoto.gx@gmail.com> <874mx7iqgt.wl%kuninori.morimoto.gx@renesas.com> <53F9A6EE.5070005@metafoo.de> <871ts4nmki.wl%kuninori.morimoto.gx@gmail.com> <20140826062558.GR17528@sirena.org.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20140826062558.GR17528-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mark Brown Cc: Lars-Peter Clausen , Kuninori Morimoto , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux-ALSA , Simon , Liam Girdwood List-Id: devicetree@vger.kernel.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 --- 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