From: sashiko-bot@kernel.org
To: "Mehmet Fide" <mehmet.fide@gmail.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 7/7] ASoC: nau8810: add MCLK support
Date: Thu, 03 Dec 2026 13:21:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-247848@kernel.org> (raw)
In-Reply-To: <20261203124733.2101884-8-mehmet.fide@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ASoC: nau8810: MCLK-to-PLL switch leaves PLL off during
pmdown_time
- [Medium] ASoC: nau8810: nau8810_set_pll() reprograms PLL while PLL_EN
is active
--
commit 6d8fbbb4bed0d01ffd7425872f563b6b8efcc0d3
Author: Mehmet Fide <mehmet.fide@screeningeagle.com>
ASoC: nau8810: add MCLK support
This commit adds optional MCLK clock handling to the nau8810 driver,
enabling MCLK when the codec leaves standby and configuring the PLL in
nau8810_set_sysclk() whenever the requested sysclk differs from the MCLK
rate.
> diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c
> index a27fa63a2887e..311dfa8eea74d 100644
> --- a/sound/soc/codecs/nau8810.c
> +++ b/sound/soc/codecs/nau8810.c
[ ... ]
> @@ -608,11 +609,26 @@ static int nau8810_set_sysclk(struct snd_soc_dai *dai,
> {
> struct snd_soc_component *component = dai->component;
> struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component);
> + unsigned long mclk_freq;
>
> nau8810->clk_id = clk_id;
> nau8810->sysclk = freq;
> +
> + if (nau8810->mclk) {
> + mclk_freq = clk_get_rate(nau8810->mclk);
> + if (mclk_freq != freq) {
> + int ret = nau8810_set_pll(dai, NAU8810_SCLK_MCLK,
> + NAU8810_SCLK_MCLK, mclk_freq, freq);
> + if (ret) {
> + dev_err(component->dev, "Failed to set PLL\n");
> + return ret;
> + }
> + nau8810->clk_id = NAU8810_SCLK_PLL;
> + }
> + }
> +
> dev_dbg(nau8810->dev, "master sysclk %dHz, source %s\n",
> - freq, clk_id == NAU8810_SCLK_PLL ? "PLL" : "MCLK");
> + freq, nau8810->clk_id == NAU8810_SCLK_PLL ? "PLL" : "MCLK");
>
> return 0;
> }
[Severity: High]
Can switching from an MCLK-matched rate to a PLL-derived rate leave the
PLL powered off during pmdown_time?
Unlike nau8822_set_pll(), nau8810_set_pll() selects NAU8810_CLKM_PLL in
NAU8810_REG_CLOCK without setting NAU8810_PLL_EN_SFT in
NAU8810_REG_POWER1. Instead, NAU8810_PLL_EN_SFT is only driven by the
"PLL" DAPM supply widget, gated on check_mclk_select_pll().
Because nau8810_component_driver sets .use_pmdown_time = 1, closing an
MCLK-matched stream leaves Playback and DAC powered on with PLL off. If
a PLL-rate stream starts within pmdown_time, dapm_power_one_widget()
sees Playback already active and skips check_mclk_select_pll().
The codec master clock is then routed from a powered-off PLL, breaking
playback with silent output or PCM write timeouts when the codec is
clock provider. In the reverse direction (PLL to MCLK), the PLL remains
powered on until pmdown_time expires.
[Severity: Medium]
Can nau8810_set_pll() reprogram the PLL registers while
NAU8810_PLL_EN_SFT is still active?
When back-to-back streams run at different PLL-derived rates within
pmdown_time (such as 48 kHz then 44.1 kHz from a 25 MHz MCLK), the DAPM
PLL widget keeps NAU8810_PLL_EN_SFT set. nau8810_set_pll() then writes
NAU8810_REG_PLLN and NAU8810_REG_PLLK1..3 while the PLL is enabled.
On the sibling NAU8822 with the same fractional-N PLL registers, commit
aeca8a329502 ("ASoC: nau8822: Add operation for internal PLL off and
on") found that the PLL fails to lock unless PLL_EN is cleared before
programming the fractional parameters and re-enabled afterward.
Should nau8810_set_pll() clear NAU8810_PLL_EN_SFT before updating the
PLL registers and restore it afterward if it was enabled?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203124733.2101884-1-mehmet.fide@gmail.com?part=7
prev parent reply other threads:[~2026-12-03 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 12:47 [PATCH 0/7] ASoC: nau8810: add MCLK support Mehmet Fide
2026-12-03 12:47 ` [PATCH 1/7] ASoC: dt-bindings: nau8810: Add MCLK clock Mehmet Fide
2026-12-03 12:57 ` sashiko-bot
2026-12-03 12:47 ` [PATCH 2/7] ASoC: nau8810: move nau8810_set_sysclk() Mehmet Fide
2026-12-03 12:47 ` [PATCH 3/7] ASoC: nau8810: set NAU8810_REFIMP_80K only once Mehmet Fide
2026-12-03 12:47 ` [PATCH 4/7] ASoC: nau8810: Lower debug print priority Mehmet Fide
2026-12-03 12:47 ` [PATCH 5/7] ASoC: nau8810: Do not configure the PLL if freq_out is zero Mehmet Fide
2026-12-03 12:47 ` [PATCH 6/7] ASoC: nau8810: Don't reconfigure PLL to the same values Mehmet Fide
2026-12-03 12:47 ` [PATCH 7/7] ASoC: nau8810: add MCLK support Mehmet Fide
2026-12-03 13:21 ` sashiko-bot [this message]
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=sashiko-outbox-247848@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mehmet.fide@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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