Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796130745; b=OWD+PvPJS4hazG/KksyR/bWwcTcynuPwtBHIEq5WTpLfgO222L/XTW7zraKrH9AnF/4M gpzbB2hV1Y53TsEbLV3mV05CnueP5GSvdBudwzu5Ox/86NDPks/pb9HBYXHfsNo4j/LF4 x0EcEq1giFOUrQvZkDEPmxRzLuPrdMuTiG6nOCqpPwn1ucd9hPe6sKhJeZad9Bz4lNb/l hTiELGzsx2zNRNEDqcMup8bUx2BQ6R+NH23bsvAFfhP0IoGYtByA29DwLGMYJBdzaIDTU 6rV5QSJ5nfYbozhk6ARTHCQcQ0jJJa5DZE7ikWLKJ0EkwsaC1kp3DdQT+OKchDn50LA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796130745; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Type; bh=xb8u/8DKjBCJuEeGUaXs55m/dcjjExtD1L/Nnhsiekk=; b=lfc+D52nNzJqqgIbwwuXDj7HzIvNstTADQzU8WEX0AsuWHk7C6GpC3lz6gUzDK5LZWPr jB0TNr+RA6nMn1KAZ+qrpYAF+Nm43H75kDMzqJXIaJf1KeW2vEhegHkKr3Qw7mT4xsBMN U6pao3Yf6EIRLbJvYDtGd7yAdOwYXQduaTUglALjh3OOe/70QeCGukKomMTvUf/2DYXCf LDqc2C+vKPm3mefIpP45lYxCV6vw4iiWxAap1v7Il96AwKvEdWyRZRhsdP6ev0ADQ+vu0 LSMwhLbQ9tKvOaGoIJJ79ri2rPIt1in79+0TmGdc1OO4KGrF4hoLMNbLyuTN6Y1gCnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arduino.cc; spf=pass smtp.mailfrom=arduino.cc; dkim=pass header.d=arduino.cc header.i=@arduino.cc header.a=rsa-sha256 header.s=google header.b=dvcABgWx; arc=none smtp.remote-ip=209.85.221.42 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A575C606A331 for ; Tue, 1 Dec 2026 13:12:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A575C606A331 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=arduino.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arduino.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arduino.cc header.i=@arduino.cc header.a=rsa-sha256 header.s=google header.b=dvcABgWx Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-4a358881793so6267001f8f.0 for ; Tue, 01 Dec 2026 05:12:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arduino.cc; s=google; t=1796130743; x=1796735543; darn=vger.kernel.org; h=content-type:mime-version:references:in-reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=xb8u/8DKjBCJuEeGUaXs55m/dcjjExtD1L/Nnhsiekk=; b=dvcABgWxIhMbFO5JEJ7+SsN6STXRsYhnOqYfK2m+KejxlZAsn6XzeWNTIEoU//ClDj azizWFVvipjXgGdzaMTbuvJFkiLSG51JN0BaRPgDjSPNFnDxQ/Q4uxP9I3BQzf5/coGM PaqVKjH5Xm9Wotb1Qu3mYnZGOhvguggVxaV/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796130743; x=1796735543; h=content-type:mime-version:references:in-reply-to:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=xb8u/8DKjBCJuEeGUaXs55m/dcjjExtD1L/Nnhsiekk=; b=1qUbavRLvZCxKGnXzu/SYkwozQSPwhKlrXelHsCeGvmT7lOkn4tKyDJQDyIBG5Ii4v tQo/55gBZFDfyBmIm61pSQfsW0TaiUqq9iE9LaB06tE9Y26jGznckhiMO5nQU71rk7JN EHywFyj98IecdEFbTRb63+PYngHjYWiXUapA69n7zdHgwjwVfg8PkHpQvO996KJ9nb9b OsZWFwLsaVCH2rZVT9Xkpxxh9Ode/Jt27A/5KMlt6hp/AQzUCg9xH4VCod5WH9UHZFfD eSJcmbHoPcBkVJ6L8GzLNrbj0RiVdjUaV9ar97HqfxmQ6NjUy9s4MYAkgxsR/EphtVge 1jnQ== X-Forwarded-Encrypted: i=1; AL+hErFjUBabJfeFyGWTJRKG8D68BAgoexr0/cDz9lcb7Bud5/43QYO0Bg48onnyUGyrVPakenuN3Pkidck6VpFK@vger.kernel.org X-Gm-Message-State: APuU4Z9UoYl3VmywCmTqwP0wM2WH9tV6UgOROXFgJ/0qkEBDXbMdGwyH pFWcPLHWdpOEZy4Nt8oNwLQrxyxuSPj6pKAePFnDX7zlf8/wrYAEpu0cEwa18ivC69XfFvKkXbH 8YNcSpWamKJZP5RtyleYYupPAjtdYt7Ee6q7AAKyPjM5xX0ri8ft89vWoyiLA X-Gm-Gg: AZFdTZdKO1CfKUIkioENzCi+9cmE82pheUtAj+tdeQLtYVz12ybdid/fG4wBDI1ObXa KWpobS5MQi4soEDBE55+bryAOKvJ9udFIk4RRLzUHtSkoQZ+Yr2e7BJShkdOvT5JdstcSgGRTyL 3/bf+4Yk7NwZbsl6BVPJNkOUgojnYVXj8eiC3nmgr4cyv4ziB3W5keyHOKKJzHfFZpiIDy1YfqX 9pSWMP2PZKOhlCpYPTjhxdFgBUrzYaGo1PSojncl3BoBmosBJDmvrqUzURIvsOJU3wpP0GqwXbq coUEObyvoByyKZO9WuJErqMM/8n3UagBBq1ChFNpLy10rlOI9sSQcpHyVqjqBBnk5UrwBA9l6ye CDVCV+6uzmjmNksQ7mwZKkPrckmPdOGsJPUKU2CzrUqFm2muFzQKcbTJ1iKeyulLvQ13B66dZRH 5uuGLlOdGZqMhHizLrCNVDtrpcKqwauhJk1wjt55M6mR/MOU9TyGKYb3HlS1dXwpQQz+GpVqmNv NpVDRAy73+c9n2OMxJMKoKr/lPXMWB5brFDI6U4azmltgmOAitrMiiXcC6U6kNfIAF6gnEIKipx DIU0asU/y5EJSshUImjxKD6ARyUKx+30HWumn0EwfVYQtZwrFBlWQwCflCVPJA== X-Received: by 2002:a05:6000:4812:b0:4aa:8da8:4bbc with SMTP id ffacd0b85a97d-4abb5702827mr66058550f8f.36.1796130743088; Tue, 01 Dec 2026 05:12:23 -0800 (PST) Received: from riccardo-work (public.toolboxoffice.it. [213.215.163.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6c61e53asm77939587f8f.59.2026.12.01.05.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 05:12:22 -0800 (PST) From: Riccardo Mereu To: Srinivas Kandagatla , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai 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 , Riccardo Mereu Subject: [PATCH 1/6] ASoC: qcom: common: setup fe dais before be dais Date: Tue, 1 Dec 2026 14:12:04 +0100 Message-ID: <20261201131212.161224-2-r.mereu.kernel@arduino.cc> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201131212.161224-1-r.mereu.kernel@arduino.cc> References: <20261201131212.161224-1-r.mereu.kernel@arduino.cc> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" From: Srinivas Kandagatla 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 Signed-off-by: Riccardo Mereu --- 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.