From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Simon Shields <simon@lineageos.org>,
Artur Weber <aweber.kernel@gmail.com>,
patches@opensource.cirrus.com, linux-sound@vger.kernel.org
Subject: Re: [PATCH 1/4] ASoC: wm8994: fix MCLK gating for AIF clocks sourced from MCLK2
Date: Wed, 21 Oct 2026 15:39:15 +0100 [thread overview]
Message-ID: <atjOk2cuFysWIbPs@opensource.cirrus.com> (raw)
In-Reply-To: <20261021101750.3297770-2-m.szyprowski@samsung.com>
On Wed, Oct 21, 2026 at 12:17:42PM +0200, Marek Szyprowski wrote:
> aif_mclk_set() masks the AIFnCLK_SRC field of the AIFn clocking
> register, but compares the result with unshifted field values. The
> MCLK2 source (0x08) therefore never matches, so MCLK2 is never enabled
> for an AIF clocked from it, and the AIF relies on other users of that
> clock to keep it running.
>
> On the Exynos4412 Trats2 board, AIF1 and SYSCLK run from MCLK2, the
> 32768Hz PMIC clock, while the codec is idle. That clock is shared with
> the WLAN and Bluetooth chips, which enable it only once their drivers
> are loaded. Until then the codec runs from a stopped clock: FLL1 fails
> to lock when configured from that state, and the codec floods the
> kernel log with FIFO error interrupts once a digital path is powered
> up:
>
> wm8994-codec wm8994-codec: Timed out waiting for FLL lock
> wm8994-codec wm8994-codec: FIFO error
>
> Booting with clk_ignore_unused, which keeps that clock running from
> the bootloader, makes both issues disappear.
>
> Fixing just the comparison is not enough. The AIF clock source can
> be changed while the AIF clock is running, for example the Midas
> machine driver switches AIF1 between MCLK2 and FLL1 while AIF1CLK is
> kept enabled for jack detection. Looking up the clock again on disable
> can then release a different MCLK than the one enabled, leaking the
> enable count of one clock and underflowing the other.
>
> Shift the field value before decoding it, and remember which MCLK has
> been enabled for each AIF, so that the same clock is released on
> disable. While at it, report the MCLK number 1-based in the error
> message.
>
> Fixes: 001b83d395ab ("ASoC: wm8994: Add support for MCLKn clock gating")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
next prev parent reply other threads:[~2026-10-21 14:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20261021101815eucas1p2f6dd40fb230ab01b36c7d8f3eada0f45@eucas1p2.samsung.com>
2026-10-21 10:17 ` [PATCH 0/4] ASoC: wm8994/midas_wm1811: fix codec clocking issues Marek Szyprowski
2026-10-21 10:17 ` [PATCH 1/4] ASoC: wm8994: fix MCLK gating for AIF clocks sourced from MCLK2 Marek Szyprowski
2026-10-21 14:39 ` Charles Keepax [this message]
2026-10-21 15:17 ` Sylwester Nawrocki
2026-10-21 15:24 ` Mark Brown
2026-10-21 10:17 ` [PATCH 2/4] ASoC: wm8994: don't lose the AIF clock ratio when staying at 32kHz SYSCLK Marek Szyprowski
2026-10-21 14:21 ` Charles Keepax
2026-10-21 15:22 ` Sylwester Nawrocki
2026-10-21 10:17 ` [PATCH 3/4] ASoC: wm8994: fix MCLK index used for setting MCLK rate Marek Szyprowski
2026-10-21 13:57 ` Charles Keepax
2026-10-21 15:23 ` Sylwester Nawrocki
2026-10-21 10:17 ` [PATCH 4/4] ASoC: samsung: midas_wm1811: run FLL1 at the AIF1 configured rate when idle Marek Szyprowski
2026-10-21 15:31 ` Sylwester Nawrocki
2026-10-21 15:26 ` [PATCH 0/4] ASoC: wm8994/midas_wm1811: fix codec clocking issues Mark Brown
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=atjOk2cuFysWIbPs@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=aweber.kernel@gmail.com \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=patches@opensource.cirrus.com \
--cc=s.nawrocki@samsung.com \
--cc=simon@lineageos.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.