Re: [PATCH 2/6] ASoC: es8316: Get sysclk rate from MCLK clock when not explicitly set
From: Mark Brown
Date: Fri Mar 13 2026 - 11:35:59 EST
On Thu, Mar 05, 2026 at 01:47:43PM +0800, Hongyang Zhao wrote:
> @@ -477,9 +477,20 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
> u8 bclk_divider;
> u16 lrck_divider;
> int i;
> - unsigned int clk = es8316->sysclk / 2;
> + unsigned int clk;
> bool clk_valid = false;
>
> + if (es8316->sysclk == 0 && es8316->mclk) {
> + /* If the sysclk has not been set, try to get it from the MCLK */
> + es8316->sysclk = clk_get_rate(es8316->mclk);
> + if (es8316->sysclk == 0) {
> + dev_err(component->dev, "unable to get mclk rate\n");
> + return -EINVAL;
> + }
It would be better to do this by bootstrapping es8316->sysclk when we
get the clock, we do a clk_set_rate() when we set the sysclk so the two
should be in sync for robust operation.
Attachment:
signature.asc
Description: PGP signature