Skip to contentSkip to conversation

ASoC: audio-graph-card2: support explicitly disabled links

RFC PATCH In review Laurentiu Mihalcea 2 participants 14 messages May 15, 2025 – May 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: audio-graph-card2: support explicitly disabled links

From: Laurentiu Mihalcea <[email protected]>

Some boards (referred to as "base" boards here) support attaching daughter boards (referred to as "plugin" boards here) to them to extend their audio capabilities (i.e. the daughter boards may contain additional codecs that can be attached to the DAIs exposed by the base boards). This can be seen in the following diagram:

                  +========+               +========+
                  |        | D0 <-----> C0 |        |
                  |  BASE  |               | PLUGIN |
                  |        | D1 <-----> C1 |        |
                  +========+               +========+

where D0 and D1 are the DAIs of BASE board connected to PLUGIN's C0 and C1 codecs.

Currently, if any of the devices that make up a DAI link have their DT nodes disabled using the 'status = "disabled"' property, the creation of the sound card using "audio-graph-card2" driver will fail.

To allow for some extra flexibility with respect to the devicetrees, this series allows the existence of explicitly disabled links. An explicitly disabled link is a link whose CODEC/DAI DT node has been disabled using the 'status = "disabled"' property. The sound card creation will no longer fail if such a link is encountered.

The main usage of this feature is to support links that can be removed. For instance, links D0-C0 and D1-C1 cannot be created unless PLUGIN is connected. As such, we can disable the DT nodes of C0 and C1 in the BASE's DTS and then enable them using PLUGIN's DT overlay.

Additionally, since links might be disabled, the route creation may fail. So, if there's at least one link that was explicitly disabled then we need to allow the route creation to fail (by re-introducing an OF variant of the previously removed "disabled_of_route_checks"). This also allows making the DT overlays for the plugins more scalable as we remove the dependency of the "routing" property on the base board.

In addition to the aforementioned feature, this series also includes a set of DTSIs that I've used for testing. I've included them in case anyone would like to try out this new feature. If they don't bring any value then we can just drop them.

An example of how this feature can be used is shown below. We assume that C0 has widget C00. We also assume that BASE has an additional connection:
D2-C2, where C2 is a codec present on the BASE board. C2 has widgets C20 and C21.

[snippet from base.dts]

	card {
		compatible = "audio-graph-card2";
		links = <&l0>, <&l1>, <&l2>;
		routing = "Headphones", "C20",
			  "Headphones", "C21",
			  "Line", "C01";
	};

	d0: cpu@0 {
		l0: port { l0_ep: endpoint { remote-endpoint = <&c0_ep>; } };
	};

	d1: cpu@1 {
		l1: port { l1_ep: endpoint { remote-endpoint = <&c1_ep>; } };
	};

	d2: cpu@2 {
		l2: port { l2_ep: endpoint { remote-endpoint = <&c2_ep>; } };
	};

	c0: codec@0 {
		status = "disabled";

		port { c0_ep: endpoint { remote-endpoint = <&l0_ep>; } };
	};

	c1: codec@1 {
		status = "disabled";

		port { c1_ep: endpoint { remote-endpoint = <&l1_ep>; } };
	};

	c2: codec@2 {
		port { c2_ep: endpoint { remote-endpoint = <&l2_ep>; } };
	};

[snippet from plugin.dtso]

&c0 {
	status = "okay";
};
&c1 {
	status = "okay";
};

Since codecs c0 and c1 do not exist unless PLUGIN is connected, they are disabled in BASE's DTS. If PLUGIN's DTBO is not applied then only link l2 will be created. Otherwise, all links will be created. PLUGIN's DTBO can be applied to the DTB of any BASE board it's compatible with under the condition that the DT node labels for said codecs are kept the same.

Laurentiu Mihalcea (3):
ASoC: re-introduce disable_route_checks flag for OF routes
ASoC: audio-graph-card2: support explicitly disabled links
ASoC: generic: add more sample DTSIs for audio-graph-card2

 include/sound/simple_card_utils.h             |   3 +-
 include/sound/soc.h                           |   1 +
 .../generic/audio-graph-card2-sample1.dtsi    | 278 ++++++
 .../generic/audio-graph-card2-sample2.dtsi    | 878 ++++++++++++++++++
 .../generic/audio-graph-card2-sample3.dtsi    | 486 ++++++++++
 sound/soc/generic/audio-graph-card2.c         | 231 +++++
 sound/soc/soc-core.c                          |  12 +-
 7 files changed, 1886 insertions(+), 3 deletions(-)
 create mode 100644 sound/soc/generic/audio-graph-card2-sample1.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2-sample2.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2-sample3.dtsi
Signature · 1 line
2.34.1
#1 lore raw

RFC PATCH 1/3 ASoC: re-introduce disable_route_checks flag for OF routes

From: Laurentiu Mihalcea <[email protected]>

The "disable_route_checks" flag was previously removed via commit dd2395162c07 ("ASoC: remove disable_route_checks") as it wasn't being used anywhere.

Re-introduce an OF-specific variant of the flag: "disable_of_route_checks" as this will be used by audio-graph-card2.

---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
include/sound/soc.h +1 -0
index 1fffef311c41..e76da038557d 100644
@@ -1077,6 +1077,7 @@ struct snd_soc_card {
 	unsigned int instantiated:1;
 	unsigned int topology_shortname_created:1;
 	unsigned int fully_routed:1;
+	unsigned int disable_of_route_checks:1;
 	unsigned int probed:1;
 	unsigned int component_chaining:1;
 	struct device *devres_dev;
sound/soc/soc-core.c +10 -2
index 67bebc339148..b14a52d6f550 100644
@@ -2245,8 +2245,16 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
 	ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes,
 				      card->num_of_dapm_routes);
-	if (ret < 0)
-		goto probe_end;
+	if (ret < 0) {
+		if (card->disable_of_route_checks) {
+			ret = 0;
+			dev_info(card->dev,
+				 "%s: disable_of_route_checks set, ignoring errors on add_routes\n",
+				 __func__);
+		} else {
+			goto probe_end;
+		}
+	}
 
 	/* try to set some sane longname if DMI is available */
 	snd_soc_set_dmi_name(card);
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH RFC 1/3] ASoC: re-introduce disable_route_checks flag for OF routes

Hi Laurentiu

Thank you for the patch

