Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: robby.cai@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 1/2] regulator: fp9931: Fix VPOS/VNEG voltage selector table
Date: Tue, 21 Jul 2026 10:07:40 +0000	[thread overview]
Message-ID: <20260721100741.F220C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721095959.1855436-2-robby.cai@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] The VPOSNEG_table lacks padding for selectors 0x29-0x3F, causing valid hardware states to be rejected, and shrinking the array introduces a regression for selector 0x29.

Pre-existing issues:
- [High] The vcom regulator specifies an off-by-one n_voltages limit, incorrectly rejecting the highest valid selector (0xFF).
--

--- Patch [1]: [PATCH 1/2] regulator: fp9931: Fix VPOS/VNEG voltage selector table ---
commit 69720a9d40de43e41550a108ea7fe0d153732240
Author: Robby Cai <robby.cai@nxp.com>

regulator: fp9931: Fix VPOS/VNEG voltage selector table

This commit updates the VPOS/VNEG voltage selector table to match the
datasheet mapping by removing a duplicate 7.04V entry, ensuring the
selector 0x05 correctly aligns with 7.26V.

> diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
> index 002b41f53eff8..5eee21034f6b7 100644
> --- a/drivers/regulator/fp9931.c
> +++ b/drivers/regulator/fp9931.c
> @@ -42,7 +42,6 @@ static const unsigned int VPOSNEG_table[] = {
>  	7040000,
>  	7040000,
>  	7040000,
> -	7040000,

[Severity: High]
Does shrinking VPOSNEG_table[] introduce a regression for selector 0x29?

By removing this entry, the array size decreases from 42 to 41. However,
the datasheet and commit message indicate that selectors 0x28 through 0x3F
are all valid and map to 15.06V.

Because the vposneg regulator configures n_voltages based on the array size:

drivers/regulator/fp9931.c:regulators[] {
	...
	.name = "vposneg",
	...
	.n_voltages = ARRAY_SIZE(VPOSNEG_table),
	.vsel_reg = FP9931_REG_VPOSNEG_SETTING,
	.vsel_mask = 0x3F,
	...
}

the core will now reject selector 0x29 which was previously accepted.
Furthermore, since vsel_mask is 0x3F, if the hardware boots with a selector
between 0x29 and 0x3F, it will be rejected because it is >= n_voltages,
causing a failure during probe.

Should the array be explicitly padded up to index 63 to match the vsel_mask?

>  	7260000,
>  	7490000,
>  	7710000,

[ ... ]

Looking further down in the file at the vcom regulator configuration:

drivers/regulator/fp9931.c:regulators[] {
	...
	{
		.name = "vcom",
		...
		.n_voltages = 255,
		.min_uV = 0,
		.uV_step = 5000000 / 255,
		.vsel_reg = FP9931_REG_VCOM_SETTING,
		.vsel_mask = 0xFF,
	},
	...
}

[Severity: High]
This is a pre-existing issue, but does the vcom regulator have an off-by-one
error in its n_voltages limit?

Since vsel_mask is 0xFF, the hardware supports 256 states (0 to 255).
However, n_voltages is set to 255. If the core reads a hardware initialization
state of 0xFF, or a consumer requests the maximum voltage, it will be
incorrectly rejected because the maximum selector is equal to n_voltages
instead of strictly less than it.

Should n_voltages be 256?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721095959.1855436-1-robby.cai@oss.nxp.com?part=1

  reply	other threads:[~2026-07-21 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  9:59 [PATCH 0/2] regulator: fp9931: fix voltage mapping and runtime PM issues robby.cai
2026-07-21  9:59 ` [PATCH 1/2] regulator: fp9931: Fix VPOS/VNEG voltage selector table robby.cai
2026-07-21 10:07   ` sashiko-bot [this message]
2026-07-21 10:46     ` Robby Cai (OSS)
2026-07-27 20:04   ` Andreas Kemnade
2026-07-21  9:59 ` [PATCH 2/2] regulator: fp9931: Fix Runtime PM usage count underflow in v3p3 ops robby.cai
2026-07-21 10:07   ` sashiko-bot
2026-07-21 10:37     ` Robby Cai (OSS)

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=20260721100741.F220C1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robby.cai@oss.nxp.com \
    --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