From: sashiko-bot@kernel.org
To: "Alexey Charkov" <alchark@flipper.net>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: codecs: nau8822: add support for speaker gain boost setting
Date: Tue, 01 Dec 2026 08:31:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-242842@kernel.org> (raw)
In-Reply-To: <20261201-nau8822-gain-boost-v1-1-963846584511@flipper.net>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] ASoC: nau8822: unshifted value 0x7 in nau8822_i2c_probe() boost
update
- [High] ASoC: nau8822: probe failure in nau8822_i2c_probe() on dummy
VDDSPK supply
- [Medium] ASoC: nau8822: unbalanced regulator enable in
nau8822_i2c_probe() error path
- [Low] ASoC: nau8822: duplicate linux/regulator/consumer.h include in
nau8822.c
--
commit 7be433b1cfde07c405213d2c8857611f51145778
Author: Alexey Charkov <alchark@flipper.net>
ASoC: codecs: nau8822: add support for speaker gain boost setting
This commit queries the VDDSPK regulator voltage during probe and enables
the speaker and AUX gain boost bits when the supply exceeds 3.6V.
> diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c
> index 17b8ee0ab22c3..1e90e00c99f22 100644
> --- a/sound/soc/codecs/nau8822.c
> +++ b/sound/soc/codecs/nau8822.c
> @@ -10,6 +10,7 @@
> //
> // Based on WM8974.c
>
> +#include "linux/regulator/consumer.h"
> #include <linux/module.h>
> #include <linux/moduleparam.h>
> #include <linux/kernel.h>
[Severity: Low]
<linux/regulator/consumer.h> is already included a few lines below, so this
duplicate include can be dropped.
> @@ -1189,7 +1190,7 @@ static int nau8822_i2c_probe(struct i2c_client *i2c)
> {
> struct device *dev = &i2c->dev;
> struct nau8822 *nau8822 = dev_get_platdata(dev);
> - int ret, i;
> + int ret, i, vddspk;
>
> if (!nau8822) {
> nau8822 = devm_kzalloc_obj(dev, *nau8822);
> @@ -1210,6 +1211,11 @@ static int nau8822_i2c_probe(struct i2c_client *i2c)
> if (ret)
> return dev_err_probe(dev, ret, "Failed to get regulators\n");
>
> + vddspk = regulator_get_voltage(nau8822->supplies[SUPPLY_VDDSPK].consumer);
> + if (vddspk < 0 && vddspk != -ENODEV)
> + return dev_err_probe(dev, vddspk,
> + "Failed to get VDDSPK voltage\n");
[Severity: High]
Does this cause nau8822_i2c_probe() to fail with -EINVAL when vddspk-supply
is omitted from the device tree?
devm_regulator_bulk_get() substitutes the dummy regulator when an optional
supply is absent, and regulator_get_voltage() returns -EINVAL (not -ENODEV)
for regulators without voltage query operations or a fixed voltage.
> nau8822->regmap = devm_regmap_init_i2c(i2c, &nau8822_regmap_config);
> if (IS_ERR(nau8822->regmap)) {
> ret = PTR_ERR(nau8822->regmap);
> @@ -1231,6 +1237,17 @@ static int nau8822_i2c_probe(struct i2c_client *i2c)
> goto err_reg;
> }
>
> + if (vddspk > 3600000) {
> + ret = regmap_update_bits(nau8822->regmap,
> + NAU8822_REG_OUTPUT_CONTROL,
> + NAU8822_SPKBST |
> + NAU8822_AUX2BST |
> + NAU8822_AUX1BST, 0x7);
[Severity: High]
Does passing 0x7 to regmap_update_bits() leave NAU8822_AUX2BST and
NAU8822_AUX1BST cleared?
NAU8822_SPKBST, NAU8822_AUX2BST, and NAU8822_AUX1BST are defined at bits
2..4 (mask 0x1c), and regmap_update_bits() does not shift val to the mask
position, so (0x7 & 0x1c) only sets bit 2 (NAU8822_SPKBST). Passing the
combined bitmask as val (or using regmap_set_bits()) would set all three
bits.
> + if (ret != 0)
> + return dev_err_probe(dev, ret,
> + "Failed to update gain boost control\n");
> + }
[Severity: Medium]
Does this error return leak the regulator enable reference counts from
regulator_bulk_enable() earlier in nau8822_i2c_probe()? Jumping to err_reg
would disable the bulk supplies on failure.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-nau8822-gain-boost-v1-1-963846584511@flipper.net?part=1
next prev parent reply other threads:[~2026-12-01 8:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:24 [PATCH] ASoC: codecs: nau8822: add support for speaker gain boost setting Alexey Charkov
2026-12-01 8:31 ` sashiko-bot [this message]
2026-12-01 8:42 ` Alexey Charkov
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-242842@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alchark@flipper.net \
--cc=linux-sound@vger.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