Quoted 35 lines

The "disable_route_checks" flag was previously removed via commit dd2395162c07 ("ASoC: remove disable_route_checks") as it wasn't being used anywhere.

Re-introduce an OF-specific variant of the flag: "disable_of_route_checks" as this will be used by audio-graph-card2.

---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
include/sound/soc.h +1 -0
index 1fffef311c41..e76da038557d 100644
@@ -1077,6 +1077,7 @@ struct snd_soc_card {
 	unsigned int instantiated:1;
 	unsigned int topology_shortname_created:1;
 	unsigned int fully_routed:1;
+	unsigned int disable_of_route_checks:1;
 	unsigned int probed:1;
 	unsigned int component_chaining:1;
 	struct device *devres_dev;
sound/soc/soc-core.c +0 -2
index 67bebc339148..b14a52d6f550 100644
@@ -2245,8 +2245,16 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
 	ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes,
 				      card->num_of_dapm_routes);
-	if (ret < 0)
-		goto probe_end;

sound/soc/soc-core.c static int snd_soc_bind_card(struct snd_soc_card *card) · line 2257

Quoted 10 lines
sound/soc/soc-core.c +10 -0
+	if (ret < 0) {
+		if (card->disable_of_route_checks) {
+			ret = 0;
+			dev_info(card->dev,
+				 "%s: disable_of_route_checks set, ignoring errors on add_routes\n",
+				 __func__);
+		} else {
+			goto probe_end;
+		}
+	}

commit dd2395162c07 removed flag from 3 parts (core x2 / topology), but this patch get back only one of them.

I think this flag check should be implemented in snd_soc_dapm_add_route() itself instead of each caller, but what do you think ?

And maybe we want to use more easy-to-understand naming, like "ignore route check", etc ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#3 lore raw

Re: [PATCH RFC 1/3] ASoC: re-introduce disable_route_checks flag for OF routes

Quoted 35 lines · Kuninori Morimoto

Hi Laurentiu

Thank you for the patch

Quoted 31 lines

The "disable_route_checks" flag was previously removed via commit dd2395162c07 ("ASoC: remove disable_route_checks") as it wasn't being used anywhere.

Re-introduce an OF-specific variant of the flag: "disable_of_route_checks" as this will be used by audio-graph-card2.

---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
include/sound/soc.h +1 -0
index 1fffef311c41..e76da038557d 100644
@@ -1077,6 +1077,7 @@ struct snd_soc_card {
 	unsigned int instantiated:1;
 	unsigned int topology_shortname_created:1;
 	unsigned int fully_routed:1;
+	unsigned int disable_of_route_checks:1;
 	unsigned int probed:1;
 	unsigned int component_chaining:1;
 	struct device *devres_dev;
sound/soc/soc-core.c +0 -0
index 67bebc339148..b14a52d6f550 100644
@@ -2245,8 +2245,16 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
Quoted 16 lines
Quoted 4 lines
sound/soc/soc-core.c +0 -2
 	ret = snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes,
 				      card->num_of_dapm_routes);
-	if (ret < 0)
-		goto probe_end;

sound/soc/soc-core.c static int snd_soc_bind_card(struct snd_soc_card *card) · line 2257

Quoted 10 lines
sound/soc/soc-core.c +10 -0
+	if (ret < 0) {
+		if (card->disable_of_route_checks) {
+			ret = 0;
+			dev_info(card->dev,
+				 "%s: disable_of_route_checks set, ignoring errors on add_routes\n",
+				 __func__);
+		} else {
+			goto probe_end;
+		}
+	}

commit dd2395162c07 removed flag from 3 parts (core x2 / topology), but this patch get back only one of them.

hm, so the rationale for introducing this OF-specific flag was because

audio-graph-card2 is the only user for this feature and this user only

needs to disable route checks for OF-based routes. On second thought

though I think it might be better to have this feature for all routes in case

someone might need it for non-OF routes as well? (if we go with the current

approach and it turns out someone needs it for non-OF routes you're going

to need more changes to support that)

Quoted 3 lines

I think this flag check should be implemented in snd_soc_dapm_add_route() itself instead of each caller, but what do you think ?

good idea, I'll give it a try

Quoted 3 lines

And maybe we want to use more easy-to-understand naming, like "ignore route check", etc ?

sure

Quoted 6 lines

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#4 lore raw

RFC PATCH 2/3 ASoC: audio-graph-card2: support explicitly disabled links

In reply to Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

An explicitly disabled link is a DAI link in which one of its device endpoints (e.g: codec or CPU) has been disabled in the DTS via the "status" property. Formally speaking:

	OF_LINK_IS_DISABLED(lnk) = OF_NODE_IS_DISABLED(dev0) ||
	                           OF_NODE_IS_DISABLED(dev1);

where dev0 and dev1 are the two devices (CPU/codec) that make up the link.

If at least one link was explicitly disabled that means DAPM routes passed through the OF property "routing" can fail as some widgets might not exist. Consider the following example:

CODEC A has widgets A0, A1.
CODEC B has widgets B0, B1.

my-card {
compatible = "audio-graph-card2":
label = "my-label";
links = <&cpu0_port>, <&cpu1_port>; routing = "A0", "A1",
"B0", "B1";
};

CODEC A's DT node was disabled.
CODEC B's DT node is enabled.
CPU0's DT node is enabled.
CPU1's DT node is enabled.

If CODEC A's DT node is disabled via the 'status = "disabled"' property that means the A0 -> A1 route cannot be created. This doesn't affect the B0 -> B1 route though as CODEC B was never disabled in the DT.

This is why, if any explicitly disabled link is discovered, the "disable_of_route_checks" flag is turned on.

If all links were explicitly disabled the sound card creation will fail. Otherwise, if there's at least one link which wasn't explicitly disabled then the sound card creation will succeed.

---
 include/sound/simple_card_utils.h     |   3 +-
 sound/soc/generic/audio-graph-card2.c | 231 ++++++++++++++++++++++++++
 2 files changed, 233 insertions(+), 1 deletion(-)
