Re: [alsa-devel] [PATCH 8/8] ASoC: add snd-soc-dummy DT support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux