mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Le Qi <le.qi@oss.qualcomm.com>
To: Support Opensource <support.opensource@diasemi.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Cezary Rojewski <cezary.rojewski@intel.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@oss.qualcomm.com, srinivas.kandagatla@oss.qualcomm.com,
	Le Qi <le.qi@oss.qualcomm.com>
Subject: [PATCH v1] ASoC: codecs: da7213: Get MCLK in I2C probe
Date: Wed, 14 Oct 2026 14:53:21 +0800	[thread overview]
Message-ID: <20261014065321.740850-1-le.qi@oss.qualcomm.com> (raw)

With deferrable card binding, a card that fails to bind is retried only
when a new ASoC component is registered. da7213 requests its MCLK in the
component probe callback, so if the clock provider registers late, the
card bind defers and the provider's later registration never triggers
a rebind, leaving the sound card unregistered.

Request MCLK in the I2C probe instead, so a missing clock defers the
codec driver probe through the driver core before the component is
registered.

Fixes: 42d99857d6f0 ("ASoC: core: Move all users to deferrable card binding")
Signed-off-by: Le Qi <le.qi@oss.qualcomm.com>
---
 sound/soc/codecs/da7213.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index 923b997efbc4..4990feaa8259 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -2091,16 +2091,6 @@ static int da7213_probe(struct snd_soc_component *component)
 
 	pm_runtime_put_sync(component->dev);
 
-	/* Check if MCLK provided */
-	da7213->mclk = devm_clk_get_optional(component->dev, "mclk");
-	if (IS_ERR(da7213->mclk))
-		return PTR_ERR(da7213->mclk);
-	if (da7213->mclk)
-		/* Do automatic PLL handling assuming fixed clock until
-		 * set_pll() has been called. This makes the codec usable
-		 * with the simple-audio-card driver. */
-		da7213->fixed_clk_auto_pll = true;
-
 	/* Default infinite tone gen, start/stop by Kcontrol */
 	snd_soc_component_write(component, DA7213_TONE_GEN_CYCLES, DA7213_BEEP_CYCLES_MASK);
 
@@ -2229,6 +2219,19 @@ static int da7213_i2c_probe(struct i2c_client *i2c)
 
 	mutex_init(&da7213->ctrl_lock);
 
+	/* Check if MCLK provided */
+	da7213->mclk = devm_clk_get_optional(&i2c->dev, "mclk");
+	if (IS_ERR(da7213->mclk))
+		return dev_err_probe(&i2c->dev, PTR_ERR(da7213->mclk),
+				      "failed to get mclk\n");
+	if (da7213->mclk)
+		/*
+		 * Do automatic PLL handling assuming fixed clock until
+		 * set_pll() has been called. This makes the codec usable
+		 * with the simple-audio-card driver.
+		 */
+		da7213->fixed_clk_auto_pll = true;
+
 	pm_runtime_set_autosuspend_delay(&i2c->dev, 100);
 	pm_runtime_use_autosuspend(&i2c->dev);
 	pm_runtime_set_active(&i2c->dev);
-- 
2.34.1


             reply	other threads:[~2026-10-14  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  6:53 Le Qi [this message]
2026-10-14 13:57 ` Mark Brown

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=20261014065321.740850-1-le.qi@oss.qualcomm.com \
    --to=le.qi@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --cc=support.opensource@diasemi.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®