include/sound/simple_card_utils.h +2 -1
index 69a9c9c4d0e9..3fde0314dbb2 100644
@@ -132,9 +132,10 @@ struct simple_util_priv {
 #define SNDRV_MAX_LINKS 512
 
 struct link_info {
-	int link; /* number of link */
+	int link; /* number of available links */
 	int cpu;  /* turn for CPU / Codec */
 	struct prop_nums num[SNDRV_MAX_LINKS];
+	bool disabled_link; /* true if there's at least one explicitly disabled link */
 };
 
 int simple_util_parse_daifmt(struct device *dev,
sound/soc/generic/audio-graph-card2.c +231 -0

249 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

Hi Laurentiu

Thank you for the patch

Quoted 37 lines

An explicitly disabled link is a DAI link in which one of its device endpoints (e.g: codec or CPU) has been disabled in the DTS via the "status" property. Formally speaking:

	OF_LINK_IS_DISABLED(lnk) = OF_NODE_IS_DISABLED(dev0) ||
	                           OF_NODE_IS_DISABLED(dev1);

where dev0 and dev1 are the two devices (CPU/codec) that make up the link.

If at least one link was explicitly disabled that means DAPM routes passed through the OF property "routing" can fail as some widgets might not exist. Consider the following example:

CODEC A has widgets A0, A1.
CODEC B has widgets B0, B1.

my-card {
compatible = "audio-graph-card2":
label = "my-label";
links = <&cpu0_port>, <&cpu1_port>; routing = "A0", "A1",
"B0", "B1";
};

CODEC A's DT node was disabled.
CODEC B's DT node is enabled.
CPU0's DT node is enabled.
CPU1's DT node is enabled.

If CODEC A's DT node is disabled via the 'status = "disabled"' property that means the A0 -> A1 route cannot be created. This doesn't affect the B0 -> B1 route though as CODEC B was never disabled in the DT.

This is why, if any explicitly disabled link is discovered, the "disable_of_route_checks" flag is turned on.

Quoted 6 lines

If all links were explicitly disabled the sound card creation will fail. Otherwise, if there's at least one link which wasn't explicitly disabled then the sound card creation will succeed.

---

I think I could understand your situation, but the solution (= this patch) is too much complicated for me. Indeed it might detect disabled device, but some board might want to detect it as error, unlike your case.

You want to add "disable_of_route_checks" flag to the card, right ? How about to add new property, like "force detect xxx", or "DAI might not be detected", etc, etc, etc...

If we can have such property, it will be more simple code.

	if (it_has_flag("force_detect_xxx")) {
		dev_info(dev, "xxx");
		card->disable_of_route_checks = 1;
	}

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#6 lore raw
Quoted 45 lines · Kuninori Morimoto

Hi Laurentiu

Thank you for the patch

Quoted 41 lines

An explicitly disabled link is a DAI link in which one of its device endpoints (e.g: codec or CPU) has been disabled in the DTS via the "status" property. Formally speaking:

	OF_LINK_IS_DISABLED(lnk) = OF_NODE_IS_DISABLED(dev0) ||
	                           OF_NODE_IS_DISABLED(dev1);

where dev0 and dev1 are the two devices (CPU/codec) that make up the link.

If at least one link was explicitly disabled that means DAPM routes passed through the OF property "routing" can fail as some widgets might not exist. Consider the following example:

CODEC A has widgets A0, A1.
CODEC B has widgets B0, B1.

my-card {
compatible = "audio-graph-card2":
label = "my-label";
links = <&cpu0_port>, <&cpu1_port>; routing = "A0", "A1",
"B0", "B1";
};

CODEC A's DT node was disabled.
CODEC B's DT node is enabled.
CPU0's DT node is enabled.
CPU1's DT node is enabled.

If CODEC A's DT node is disabled via the 'status = "disabled"' property that means the A0 -> A1 route cannot be created. This doesn't affect the B0 -> B1 route though as CODEC B was never disabled in the DT.

This is why, if any explicitly disabled link is discovered, the "disable_of_route_checks" flag is turned on.

If all links were explicitly disabled the sound card creation will fail. Otherwise, if there's at least one link which wasn't explicitly disabled then the sound card creation will succeed.

Quoted 5 lines
Quoted 2 lines

---

I think I could understand your situation, but the solution (= this patch) is too much complicated for me. Indeed it might detect disabled device, but some board might want to detect it as error, unlike your case.

that is true. One problem with this solution is the fact that you can't

really distinguish between links that were intentionally disabled (see example

from RFC's cover letter) and links that were accidentally disabled (e.g. user

forgot to set 'status = "okay"' for one of the link's devices)

Quoted 11 lines

You want to add "disable_of_route_checks" flag to the card, right ? How about to add new property, like "force detect xxx", or "DAI might not be detected", etc, etc, etc...

If we can have such property, it will be more simple code.

	if (it_has_flag("force_detect_xxx")) {
		dev_info(dev, "xxx");
		card->disable_of_route_checks = 1;
	}

well, I think the solution is made up of 2 parts:

    1) the part that allows link devices to be disabled

    2) the part that allows routes to fails

what you're suggesting is dropping the first part and going with just the second one.

The problem I see with this (let's assume we have the BASE-PLUGIN example presented

in the RFC's cover letter) is that:

    1) You'll have to specify the links inside of PLUGIN's DT overlay (instead of BASE's DTS)

    2) You'll have to do the link connection part inside PLUGIN's DT overlay.

So, our example DTS and DT overlay would look like this:

[snippet from base.dts]

	my_card: card {
		compatible = "audio-graph-card2";
		links = <&l2>; /* here, we're only allowed to specify links that exist */
		routing = "Headphones", "C20",
			  "Headphones", "C21",
			  "Line", "C01";
	};

	d0: cpu@0 {
		l0: port { l0_ep: endpoint { /* connected when plugin.dtbo is applied */ } };
	};

	d1: cpu@1 {
		l1: port { l1_ep: endpoint { /* connected when plugin.dtbo is applied */ } };
	};

	d2: cpu@2 {
		l2: port { l2_ep: endpoint { remote-endpoint = <&c2_ep>; } };
	};

	c2: codec@2 {
		port { c2_ep: endpoint { remote-endpoint = <&l2_ep>; } };
	};

[snippet from plugin.dtso]

&my_card {
	/* here we're forced to also specify l2 even if this is already done
         * in base.dts. This is because DT overlays don't support appending to
	 * properties.
         */
	remote-endpoint = <&l0>, <&l1>, <&l2>;
};
&l0_ep {
	remote-endpoint = <&c1_ep>;
};
&l1_ep {
	remote-endpoint = <&c2_ep>;
};
c0: codec@0 {
	port { c0_ep: endpoint { remote-endpoint = <&l0_ep>; } };
};
c1: codec@1 {
	port { c1_ep: endpoint { remote-endpoint = <&l1_ep>; } };
};

Assume that we also have BASE1 that is compatible with PLUGIN but C0 and C1 are connected to BASE1's D0 and D5. Since there's no D1-C1 connection that means you'll have to create another DT overlay. Thus, the scalability of plugin.dtso decreases.

Now, for our particular case, we have BASE0 and BASE1 with the following DAIs and CODECS (these are physically present on the base boards):

BASE0 has DAIs D0, D1 and CODEC C0
BASE1 has DAIs D0, D1 and CODEC C1

Both of these boards are compatible with plugin PLUGIN that has codec C2. The possible DAI links are:

For BASE0:

D0 <----> C0
D1 <----> C2 (only possible with PLUGIN connected)

For BASE1:

D0 <----> C1
D1 <----> C2 (only possible with PLUGIN connected)

Since the D1 <---> C2 connection is valid for both BASE0-PLUGIN and BASE1-PLUGIN combinations I think we can make do without the support for explicitly disabled links. But I don't think this is ideal because:

1) If we ever need to support board BASE3 that is compatible with PLUGIN and uses Dn != D1 to connect with PLUGIN's C2 codec then we're going to either modify our devicetrees (to make plugin.dtso applicable to BASE3 as well) or add another DT overlay (not really desirable because we already have a lot of devicetrees). (note: more of an _if_ situation. Don't think we can actually use this as an argument. I just wanted to have this out in the open)

2) People might get confused when looking at the "links" and "routing" properties. Now, "links" will only contain links that actually exist, while "routing" can contain widgets from codecs that don't exist on the base board. (note: perhaps not a deal breaker? again, just wanted to have this out in the open)

