From: Hongyang Zhao <hongyang.zhao@thundersoft.com>
To: broonie@debian.org
Cc: andersson@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, drake@endlessm.com,
hongyang.zhao@thundersoft.com, katsuhiro@katsuster.net,
konradybcio@kernel.org, krzk+dt@kernel.org, lgirdwood@gmail.com,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org, matteomartelli3@gmail.com,
perex@perex.cz, robh@kernel.org, rosh@debian.org,
srini@kernel.org, tiwai@suse.com, zhoubinbin@loongson.cn
Subject: Re: [PATCH 2/6] ASoC: es8316: Get sysclk rate from MCLK clock when not explicitly set
Date: Sun, 15 Mar 2026 13:07:36 +0800 [thread overview]
Message-ID: <20260315050736.472233-1-hongyang.zhao@thundersoft.com> (raw)
In-Reply-To: <11e84371-57b2-4ea3-b3a4-0119d182229a@sirena.org.uk>
Thanks for the review!
> 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.
I'll move the clk_get_rate() call to es8316_probe(), right after
clk_prepare_enable() succeeds, and drop the fallback logic from hw_params().
Will send a v2.
@@ -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);
Thanks,
Hongyang
next prev parent reply other threads:[~2026-03-15 6:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 5:47 [PATCH 0/6] Subject: [PATCH 0/6] Add audio support for QCS6490 Thundercomm RubikPi3 Hongyang Zhao
2026-03-05 5:47 ` [PATCH 1/6] ASoC: dt-bindings: es8316: Document everest,jack-detect-inverted property Hongyang Zhao
2026-03-06 8:10 ` Krzysztof Kozlowski
2026-03-05 5:47 ` [PATCH 2/6] ASoC: es8316: Get sysclk rate from MCLK clock when not explicitly set Hongyang Zhao
2026-03-13 15:28 ` Mark Brown
2026-03-15 5:07 ` Hongyang Zhao [this message]
2026-03-05 5:47 ` [PATCH 3/6] ASoC: qdsp6: q6prm: Add MCLK and internal digital codec core clock IDs Hongyang Zhao
2026-03-09 7:41 ` Srinivas Kandagatla
2026-03-05 5:47 ` [PATCH 4/6] ASoC: qcom: common: Add MI2S port IDs to jack setup Hongyang Zhao
2026-03-05 5:47 ` [PATCH 5/6] ASoC: qcom: sc8280xp: Set codec DAI format for MI2S links Hongyang Zhao
2026-03-05 5:47 ` [PATCH 6/6] arm64: dts: qcom: qcs6490-rubikpi3: Add audio support Hongyang Zhao
2026-03-05 10:01 ` Konrad Dybcio
2026-03-05 10:51 ` Hongyang Zhao
2026-03-05 12:15 ` Krzysztof Kozlowski
2026-03-06 4:49 ` Hongyang Zhao
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=20260315050736.472233-1-hongyang.zhao@thundersoft.com \
--to=hongyang.zhao@thundersoft.com \
--cc=andersson@kernel.org \
--cc=broonie@debian.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=drake@endlessm.com \
--cc=katsuhiro@katsuster.net \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=matteomartelli3@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=rosh@debian.org \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
--cc=zhoubinbin@loongson.cn \
/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