[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250515153128.147457-1-laurentiumihalcea111@gmail.com>
Date: Thu, 15 May 2025 11:31:25 -0400
From: Laurentiu Mihalcea <laurentiumihalcea111@...il.com>
To: Mark Brown <broonie@...nel.org>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>
Cc: linux-kernel@...r.kernel.org,
linux-sound@...r.kernel.org
Subject: [PATCH RFC 0/3] ASoC: audio-graph-card2: support explicitly disabled links
From: Laurentiu Mihalcea <laurentiu.mihalcea@....com>
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
--
2.34.1
Powered by blists - more mailing lists