Either way, I believe your concern is valid. This new feature adds a lot of extra code and validating it is a pain. Still, even if we go with just the extra DT property as you suggested I believe this is a step forward so I think we can go with that for now and see how well this scales.

BTW, thanks a lot for taking the time to review this huge series!!

Quoted 5 lines

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#7 lore raw

Hi Mihalcea

Thank you for clarify details.

Quoted 9 lines

[snippet from base.dts]

	my_card: card {
		compatible = "audio-graph-card2";
		links = <&l2>; /* here, we're only allowed to specify links that exist */
		routing = "Headphones", "C20",
			  "Headphones", "C21",
			  "Line", "C01";
	};

(snip)

Quoted 7 lines
&my_card {
	/* here we're forced to also specify l2 even if this is already done
         * in base.dts. This is because DT overlays don't support appending to
	 * properties.
         */
	remote-endpoint = <&l0>, <&l1>, <&l2>;
};

This is very nit pickking, but I need to confirm.
You want to indicate here is this ?

	&my_card {
-		remote-endpoint = <&l0>, <&l1>, <&l2>;
+		links = <&l0>, <&l1>, <&l2>;
	};
Quoted 8 lines
&l0_ep {
	remote-endpoint = <&c1_ep>;
};
&l1_ep {
	remote-endpoint = <&c2_ep>;
};
Quoted 7 lines
c0: codec@0 {
	port { c0_ep: endpoint { remote-endpoint = <&l0_ep>; } };
};
c1: codec@1 {
	port { c1_ep: endpoint { remote-endpoint = <&l1_ep>; } };
};

This is also nit pickking, but I think above is wrong. I guess you want to indicate is...

	&l0_ep {
-		remote-endpoint = <&c1_ep>;
+		remote-endpoint = <&c0_ep>;
	};

	&l1_ep {
-		remote-endpoint = <&c2_ep>;
+		remote-endpoint = <&c1_ep>;
	};

Your are indicating very confusable naming, so I want to understand correctly as much as possible.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

CODEC A has widgets A0, A1.
CODEC B has widgets B0, B1.

my-card {
compatible = "audio-graph-card2":
label = "my-label";
links = <&cpu0_port>, <&cpu1_port>; routing = "A0", "A1",
"B0", "B1";
};

CODEC A's DT node was disabled.
CODEC B's DT node is enabled.
CPU0's DT node is enabled.
CPU1's DT node is enabled.

(snip)

Quoted 19 lines

Assume that we also have BASE1 that is compatible with PLUGIN but C0 and C1 are connected to BASE1's D0 and D5. Since there's no D1-C1 connection that means you'll have to create another DT overlay. Thus, the scalability of plugin.dtso decreases.

Now, for our particular case, we have BASE0 and BASE1 with the following DAIs and CODECS (these are physically present on the base boards):

BASE0 has DAIs D0, D1 and CODEC C0
BASE1 has DAIs D0, D1 and CODEC C1

Both of these boards are compatible with plugin PLUGIN that has codec C2. The possible DAI links are:

For BASE0:

D0 <----> C0
D1 <----> C2 (only possible with PLUGIN connected)

Quoted 8 lines

For BASE1:

D0 <----> C1
D1 <----> C2 (only possible with PLUGIN connected)

Since the D1 <---> C2 connection is valid for both BASE0-PLUGIN and BASE1-PLUGIN combinations I think we can make do without the support for explicitly disabled links. But I don't think this is ideal because:

Let's avoid BASE3 case here to avoid _if_ story.
You are now indicating too many complex/cofusable situations with wrong setting samples (D0/D1/D2..., C0/C1/C2. BASEx has no D1-C1..., etc, etc...)

I noticed that why you need to add disabled Codec routing on BASE DT ? It is the reason why you can't detect BASE only sound card, right ?

	---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

[snippet from base.dts]

	my_card: card {
		compatible = "audio-graph-card2";
		links = <&l2>; /* here, we're only allowed to specify links that exist */
		routing = "Headphones", "C20",
			  "Headphones", "C21",
=>			  "Line", "C01";
	};

	---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

If my understanding was correct, your system can be indicated like below (It is not same as your D0/D1/D2 sample, but I think same things, and
not confusable sample)

	BASE			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	| CPU2		  | <-> | Codec2 |
	+-----------------+     +--------+

How it works by below ?

BASE

	/*
	 * detect CPU0-Codec0 connection only
	 * Codec1/2 are disabled, but not related to BASE
	 */
	my_card: card {
		links = <&cpu0>;
		routing = "Headphone0", "Codec0"; /* for CPU0-Codec0 */
	};

