From: Riccardo Mereu <r.mereu.kernel@arduino.cc>
To: Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>,
Riccardo Mereu <r.mereu@arduino.cc>
Subject: [PATCH 1/6] ASoC: qcom: common: setup fe dais before be dais
Date: Tue, 1 Dec 2026 14:12:04 +0100 [thread overview]
Message-ID: <20261201131212.161224-2-r.mereu.kernel@arduino.cc> (raw)
In-Reply-To: <20261201131212.161224-1-r.mereu.kernel@arduino.cc>
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
qcom_snd_parse_of() registers DAI links in the devicetree order of
the sound{} child nodes. q6routing wires static routes such as
"MM_DL1" -> "MultiMedia1" -> "HDMI Mixer"
which need the frontend (MultiMediaN) widgets to exist before the
backend widgets that reference them. This is a latent ordering
bug: any devicetree or overlay that lists a backend node before
its matching frontend trips it with
q6routing ...routing: ASoC: Failed to add route MM_DL1(*) -> [MultiMedia1] -> HDMI Mixer
q6routing ...routing: ASoC: Failed to add route MM_DL2(*) -> [MultiMedia2] -> HDMI Mixer
...
and today it is easily triggered just by reordering the sound{}
children, or by an overlay that appends a backend link.
Iterate the children twice, frontends (no codec child) first and
backends (codec child) after, so frontend PCM DAIs are always
registered before the backends. Per-node setup is moved into a
new qcom_snd_setup_dai_link() helper so both passes are identical;
cards where every child has a codec child (non-DPCM) hit only the
second pass and see no change.
Fixes: c25e295cd77b ("ASoC: qcom: Add support to parse common audio device nodes")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Riccardo Mereu <r.mereu@arduino.cc>
---
sound/soc/qcom/common.c | 182 ++++++++++++++++++++++++----------------
1 file changed, 109 insertions(+), 73 deletions(-)
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index af5cacddf67d..372cf5d9813f 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -178,12 +178,104 @@ int qcom_snd_apply_dai_tdm_slots(struct snd_soc_pcm_runtime *rtd)
}
EXPORT_SYMBOL_GPL(qcom_snd_apply_dai_tdm_slots);
+static int qcom_snd_setup_dai_link(struct snd_soc_card *card,
+ struct snd_soc_dai_link *link,
+ struct device_node *np)
+{
+ struct device *dev = card->dev;
+ struct snd_soc_dai_link_component *dlc;
+ struct of_phandle_args args;
+ int ret;
+
+ dlc = devm_kzalloc_objs(dev, *dlc, 2);
+ if (!dlc)
+ return -ENOMEM;
+
+ link->cpus = &dlc[0];
+ link->platforms = &dlc[1];
+
+ link->num_cpus = 1;
+ link->num_platforms = 1;
+
+ ret = of_property_read_string(np, "link-name", &link->name);
+ if (ret) {
+ dev_err(dev, "error getting codec dai_link name\n");
+ return ret;
+ }
+
+ struct device_node *cpu __free(device_node) =
+ of_get_child_by_name(np, "cpu");
+ struct device_node *platform __free(device_node) =
+ of_get_child_by_name(np, "platform");
+ struct device_node *codec __free(device_node) =
+ of_get_child_by_name(np, "codec");
+
+ if (!cpu) {
+ dev_err(dev, "%s: Can't find cpu DT node\n", link->name);
+ return -EINVAL;
+ }
+
+ ret = snd_soc_of_get_dlc(cpu, &args, link->cpus, 0);
+ if (ret) {
+ dev_err_probe(dev, ret,
+ "%s: error getting cpu dai name\n", link->name);
+ return ret;
+ }
+
+ link->id = args.args[0];
+
+ if (link->id >= LPASS_MAX_PORT) {
+ dev_err(dev, "%s: Invalid cpu dai id %d\n", link->name, link->id);
+ return -EINVAL;
+ }
+
+ if (platform) {
+ link->platforms->of_node = of_parse_phandle(platform,
+ "sound-dai",
+ 0);
+ if (!link->platforms->of_node) {
+ dev_err(dev, "%s: platform dai not found\n", link->name);
+ return -EINVAL;
+ }
+ } else {
+ link->platforms->of_node = link->cpus->of_node;
+ }
+
+ if (codec) {
+ ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
+ if (ret < 0) {
+ dev_err_probe(dev, ret,
+ "%s: codec dai not found\n", link->name);
+ return ret;
+ }
+
+ if (platform) {
+ /* DPCM backend */
+ link->no_pcm = 1;
+ link->ignore_pmdown_time = 1;
+ }
+ } else {
+ /* DPCM frontend */
+ link->codecs = &snd_soc_dummy_dlc;
+ link->num_codecs = 1;
+ link->dynamic = 1;
+ }
+
+ if (platform || !codec) {
+ /* DPCM */
+ link->ignore_suspend = 1;
+ link->nonatomic = 1;
+ }
+
+ link->stream_name = link->name;
+
+ return 0;
+}
+
int qcom_snd_parse_of(struct snd_soc_card *card)
{
struct device *dev = card->dev;
struct snd_soc_dai_link *link;
- struct of_phandle_args args;
- struct snd_soc_dai_link_component *dlc;
int ret, num_links;
ret = snd_soc_of_parse_card_name(card, "model");
@@ -233,88 +325,32 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
card->num_links = num_links;
link = card->dai_link;
+ /* Register frontends first so q6routing can resolve BE targets. */
for_each_available_child_of_node_scoped(dev->of_node, np) {
- dlc = devm_kzalloc_objs(dev, *dlc, 2);
- if (!dlc)
- return -ENOMEM;
-
- link->cpus = &dlc[0];
- link->platforms = &dlc[1];
-
- link->num_cpus = 1;
- link->num_platforms = 1;
-
- ret = of_property_read_string(np, "link-name", &link->name);
- if (ret) {
- dev_err(dev, "error getting codec dai_link name\n");
- return ret;
- }
-
- struct device_node *cpu __free(device_node) =
- of_get_child_by_name(np, "cpu");
- struct device_node *platform __free(device_node) =
- of_get_child_by_name(np, "platform");
struct device_node *codec __free(device_node) =
of_get_child_by_name(np, "codec");
- if (!cpu) {
- dev_err(dev, "%s: Can't find cpu DT node\n", link->name);
- return -EINVAL;
- }
+ if (codec)
+ continue;
- ret = snd_soc_of_get_dlc(cpu, &args, link->cpus, 0);
- if (ret) {
- dev_err_probe(dev, ret,
- "%s: error getting cpu dai name\n", link->name);
+ ret = qcom_snd_setup_dai_link(card, link, np);
+ if (ret)
return ret;
- }
- link->id = args.args[0];
-
- if (link->id >= LPASS_MAX_PORT) {
- dev_err(dev, "%s: Invalid cpu dai id %d\n", link->name, link->id);
- return -EINVAL;
- }
-
- if (platform) {
- link->platforms->of_node = of_parse_phandle(platform,
- "sound-dai",
- 0);
- if (!link->platforms->of_node) {
- dev_err(dev, "%s: platform dai not found\n", link->name);
- return -EINVAL;
- }
- } else {
- link->platforms->of_node = link->cpus->of_node;
- }
+ link++;
+ }
- if (codec) {
- ret = snd_soc_of_get_dai_link_codecs(dev, codec, link);
- if (ret < 0) {
- dev_err_probe(dev, ret,
- "%s: codec dai not found\n", link->name);
- return ret;
- }
+ for_each_available_child_of_node_scoped(dev->of_node, np) {
+ struct device_node *codec __free(device_node) =
+ of_get_child_by_name(np, "codec");
- if (platform) {
- /* DPCM backend */
- link->no_pcm = 1;
- link->ignore_pmdown_time = 1;
- }
- } else {
- /* DPCM frontend */
- link->codecs = &snd_soc_dummy_dlc;
- link->num_codecs = 1;
- link->dynamic = 1;
- }
+ if (!codec)
+ continue;
- if (platform || !codec) {
- /* DPCM */
- link->ignore_suspend = 1;
- link->nonatomic = 1;
- }
+ ret = qcom_snd_setup_dai_link(card, link, np);
+ if (ret)
+ return ret;
- link->stream_name = link->name;
link++;
}
--
2.56.1
--
Privacy and Confidentiality Notice: This email and all attachments are
confidential and for the designated recipient(s) only. They may also be
privileged. If you are not the intended recipient or among the intended
recipients, you may not use, read, retransmit, disseminate, store/copy the
information in any medium or take any action in reliance upon it. Please
notify the sender that you have received it in error and immediately delete
the entire communication, including any attachments.
next prev parent reply other threads:[~2026-12-01 13:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 13:12 [PATCH 0/6] arm64: qcom: Arduino UNO Q: DisplayPort audio playback Riccardo Mereu
2026-12-01 13:12 ` Riccardo Mereu [this message]
2026-12-01 13:12 ` [PATCH 2/6] ASoC: codecs: pm4125: add compander channels to the RX channel table Riccardo Mereu
2026-12-01 13:12 ` [PATCH 3/6] ASoC: qcom: sm8250: support 32-bit MI2S slots Riccardo Mereu
2026-12-01 13:12 ` [PATCH 4/6] dt-bindings: display: bridge: analogix,anx7625: add #sound-dai-cells Riccardo Mereu
2026-12-01 13:12 ` [PATCH 5/6] drm/bridge: anx7625: accept 32-bit I2S sample width Riccardo Mereu
2026-12-01 13:12 ` [PATCH 6/6] arm64: dts: qcom: qrb2210-arduino-imola: add DP audio playback Riccardo Mereu
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=20261201131212.161224-2-r.mereu.kernel@arduino.cc \
--to=r.mereu.kernel@arduino.cc \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=r.mereu@arduino.cc \
--cc=srini@kernel.org \
--cc=srinivas.kandagatla@oss.qualcomm.com \
--cc=tiwai@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®