Re: [PATCH] arm64: dts: qcom: arduino-imola: probe the sound frontends first

From: Igor Opaniuk

Date: Sun Nov 22 2026 - 09:58:50 EST


Hi Srini,

On Mon, Nov 16, 2026 at 3:26 PM Srinivas Kandagatla
<srinivas.kandagatla@xxxxxxxxxxxxxxxx> wrote:
>
> On 11/14/26 12:57 PM, Igor Opaniuk wrote:
> > The card probes its components in DAI link order. With the codec DMA
> > backends listed first, q6routing is probed before q6asm-dai, so its
> > routes from the MM_DL and MM_UL widgets (created by q6asm-dai) cannot
> > be added, the component probe fails and the card is not registered:
> >
> > q6routing ...: ASoC: Failed to add route MM_DL1(*) -> [MultiMedia1] -> HDMI Mixer
> > ...
> > snd-sm8250 sound: ASoC: failed to instantiate card -19
> >
> > List the MultiMedia frontend links first, as the other qcom sound card
> > device trees (RB5, RB2) do.
> >
> > Tested on the Arduino UNO Q: the card registers and a tone plays on
> > the headphone path (all 11 DAPM widgets powered).
> >
> > Fixes: 61a95870e0f3 ("arm64: dts: qcom: arduino-imola: add support for sound")
> > Signed-off-by: Igor Opaniuk <igor.opaniuk@xxxxxxxxxxxxxxxx>
> > ---
> > The UNO Q sound card from 61a95870e0f3 does not register as merged in
> > arm64-for-7.5 (snd-sm8250 "failed to instantiate card -19"); with the
> > MultiMedia links first it does.
> >
> > The DTB differs from the current one only in the order of the dai-link
> > nodes (and the phandle numbering that follows from it); dtbs_check is
> > clean before and after.
> > ---
>
> Thanks Igor for the patch, but this is just start of the problem, Once
> we apply overlays the nodes will be sorted once again and we are going
> to hit the same issue.
>
> can you please try this patch:

I've tested your patch on the Arduino UNO Q with the UNO Media Carrier and
headphones on the jack, and confirm that it works.

Please feel free to reject/drop my patch.

Thanks,
Igor
>
> ------------------------>cut<-----------------------------
> From f9c336d90f1689c02ecd751c40e3f37379b6a690 Mon Sep 17 00:00:00 2001
> From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxxxxxxxx>
> Date: Tue, 22 Sep 2026 22:21:22 +0100
> Subject: [PATCH] ASoC: qcom: common: setup fe dais before be dais
>
> 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@xxxxxxxxxxxxxxxx>
> ---
> 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 83b745f617a8..4e0541c3db42 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_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL);
> + 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_kcalloc(dev, 2, sizeof(*dlc), GFP_KERNEL);
> - 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.53.0
>
> ------------------------------->cut<--------------------------------
>
>
> > arch/arm64/boot/dts/qcom/qrb2210-arduino-imola.dts | 47 +++++++++++-----------
> > 1 file changed, 24 insertions(+), 23 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/qrb2210-arduino-imola.dts b/arch/arm64/boot/dts/qcom/qrb2210-arduino-imola.dts
> > index e99d2a56dc28..3efd80f36c6c 100644
> > --- a/arch/arm64/boot/dts/qcom/qrb2210-arduino-imola.dts
> > +++ b/arch/arm64/boot/dts/qcom/qrb2210-arduino-imola.dts
> > @@ -117,6 +117,30 @@ sound {
> > "IN2_HPHR", "HPHR_OUT",
> > "AMIC2", "MIC BIAS2";
> >
> > + mm1-dai-link {
> > + link-name = "MultiMedia1";
> > +
> > + cpu {
> > + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
> > + };
> > + };
> > +
> > + mm2-dai-link {
> > + link-name = "MultiMedia2";
> > +
> > + cpu {
> > + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
> > + };
> > + };
> > +
> > + mm3-dai-link {
> > + link-name = "MultiMedia3";
> > +
> > + cpu {
> > + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>;
> > + };
> > + };
> > +
> > ear-playback-dai-link {
> > link-name = "Ear Out Playback";
> >
> > @@ -181,29 +205,6 @@ platform {
> > };
> > };
> >
> > - mm1-dai-link {
> > - link-name = "MultiMedia1";
> > -
> > - cpu {
> > - sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
> > - };
> > - };
> > -
> > - mm2-dai-link {
> > - link-name = "MultiMedia2";
> > -
> > - cpu {
> > - sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
> > - };
> > - };
> > -
> > - mm3-dai-link {
> > - link-name = "MultiMedia3";
> > -
> > - cpu {
> > - sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>;
> > - };
> > - };
> > };
> >
> > vreg_anx_30: regulator-anx-30 {
> >
> > ---
> > base-commit: eac8f0411262ea7d156407da4baf260291cbfe32
> > change-id: 20261114-imola-sound-link-order-15de4692e7ef
> >
> > Best regards,
>