PLUGIN

	/* detect all
	 * CPU0-Codec0 connection
	 * CPU1-Codec1 connection
	 * CPU2-Codec2 connection, and its routings */
	&my_card {
		links = <&cpu0>, <&cpu1>, <&cpu2>;
		routing = "Headphone0", "Codec0", /* for CPU0-Codec0 */
			  "Headphone1", "Codec1", /* for CPU1-Codec1 */
			  "Headphone2", "Codec2"; /* for CPU2-Codec2 */
	};

And/Or your situation is similar as mine (I should have noticed about this sooner).

	d70be079c3cf34bd91e1c8f7b4bc760356c9150c
	("arm64: dts: renesas: ulcb/kf: Use multi Component sound")

	547b02f74e4ac1e7d295a6266d5bc93a647cd4ac
	("ASoC: rsnd: enable multi Component support for Audio Graph Card/Card2")

	45655ec69cb954d7fa594054bec33d6d5b99f8d5
	("ASoC: soc-core.c: enable multi Component")

My board is handling above sample as 2 cards, by using "multi Component"

	BASE			  PLUGIN
	+-----------------+			^
	| CPU0 <-> Codec0 |			| Card1
	|		  |			v
	|		  |     +--------+	^
	| CPU1		  | <-> | Codec1 |	| Card2
	| CPU2		  | <-> | Codec2 |	|
	+-----------------+     +--------+	v

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#8 lore raw
Quoted 27 lines · Kuninori Morimoto

Hi Mihalcea

Thank you for clarify details.

Quoted 9 lines

[snippet from base.dts]

	my_card: card {
		compatible = "audio-graph-card2";
		links = <&l2>; /* here, we're only allowed to specify links that exist */
		routing = "Headphones", "C20",
			  "Headphones", "C21",
			  "Line", "C01";
	};

(snip)

Quoted 7 lines
&my_card {
	/* here we're forced to also specify l2 even if this is already done
         * in base.dts. This is because DT overlays don't support appending to
	 * properties.
         */
	remote-endpoint = <&l0>, <&l1>, <&l2>;
};

This is very nit pickking, but I need to confirm.
You want to indicate here is this ?

	&my_card {
(quoted diff) +1 -1
-		remote-endpoint = <&l0>, <&l1>, <&l2>;
+		links = <&l0>, <&l1>, <&l2>;
Quoted 1 line
	};

yes, I'm very sorry for the mistakes....

Quoted 30 lines
Quoted 9 lines
&l0_ep {
	remote-endpoint = <&c1_ep>;
};
&l1_ep {
	remote-endpoint = <&c2_ep>;
};
Quoted 7 lines
c0: codec@0 {
	port { c0_ep: endpoint { remote-endpoint = <&l0_ep>; } };
};
c1: codec@1 {
	port { c1_ep: endpoint { remote-endpoint = <&l1_ep>; } };
};

This is also nit pickking, but I think above is wrong. I guess you want to indicate is...

	&l0_ep {
(quoted diff) +1 -1
-		remote-endpoint = <&c1_ep>;
+		remote-endpoint = <&c0_ep>;
	};

	&l1_ep {
(quoted diff) +1 -1
-		remote-endpoint = <&c2_ep>;
+		remote-endpoint = <&c1_ep>;
	};
Quoted 2 lines

Your are indicating very confusable naming, so I want to understand correctly as much as possible.

yep, you're right. Again, very sorry.

Quoted 44 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

CODEC A has widgets A0, A1.
CODEC B has widgets B0, B1.

my-card {
compatible = "audio-graph-card2":
label = "my-label";
links = <&cpu0_port>, <&cpu1_port>; routing = "A0", "A1",
"B0", "B1";
};

CODEC A's DT node was disabled.
CODEC B's DT node is enabled.
CPU0's DT node is enabled.
CPU1's DT node is enabled.

(snip)

Quoted 19 lines

Assume that we also have BASE1 that is compatible with PLUGIN but C0 and C1 are connected to BASE1's D0 and D5. Since there's no D1-C1 connection that means you'll have to create another DT overlay. Thus, the scalability of plugin.dtso decreases.

Now, for our particular case, we have BASE0 and BASE1 with the following DAIs and CODECS (these are physically present on the base boards):

BASE0 has DAIs D0, D1 and CODEC C0
BASE1 has DAIs D0, D1 and CODEC C1

Both of these boards are compatible with plugin PLUGIN that has codec C2. The possible DAI links are:

For BASE0:

D0 <----> C0
D1 <----> C2 (only possible with PLUGIN connected)

Quoted 8 lines

For BASE1:

D0 <----> C1
D1 <----> C2 (only possible with PLUGIN connected)

Since the D1 <---> C2 connection is valid for both BASE0-PLUGIN and BASE1-PLUGIN combinations I think we can make do without the support for explicitly disabled links. But I don't think this is ideal because:

Quoted 6 lines

Let's avoid BASE3 case here to avoid _if_ story.
You are now indicating too many complex/cofusable situations with wrong setting samples (D0/D1/D2..., C0/C1/C2. BASEx has no D1-C1..., etc, etc...)

I noticed that why you need to add disabled Codec routing on BASE DT ? It is the reason why you can't detect BASE only sound card, right ?

exactly!!!

Quoted 18 lines
	---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

[snippet from base.dts]

	my_card: card {
		compatible = "audio-graph-card2";
		links = <&l2>; /* here, we're only allowed to specify links that exist */
		routing = "Headphones", "C20",
			  "Headphones", "C21",
=>			  "Line", "C01";
	};

	---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

If my understanding was correct, your system can be indicated like below (It is not same as your D0/D1/D2 sample, but I think same things, and
not confusable sample)

Quoted 6 lines
	BASE			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	| CPU2		  | <-> | Codec2 |
	+-----------------+     +--------+

pretty much. The only difference would be that PLUGIN has only 1 codec

in our case. I think it'll be much easier to just stick to your naming conventions...

Quoted 14 lines

How it works by below ?

BASE

	/*
	 * detect CPU0-Codec0 connection only
	 * Codec1/2 are disabled, but not related to BASE
	 */
	my_card: card {
		links = <&cpu0>;
		routing = "Headphone0", "Codec0"; /* for CPU0-Codec0 */
	};

PLUGIN

