From: sashiko-bot@kernel.org
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: mfd@lists.linux.dev, lee@kernel.org, robh@kernel.org,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
Date: Sat, 11 Jul 2026 06:12:20 +0000 [thread overview]
Message-ID: <20260711061220.A7D3F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <7ea589f951baf1e217c7169ae21c0bf510672ecf.1783749722.git.hns@goldelico.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing cleanup on write failure in `twl4030_perform_writes()` leaves the codec permanently disabled.
- [Medium] `twl4030_hw_params()` completely ignores the return value of batch register writes, masking hardware configuration failures.
--
--- Patch [6]: [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface ---
commit db9973d614eb8b37cb4d8a6cf9cada8e9b6d1cf8
Author: Grond <grond66@riseup.net>
Subject: ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface
This patch allows setting the APLL rate through the .set_sysclk() interface
for devices where the APLL drives audio clocks, but playback bypasses the
standard .hw_params() path. It extracts the APLL rate calculation into a
helper and introduces batch register write functions.
> diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
> index 9476cdfd4dde9..ff36679166e20 100644
> --- a/sound/soc/codecs/twl4030.c
> +++ b/sound/soc/codecs/twl4030.c
> @@ -198,6 +198,38 @@ static void twl4030_codec_enable(struct snd_soc_component *component, int enable
> udelay(10);
> }
>
> +static int twl4030_perform_writes(struct snd_soc_component *component,
> + const unsigned int *regs,
> + const unsigned int *vals,
> + unsigned int n)
> +{
> + struct twl4030_priv *twl4030 = snd_soc_component_get_drvdata(component);
> + int reboot_codec = twl4030->codec_powered;
> + unsigned int i;
> + int ret;
> +
> + if (reboot_codec)
> + twl4030_codec_enable(component, 0);
> +
> + for (i = 0; i < n; ++i) {
> + ret = twl4030_write(component, regs[i], vals[i]);
> + if (ret)
> + return ret;
[Severity: High]
If twl4030_write() fails and returns early, will it leave the codec permanently
disabled because we skip the twl4030_codec_enable(component, 1) call? This
seems to cause a hardware state mismatch where the ALSA core considers the
codec powered on, but it remains physically powered off.
> + }
> +
> + if (reboot_codec)
> + twl4030_codec_enable(component, 1);
> +
> + return 0;
> +}
[ ... ]
> @@ -1775,20 +1824,12 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
> return -EINVAL;
> }
>
> - if (format != old_format || mode != old_mode) {
> - if (twl4030->codec_powered) {
> - /*
> - * If the codec is powered, than we need to toggle the
> - * codec power.
> - */
> - twl4030_codec_enable(component, 0);
> - twl4030_write(component, TWL4030_REG_CODEC_MODE, mode);
> - twl4030_write(component, TWL4030_REG_AUDIO_IF, format);
> - twl4030_codec_enable(component, 1);
> - } else {
> - twl4030_write(component, TWL4030_REG_CODEC_MODE, mode);
> - twl4030_write(component, TWL4030_REG_AUDIO_IF, format);
> - }
> + if (format != old_format || s) {
> + regs[0] = TWL4030_REG_CODEC_MODE;
> + vals[0] = mode;
> + regs[1] = TWL4030_REG_AUDIO_IF;
> + vals[1] = format;
> + twl4030_perform_writes(component, regs, vals, ARRAY_SIZE(regs));
[Severity: Medium]
Does this code ignore the return value of twl4030_perform_writes()?
If the batch register writes fail, it seems the hardware remains unconfigured
but the function will still return 0 (success) and falsely advance the stream
state.
> }
>
> /* Store the important parameters for the DAI configuration and set
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783749722.git.hns@goldelico.com?part=6
next prev parent reply other threads:[~2026-07-11 6:12 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 6:01 [PATCH 00/16] ARM: omap3: pandora: Modernize audio and backlight to Device Tree to finally remove pdata-quirks H. Nikolaus Schaller
2026-07-11 6:01 ` [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen H. Nikolaus Schaller
2026-07-11 6:01 ` [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti, twl4030-regen H. Nikolaus Schaller
2026-07-11 6:10 ` sashiko-bot
2026-07-13 7:39 ` [PATCH 01/16] dt-bindings: twl-regulator: Add bindings for exposing ti,twl4030-regen Krzysztof Kozlowski
2026-07-13 8:26 ` H. Nikolaus Schaller
2026-07-13 9:19 ` Krzysztof Kozlowski
2026-07-13 9:36 ` H. Nikolaus Schaller
2026-07-11 6:01 ` [PATCH 02/16] regulator: twl: Expose the TWL4030's REGEN signal as a regulator H. Nikolaus Schaller
2026-07-11 6:16 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 03/16] arm: dts: twl4030: add twl4030-regen child H. Nikolaus Schaller
2026-07-11 6:18 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 04/16] arm: dts: omap3pandora: Populate DT data for the TWL4030's REGEN regulator H. Nikolaus Schaller
2026-07-11 6:19 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 05/16] arm: dts: omap3pandora: Don't use DMA channels for unused SPI masters H. Nikolaus Schaller
2026-07-11 6:06 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 06/16] ASoC: twl4030-codec: Allow setting APLL rate through the .set_sysclk() interface H. Nikolaus Schaller
2026-07-11 6:12 ` sashiko-bot [this message]
2026-07-11 6:01 ` [PATCH 07/16] ASoC: dt-bindings: add TI PCM1773 H. Nikolaus Schaller
2026-07-11 6:08 ` sashiko-bot
2026-07-11 7:39 ` Rob Herring (Arm)
2026-07-13 7:38 ` Krzysztof Kozlowski
2026-07-13 7:45 ` [Letux-kernel] " H. Nikolaus Schaller
2026-07-13 8:27 ` H. Nikolaus Schaller
2026-07-11 6:01 ` [PATCH 08/16] ASoC: pcm1773-codec: write a driver for the PCM1773 chip from TI H. Nikolaus Schaller
2026-07-11 6:14 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 09/16] ASoC: dt-bindings: add OpenPandora Sound Card H. Nikolaus Schaller
2026-07-11 6:10 ` sashiko-bot
2026-07-11 7:39 ` Rob Herring (Arm)
2026-07-13 7:37 ` Krzysztof Kozlowski
2026-07-13 8:27 ` H. Nikolaus Schaller
2026-07-13 9:21 ` Krzysztof Kozlowski
2026-07-13 9:38 ` H. Nikolaus Schaller
2026-07-13 9:42 ` Krzysztof Kozlowski
2026-07-13 11:53 ` H. Nikolaus Schaller
2026-07-11 6:01 ` [PATCH 10/16] ASoC: omap3pandora: Rewrite sound card driver as a platform driver with DT H. Nikolaus Schaller
2026-07-11 6:15 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 11/16] ARM: dts: omap3-pandora-common: Enable audio in/out (mcbsp4/2) H. Nikolaus Schaller
2026-07-11 6:17 ` sashiko-bot
2026-07-11 6:01 ` [PATCH 12/16] arm: dts: omap3pandora: Add device node for PCM1773 codec H. Nikolaus Schaller
2026-07-11 6:15 ` sashiko-bot
2026-07-11 6:02 ` [PATCH 13/16] arm: dts: omap3pandora: create new DT node for the sound card H. Nikolaus Schaller
2026-07-11 6:17 ` sashiko-bot
2026-07-11 6:02 ` [PATCH 14/16] arm: dts: omap3-pandora-common: backlight: switch to twl4030 pwm and pwm_bl H. Nikolaus Schaller
2026-07-11 6:15 ` sashiko-bot
2026-07-11 6:02 ` [PATCH 15/16] backlight: remove pandora_bl H. Nikolaus Schaller
2026-07-11 6:16 ` sashiko-bot
2026-07-11 6:02 ` [PATCH 16/16] arm: omap2: remove remaining pdata-quirks for pandora legacy devices H. Nikolaus Schaller
2026-07-11 6:13 ` sashiko-bot
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=20260711061220.A7D3F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hns@goldelico.com \
--cc=lee@kernel.org \
--cc=mfd@lists.linux.dev \
--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 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.