From: "Michał Kopeć" <michal@nozomi.space>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: "Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Alexandre Mergnat" <amergnat@baylibre.com>,
"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
"Trevor Wu" <trevor.wu@mediatek.com>,
linux-sound@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Michał Kopeć" <michal@nozomi.space>
Subject: [PATCH 1/4] ASoC: mediatek: common: Keep codec references until the card is bound
Date: Sat, 3 Oct 2026 21:44:58 +0200 [thread overview]
Message-ID: <20261003194501.832558-2-michal@nozomi.space> (raw)
In-Reply-To: <20261003194501.832558-1-michal@nozomi.space>
mtk_soundcard_common_probe() drops the codec references parsed from the
devicetree right after devm_snd_soc_register_card() returns. When a
component is still missing, snd_soc_bind_card() queues the card for a
later rebind and registration still returns success, so the card is not
instantiated yet. The rebind reuses the same dai_link array, but with the
codec references released both the codec name and of_node are unset, so
it fails the dai link sanity check and the sound card never appears.
Release the references right away only when the card was instantiated
or registration failed. Otherwise keep them for the rebind and release
them when the device is unbound.
Fixes: bce93a162505 ("ASoC: mediatek: Add common machine soundcard driver probe mechanism")
Signed-off-by: Michał Kopeć <michal@nozomi.space>
---
.../mediatek/common/mtk-soundcard-driver.c | 23 +++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c b/sound/soc/mediatek/common/mtk-soundcard-driver.c
index 2d39ff23f8540..4bb98412feb11 100644
--- a/sound/soc/mediatek/common/mtk-soundcard-driver.c
+++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c
@@ -129,6 +129,11 @@ void clean_card_reference(struct snd_soc_card *card)
}
EXPORT_SYMBOL_GPL(clean_card_reference);
+static void mtk_soundcard_put_card_reference(void *data)
+{
+ clean_card_reference(data);
+}
+
int mtk_soundcard_startup(struct snd_pcm_substream *substream,
enum mtk_pcm_constraint_type ctype)
{
@@ -325,8 +330,22 @@ int mtk_soundcard_common_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (!needs_legacy_probe)
- clean_card_reference(card);
+ /*
+ * When a component is still missing, snd_soc_bind_card() queues the
+ * card for a later rebind and returns success, so the card is not
+ * instantiated yet. That rebind reuses this same dai_link array, so
+ * the codec references parsed from the devicetree must be kept until
+ * the device is unbound: dropping them leaves both name and of_node
+ * unset and the rebind fails the dai link sanity check instead.
+ */
+ if (!needs_legacy_probe) {
+ if (ret || snd_soc_card_is_instantiated(card))
+ clean_card_reference(card);
+ else
+ ret = devm_add_action_or_reset(&pdev->dev,
+ mtk_soundcard_put_card_reference,
+ card);
+ }
if (ret) {
dev_err_probe(&pdev->dev, ret, "Cannot register card\n");
--
2.55.0
next prev parent reply other threads:[~2026-10-03 19:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 19:44 [PATCH 0/4] ASoC: Fixes for the MT8188 sound card Michał Kopeć
2026-10-03 19:44 ` Michał Kopeć [this message]
2026-10-03 19:44 ` [PATCH 2/4] ASoC: mediatek: Don't keep a freed topology name in the static card Michał Kopeć
2026-10-08 8:20 ` Mark Brown
2026-10-03 19:45 ` [PATCH 3/4] ASoC: mediatek: mt8188: Constrain UL8 FE to its back end's capabilities Michał Kopeć
2026-10-03 19:45 ` [PATCH 4/4] ASoC: hdmi-codec: Don't parse an empty ELD on startup Michał Kopeć
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=20261003194501.832558-2-michal@nozomi.space \
--to=michal@nozomi.space \
--cc=amergnat@baylibre.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=tiwai@suse.com \
--cc=trevor.wu@mediatek.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