Quoted 10 lines
	/* detect all
	 * CPU0-Codec0 connection
	 * CPU1-Codec1 connection
	 * CPU2-Codec2 connection, and its routings */
	&my_card {
		links = <&cpu0>, <&cpu1>, <&cpu2>;
		routing = "Headphone0", "Codec0", /* for CPU0-Codec0 */
			  "Headphone1", "Codec1", /* for CPU1-Codec1 */
			  "Headphone2", "Codec2"; /* for CPU2-Codec2 */
	};

so, the problem with this is the fact that (assuming you've used a DT overlay

for the PLUGIN) you won't be able to use the DT overlay on other boards because

you've also added the "Headphone0", "Codec0" route which is specific to BASE's

Codec0. We have multiple boards so our system would look like this:

	BASE0			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+


	BASE1			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec3 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+

The plugin is the same. The only difference between BASE1 and BASE0 is the fact that CPU0

is connected to Codec0 on BASE0, while, on BASE1, CPU0 is connected to a different codec: Codec3.

Quoted 16 lines

And/Or your situation is similar as mine (I should have noticed about this sooner).

	d70be079c3cf34bd91e1c8f7b4bc760356c9150c
	("arm64: dts: renesas: ulcb/kf: Use multi Component sound")

	547b02f74e4ac1e7d295a6266d5bc93a647cd4ac
	("ASoC: rsnd: enable multi Component support for Audio Graph Card/Card2")

	45655ec69cb954d7fa594054bec33d6d5b99f8d5
	("ASoC: soc-core.c: enable multi Component")

My board is handling above sample as 2 cards, by using "multi Component"

Quoted 8 lines
	BASE			  PLUGIN
	+-----------------+			^
	| CPU0 <-> Codec0 |			| Card1
	|		  |			v
	|		  |     +--------+	^
	| CPU1		  | <-> | Codec1 |	| Card2
	| CPU2		  | <-> | Codec2 |	|
	+-----------------+     +--------+	v

one important thing to note here is the fact that we can only

have 1 sound card because all DAIs (CPU0, CPU1, CPU2) belong

to the same component.

Quoted 7 lines

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#9 lore raw

Hi Laurentiu

Quoted 19 lines

so, the problem with this is the fact that (assuming you've used a DT overlay for the PLUGIN) you won't be able to use the DT overlay on other boards because you've also added the "Headphone0", "Codec0" route which is specific to BASE's Codec0. We have multiple boards so our system would look like this:

	BASE0			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+


	BASE1			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec3 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+
Quoted 2 lines

The plugin is the same. The only difference between BASE1 and BASE0 is the fact that CPU0 is connected to Codec0 on BASE0, while, on BASE1, CPU0 is connected to a different codec: Codec3.

Ah, OK, that it the reason why you added the route on BASE side...

Hmm... I think my previous suggested idea (new flag) is reasonable, but you mentioned that you want to check whether it was "disabled" or not. So, how about to add "plugin-route" and "plugin-links" instead ?

BASE

	my_card: card {
		links = <&cpu0>;
		routing = "Headphone0", "Codec0"; /* for CPU0-Codec0 */
	};

PLUGIN

	&my_card {
		plugin-links = <&cpu1>, <&cpu2>
		plugin-routing = "Headphone1", "Codec1", /* for CPU1-Codec1 */
		^^^^^^		 "Headphone2", "Codec2"; /* for CPU2-Codec2 */
	};

Audio Card2 parses "links" + "plugin-links", and "routing" + "plugin-routing". It is more intuitive ?

Quoted 9 lines
Quoted 8 lines
	BASE			  PLUGIN
	+-----------------+			^
	| CPU0 <-> Codec0 |			| Card1
	|		  |			v
	|		  |     +--------+	^
	| CPU1		  | <-> | Codec1 |	| Card2
	| CPU2		  | <-> | Codec2 |	|
	+-----------------+     +--------+	v
Quoted 3 lines

one important thing to note here is the fact that we can only have 1 sound card because all DAIs (CPU0, CPU1, CPU2) belong to the same component.

Indeed it depens on the CPU side driver style.
I have updated my driver to allow to be multi components by checking DT.

I'm not sure which one (= use plugin-xxx flag or use multi Cards) is more intuitive, but supporting both is not bad idea ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#10 lore raw
Quoted 21 lines · Kuninori Morimoto

Hi Laurentiu

Quoted 19 lines

so, the problem with this is the fact that (assuming you've used a DT overlay for the PLUGIN) you won't be able to use the DT overlay on other boards because you've also added the "Headphone0", "Codec0" route which is specific to BASE's Codec0. We have multiple boards so our system would look like this:

	BASE0			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+


	BASE1			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec3 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+
Quoted 3 lines
Quoted 2 lines

The plugin is the same. The only difference between BASE1 and BASE0 is the fact that CPU0 is connected to Codec0 on BASE0, while, on BASE1, CPU0 is connected to a different codec: Codec3.

Ah, OK, that it the reason why you added the route on BASE side...

exactly!

Quoted 12 lines

Hmm... I think my previous suggested idea (new flag) is reasonable, but you mentioned that you want to check whether it was "disabled" or not. So, how about to add "plugin-route" and "plugin-links" instead ?

BASE

	my_card: card {
		links = <&cpu0>;
		routing = "Headphone0", "Codec0"; /* for CPU0-Codec0 */
	};

PLUGIN

Quoted 8 lines
	&my_card {
		plugin-links = <&cpu1>, <&cpu2>
		plugin-routing = "Headphone1", "Codec1", /* for CPU1-Codec1 */
		^^^^^^		 "Headphone2", "Codec2"; /* for CPU2-Codec2 */
	};

Audio Card2 parses "links" + "plugin-links", and "routing" + "plugin-routing". It is more intuitive ?

hm, I believe this _should_ work. I also think that we can just drop the whole

"ignore_route_check" flag idea since you can just use "plugin-routing" in

your DT overlay to specify the CODEC-specific routes (instead of having

them in your BASE DTS). This way, you'll avoid having routes that might

not exist in your BASE DTS.

if we go for this though I think we need to clarify the usage of the

"plugin-links" and "plugin-routing" properties. For me, these properties

only make sense if you use them in a DT overlay to add additional links/routes

introduced by the PLUGIN board. This is basically a workaround the fact

that DT overlays don't support appending to the properties of the BASE

DTS.

also, I believe we can drop the whole "explicitly disabled links" idea

since IMO, links passed via the "plugin-links" property _must_ exist.

anyhow, I will have test out this new idea on our particular scenario and see

how well it works. Thank you very much for this discussion! It was really, really

helpful!

Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
	BASE			  PLUGIN
	+-----------------+			^
	| CPU0 <-> Codec0 |			| Card1
	|		  |			v
	|		  |     +--------+	^
	| CPU1		  | <-> | Codec1 |	| Card2
	| CPU2		  | <-> | Codec2 |	|
	+-----------------+     +--------+	v
Quoted 3 lines

one important thing to note here is the fact that we can only have 1 sound card because all DAIs (CPU0, CPU1, CPU2) belong to the same component.

Indeed it depens on the CPU side driver style.
I have updated my driver to allow to be multi components by checking DT.

I'm not sure which one (= use plugin-xxx flag or use multi Cards) is more intuitive, but supporting both is not bad idea ?

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#11 lore raw

Hi Mihalcea

Thank you for rhw the reply

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
	BASE0			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec0 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+


	BASE1			  PLUGIN
	+-----------------+
	| CPU0 <-> Codec3 |     +--------+
	| CPU1		  | <-> | Codec1 |
	+-----------------+     +--------+

(snip)

Quoted 12 lines
Quoted 12 lines

BASE

	my_card: card {
		links = <&cpu0>;
		routing = "Headphone0", "Codec0"; /* for CPU0-Codec0 */
	};

PLUGIN

	&my_card {
		plugin-links = <&cpu1>, <&cpu2>
		plugin-routing = "Headphone1", "Codec1", /* for CPU1-Codec1 */
		^^^^^^		 "Headphone2", "Codec2"; /* for CPU2-Codec2 */
	};

(snip)

Quoted 1 line

hm, I believe this _should_ work.

I hope so.

Quoted 2 lines

I also think that we can just drop the whole
"ignore_route_check" flag idea

(snip)

Quoted 2 lines

also, I believe we can drop the whole "explicitly disabled links" idea since IMO, links passed via the "plugin-links" property _must_ exist.

Yes, agree. It is no longer needed on new plugin-xxx idea.

Quoted 2 lines

if we go for this though I think we need to clarify the usage of the "plugin-links" and "plugin-routing" properties.

Yes. I think you need to confirm or persuade to DT maintainer that whether it can be accepted idea or not.

Quoted 2 lines

Thank you very much for this discussion! It was really, really helpful!

Same here. I'm very happy could do that

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#12 lore raw

RFC PATCH 3/3 ASoC: generic: add more sample DTSIs for audio-graph-card2

In reply to Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

Add some more audio-graph-card2 sample DTSIs meant to aid in testing the driver's capability to parse explicitly disabled links. To conclude that the feature works correctly, all audio-graph-card2 samples need to work as expected. This includes the custom ones:

1) audio-graph-card2-custom-sample1.dtsi
2) audio-graph-card2-custom-sample2.dtsi

