From: sashiko-bot@kernel.org
To: "Karl Asseily" <karl@asseily.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver
Date: Fri, 21 Aug 2026 04:50:31 +0000 [thread overview]
Message-ID: <20260821045031.CEAC71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821043859.171871-4-karl@asseily.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Clock setup unconditionally requests 256x MCLK and checks a hardcoded 128x minimum, violating hardware limits and breaking 64FS mode for high sample rates (e.g., 768kHz).
- [Medium] Internal software states (`priv->mute_user`, `priv->dop_auto`) are mutated before the hardware write succeeds, causing permanent desynchronization on I2C errors.
--
--- Patch [3]: [PATCH v2 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver ---
commit d6078d6a073963832dc02c18cb1b239c05eaaf57
Author: Karl Asseily <karl@asseily.com>
ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver
This commit adds a new ALSA SoC driver for the ESS Technology ES9039Q2M
32-bit 2-channel audio DAC. It provides support for PCM, DSD, DoP, and
S/PDIF input formats, handling software mode over I2C.
> diff --git a/sound/soc/codecs/es9039q2m.c b/sound/soc/codecs/es9039q2m.c
> new file mode 100644
> index 0000000000000..bd09e230f9a3e
> --- /dev/null
> +++ b/sound/soc/codecs/es9039q2m.c
[ ... ]
> @@ -821,11 +821,11 @@ static int es9039_mute_put(struct snd_kcontrol *kcontrol,
> if (val == priv->mute_user)
> return 0;
>
> priv->mute_user = val;
>
> ret = es9039_apply_mute(priv);
> if (ret)
> return ret;
[Severity: Medium]
Does this leave the cached state out of sync with the hardware?
If es9039_apply_mute() fails (e.g., due to an I2C error), priv->mute_user
has already been updated. Since the function returns early without reverting
the state, subsequent attempts by the user to set the intended value will be
short-circuited by the `if (val == priv->mute_user)` equality check. This
could leave the hardware permanently out of sync until a different value
is toggled.
[ ... ]
> @@ -857,11 +857,11 @@ static int es9039_dop_put(struct snd_kcontrol *kcontrol,
> if (priv->stream_rate)
> return -EBUSY;
>
> priv->dop_auto = on;
>
> ret = es9039_apply_dop(priv, on);
> if (ret)
> return ret;
[Severity: Medium]
Similar to the mute control above, if es9039_apply_dop() fails, does this
leave priv->dop_auto permanently out of sync with the hardware?
[ ... ]
> @@ -1108,18 +1108,18 @@ static int es9039_setup_clocking(struct es9039q2m_priv *priv,
> ratio = priv->bclk_ratio ? priv->bclk_ratio : 64;
>
> if (!priv->mclk_fixed) {
> /*
> * 256 * FS is the usual choice and clears both the 128 and 130
> * floors with room to spare. Take whatever the clock actually
> * settles on rather than assuming the request was honoured.
> */
> ret = clk_set_rate(priv->mclk, 256 * rate);
> if (ret)
> return ret;
[Severity: High]
For high sample rates like 768kHz (which the driver advertises support for),
will this request a clock rate of 196.6 MHz?
The ES9039Q2M maximum MCLK is documented as 50 MHz. Should this limit the
requested clock multiplier based on the sample rate so it doesn't violate
the physical limits of the chip?
>
> priv->mclk_rate = clk_get_rate(priv->mclk);
> }
>
> if (es9039_is_sync(priv))
> min_mult = ES9039_SYNC_MIN_MCLK_FS;
> else
> min_mult = ES9039_ASYNC_MIN_MCLK_FS;
>
> if (priv->mclk_rate < min_mult * rate) {
> dev_err(dai->dev,
[Severity: High]
If the clock provider safely clamps the requested clock to the 50 MHz limit
for a 768kHz stream, will this check unconditionally fail?
The 768kHz rate requires 64FS mode (which is handled later in
es9039q2m_hw_params()), but min_mult here is hardcoded to 128 or 130, meaning
50M < 128 * 768k. Could this prevent 768kHz streams from being played at all?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821043859.171871-1-karl@asseily.com?part=3
next prev parent reply other threads:[~2026-08-21 4:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 4:38 [PATCH v2 0/4] ASoC: add ESS Technology ES9039Q2M codec driver Karl Asseily
2026-08-21 4:38 ` [PATCH v2 1/4] dt-bindings: vendor-prefixes: add ESS Technology Karl Asseily
2026-08-21 4:38 ` [PATCH v2 2/4] ASoC: dt-bindings: add ESS Technology ES9039Q2M Karl Asseily
2026-08-21 4:38 ` [PATCH v2 3/4] ASoC: es9039q2m: add ESS Technology ES9039Q2M codec driver Karl Asseily
2026-08-21 4:50 ` sashiko-bot [this message]
2026-08-21 4:38 ` [PATCH v2 4/4] MAINTAINERS: add entry for the " Karl Asseily
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=20260821045031.CEAC71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=karl@asseily.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