mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] ASoC: codecs: da7213: Get MCLK in I2C probe
@ 2026-10-14  6:53 Le Qi
  2026-10-14 13:57 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Le Qi @ 2026-10-14  6:53 UTC (permalink / raw)
  To: Support Opensource, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Cezary Rojewski
  Cc: linux-sound, linux-kernel, kernel, srinivas.kandagatla, Le Qi

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-15 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14  6:53 [PATCH v1] ASoC: codecs: da7213: Get MCLK in I2C probe Le Qi
2026-10-14 13:57 ` Mark Brown

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®