---
 .../generic/audio-graph-card2-sample1.dtsi    | 278 ++++++
 .../generic/audio-graph-card2-sample2.dtsi    | 878 ++++++++++++++++++
 .../generic/audio-graph-card2-sample3.dtsi    | 486 ++++++++++
 3 files changed, 1642 insertions(+)
 create mode 100644 sound/soc/generic/audio-graph-card2-sample1.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2-sample2.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2-sample3.dtsi
sound/soc/generic/audio-graph-card2-sample1.dtsi new file +278 -0
new file mode 100644
index 000000000000..ce0098a160a6
@@ -0,0 +1,278 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2025 NXP
+ *
+ * audio-graph-card2 simple link test scenarios
+ *
+ * IMPORTANT:
+ *
+ *	1) DO NOT use this alongside the other test scenarios as the
+ *	node names are not unique across test DTSIs.
+ */
+
+/ {
+	/*
+	 * Testcase 00
+	 *
+	 * DESCRIPTION: test simple CPU-CODEC with no routing specified. Each
+	 * endpoint device has only one available port.
+	 *
+	 * TOPOLOGY:
+	 *
+	 *	CPU0 <---@----> CODEC0
+	 *	CPU1 <---@----> CODEC1
+	 *	CPU2 <---@----> CODEC2
+	 *
+	 *	CPU0 => ENABLED
+	 *	CPU1 => DISABLED
+	 *	CPU2 => ENABLED
+	 *	CODEC0 => ENABLED
+	 *	CODEC1 => ENABLED
+	 *	CODEC2 => DISABLED
+	 *
+	 * RESULT:
+	 *	- sound card creation should succeed with 2 explicitly disabled links.
+	 */
+	test-case-00 {
+		compatible = "audio-graph-card2";
+		label = "test-case-00";
+		links = <&simple_cpu0_port>,
+			<&simple_cpu1_port>,
+			<&simple_cpu2_port>;
+	};
+
+	test-cpu0 {
+		compatible = "test-cpu";
+
+		simple_cpu0_port: port {
+			biclock-master;
+			frame-master;
+
+			test_cpu_0_ep: endpoint {
+				remote-endpoint = <&test_codec_0_ep>;
+			};
+		};
+	};
+
+	test-cpu1 {
+		compatible = "test-cpu";
+		status = "disabled";
+
+		simple_cpu1_port: port {
+			biclock-master;
+			frame-master;
+
+			test_cpu_1_ep: endpoint {
+				remote-endpoint = <&test_codec_1_ep>;
+			};
+		};
+	};
+
+	test-cpu2 {
+		compatible = "test-cpu";
+
+		simple_cpu2_port: port {
+			bitclock-master;
+			frame-master;
+
+			test_cpu_2_ep: endpoint {
+				remote-endpoint = <&test_codec_2_ep>;
+			};
+		};
+	};
+
+	test-codec0 {
+		compatible = "test-codec";
+
+		port {
+			test_codec_0_ep: endpoint {
+				remote-endpoint = <&test_cpu_0_ep>;
+			};
+		};
+	};
+
+	test-codec1 {
+		compatible = "test-codec";
+
+		port {
+			test_codec_1_ep: endpoint {
+				remote-endpoint = <&test_cpu_1_ep>;
+			};
+		};
+	};
+
+	test-codec2 {
+		compatible = "test-codec";
+		status = "disabled";
+
+		port {
+			test_codec_2_ep: endpoint {
+				remote-endpoint = <&test_cpu_2_ep>;
+			};
+		};
+	};
+
+	/*
+	 * Testcase 01
+	 *
+	 * DESCRIPTION: test simple CPU-CODEC with no routing specified. Each
+	 * endpoint device has one or more available ports.
+	 *
+	 * TOPOLOGY:
+	 *
+	 *	CPU3/P0 <---@----> CODEC3
+	 *	CPU3/P1 <---@----> CODEC4
+	 *	CPU4    <---@----> CODEC5/P0
+	 *	CPU3/P2 <---@----> CODEC5/P1
+	 *
+	 *	CPU3 => ENABLED
+	 *	CPU4 => DISABLED
+	 *	CODEC3 => ENABLED
+	 *	CODEC4 => DISABLED
+	 *
+	 * RESULT:
+	 *	- sound card creation should succeed with 2 explicitly disabled links
+	 */
+	test-case-01 {
+		compatible = "audio-graph-card2";
+		label = "test-case-01";
+		links = <&test_cpu3_port0>,
+			<&test_cpu3_port1>,
+			<&test_cpu4_port>,
+			<&test_cpu3_port2>;
+	};
+
+	test-cpu3 {
+		compatible = "test-cpu";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			test_cpu3_port0: port@0 {
+				reg = <0>;
+
+				test_cpu3_p0_ep: endpoint {
+					remote-endpoint = <&test_codec3_ep>;
+				};
+			};
+
+			test_cpu3_port1: port@1 {
+				reg = <1>;
+
+				test_cpu3_p1_ep: endpoint {
+					remote-endpoint = <&test_codec4_ep>;
+				};
+			};
+
+			test_cpu3_port2: port@2 {
+				reg = <2>;
+
+				test_cpu3_p2_ep: endpoint {
+					remote-endpoint = <&test_codec5_p1_ep>;
+				};
+			};
+		};
+	};
+
+	test-cpu4 {
+		compatible = "test-cpu";
+		status = "disabled";
+
+		test_cpu4_port: port {
+			test_cpu4_ep: endpoint {
+				remote-endpoint = <&test_codec5_p0_ep>;
+			};
+		};
+	};
+
+	test-codec3 {
+		compatible = "test-codec";
+
+		port {
+			test_codec3_ep: endpoint {
+				remote-endpoint = <&test_cpu3_p0_ep>;
+			};
+		};
+	};
+
+	test-codec4 {
+		compatible = "test-codec";
+		status = "disabled";
+
+		port {
+			test_codec4_ep: endpoint {
+				remote-endpoint = <&test_cpu3_p1_ep>;
+			};
+		};
+	};
+
+	test-codec5 {
+		compatible = "test-codec";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			test_codec5_port0: port@0 {
+				reg = <0>;
+
+				test_codec5_p0_ep: endpoint {
+					remote-endpoint = <&test_cpu4_ep>;
+				};
+			};
+
+			test_codec5_port1: port@1 {
+				reg = <1>;
+
+				test_codec5_p1_ep: endpoint {
+					remote-endpoint = <&test_cpu3_p2_ep>;
+				};
+			};
+		};
+	};
+
+	/*
+	 * Testcase 02
+	 *
+	 * DESCRIPTION: test simple CPU-CODEC with no routing specified. The
+	 * CPU-CODEC link is disabled.
+	 *
+	 * TOPOLOGY:
+	 *
+	 *	CPU5 <---@-----> CODEC6
+	 *
+	 *	CPU5 => DISABLED
+	 *	CODEC6 => ENABLED
+	 *
+	 * RESULT:
+	 *	- sound card creation should fail since all of its links are
+	 *	explicitly disabled.
+	 */
+	test-case-02 {
+		compatible = "audio-graph-card2";
+		label = "test-case-02";
+		links = <&test_cpu5_port>;
+	};
+
+	test-cpu5 {
+		compatible = "test-cpu";
+		status = "disabled";
+
+		test_cpu5_port: port {
+			test_cpu5_port_ep: endpoint {
+				remote-endpoint = <&test_codec6_port_ep>;
+			};
+		};
+	};
+
+	test-codec6 {
+		compatible = "test-codec";
+
+		port {
+			test_codec6_port_ep: endpoint {
+				remote-endpoint = <&test_cpu5_port_ep>;
+			};
+		};
+	};
+};
sound/soc/generic/audio-graph-card2-sample2.dtsi new file +878 -0

