Skip to contentSkip to conversation

ASoC: codecs: da7213: Get MCLK in I2C probe

PATCH In review Le Qi 2 participants 2 messages Oct 14 – Oct 15

Subsystems (3)
lore
Share & tools
lore

Le Qi

author
#0 lore raw

PATCH 1/1 ASoC: codecs: da7213: Get MCLK in I2C probe

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")
---
 sound/soc/codecs/da7213.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
sound/soc/codecs/da7213.c +13 -10
index 923b997efbc4..4990feaa8259 100644
@@ -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);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 1 line · On Wed, 14 Oct 2026 14:53:21 +0800, Le Qi wrote:

ASoC: codecs: da7213: Get MCLK in I2C probe

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4

Thanks!

[1/1] ASoC: codecs: da7213: Get MCLK in I2C probe

      https://git.kernel.org/broonie/sound/c/2923259d08b0

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark