[PATCH v2 2/6] ASoC: es8316: Get sysclk rate from MCLK clock when not explicitly set

From: Hongyang Zhao

Date: Tue Mar 17 2026 - 04:36:37 EST


When the sysclk has not been set via set_sysclk(), try to get the clock
rate from the MCLK clock provider. This is useful when the codec's MCLK
is managed by an external clock controller and the machine driver does
not explicitly call set_sysclk().

Signed-off-by: Hongyang Zhao <hongyang.zhao@xxxxxxxxxxxxxxx>
---
sound/soc/codecs/es8316.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 9245c33700de..3889cb36a654 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -774,6 +774,9 @@ static int es8316_probe(struct snd_soc_component *component)
return ret;
}

+ if (es8316->mclk)
+ es8316->sysclk = clk_get_rate(es8316->mclk);
+
/* Reset codec and enable current state machine */
snd_soc_component_write(component, ES8316_RESET, 0x3f);
usleep_range(5000, 5500);

--
2.43.0