878 lines not on this page · raw message

sound/soc/generic/audio-graph-card2-sample3.dtsi new file +486 -0

486 lines not on this page · raw message

Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH RFC 3/3] ASoC: generic: add more sample DTSIs for audio-graph-card2

Hi Laurentiu

Thank you for caring sample dtsi

Quoted 5 lines

Add some more audio-graph-card2 sample DTSIs meant to aid in testing the driver's capability to parse explicitly disabled links. To conclude that the feature works correctly, all audio-graph-card2 samples need to work as expected. This includes the custom ones:

Quoted 8 lines

1) audio-graph-card2-custom-sample1.dtsi
2) audio-graph-card2-custom-sample2.dtsi

---
 .../generic/audio-graph-card2-sample1.dtsi    | 278 ++++++
 .../generic/audio-graph-card2-sample2.dtsi    | 878 ++++++++++++++++++
 .../generic/audio-graph-card2-sample3.dtsi    | 486 ++++++++++

This is not a "audio graph card2 sample", but a "disable_of_route_checks" sample, I think.

I wonder can we re-use existing sample dtsi, like below ??

	/*
	 * Sample of disable_of_route_checks
	 */
	#include "..../audio-graph-card2-custom-sample1.dtsi"
	
	&audio-graph-card2-custom-sample-1 {
		force_detect_xxx;
	};

	&test_codec_1 {
		status = "disabled";
	};

Indeed current existing sample is using single Codec or CPU which have many DAIs. So can't enable/disable each detail DAIs, like your patch did. If it was not good for you, may be we can separate ?

	test_codec_1 {
		...
-		port@X { ... };
-		port@Y { ... };
	}

	test_codec_2 {
		...
+		port@X { ... };
+		port@Y { ... };
	}
&test_codec_2 {
	status = "disabled";
};

Thank you for your help !!

Best regards
---
Kuninori Morimoto