All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Victor Krawiec" <victor.krawiec@arturia.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 4/4] regulator: fan53555: Add support for mode operations on Silergy devices
Date: Wed, 15 Jul 2026 16:02:39 +0000	[thread overview]
Message-ID: <20260715160239.C26461F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715155141.128601-5-victor.krawiec@arturia.com>

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

Pre-existing issues:
- [High] `fan53555_set_mode()` writes to `di->vol_reg` instead of `di->mode_reg` when setting `REGULATOR_MODE_NORMAL`, causing severe state corruption for several vendors.
--

--- Patch [4]: [PATCH 4/4] regulator: fan53555: Add support for mode operations on Silergy devices ---
commit f660e0b49b4dfc8b2006ec4509cf598aba57babb
Author: Victor Krawiec <victor.krawiec@arturia.com>

regulator: fan53555: Add support for mode operations on Silergy devices

This patch maps Silergy PMIC device modes via device tree by mapping
SYR82X_REGULATOR_MODE_AUTO to REGULATOR_MODE_NORMAL. It exposes configurable
PWM modes for these regulators.

> diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
> index c282236959b18..8664659f0d809 100644
> --- a/drivers/regulator/fan53555.c
> +++ b/drivers/regulator/fan53555.c

[ ... ]

> @@ -389,6 +390,18 @@ static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di)
>  	return 0;
>  }
>  
> +static inline unsigned int fan53555_silergy_map_mode(unsigned int mode)
> +{
> +	switch (mode) {
> +	case SYR82X_REGULATOR_MODE_FORCE_PWM:
> +		return REGULATOR_MODE_FAST;
> +	case SYR82X_REGULATOR_MODE_AUTO:
> +		return REGULATOR_MODE_NORMAL;

[Severity: High]
This isn't a bug introduced by this patch, but returning REGULATOR_MODE_NORMAL
here exposes a pre-existing issue in fan53555_set_mode() that affects multiple
vendors (such as FAN53526, TCS, or RK8602).

When an in-kernel PM consumer driver or sysfs interface calls
regulator_set_mode() to set REGULATOR_MODE_NORMAL, it incorrectly updates
di->vol_reg instead of di->mode_reg:

drivers/regulator/fan53555.c:fan53555_set_mode() {
	...
	case REGULATOR_MODE_NORMAL:
		regmap_update_bits(rdev->regmap, di->vol_reg, di->mode_mask, 0);
		break;
	...
}

For RK8602, di->mode_mask is VSEL_MODE (BIT 6), but in vol_reg (e.g.,
RK8602_VSEL1), bit 6 represents a 64-step voltage increment (400mV). Clearing
this bit inadvertently plummets the physical voltage, which can cause hardware
brownouts, instant kernel panics, or memory corruption.

Is it possible to fix this existing issue in fan53555_set_mode() by using
di->mode_reg instead of di->vol_reg before or alongside this change?

> +	default:
> +		return REGULATOR_MODE_INVALID;
> +	}
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715155141.128601-1-victor.krawiec@arturia.com?part=4

      reply	other threads:[~2026-07-15 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 15:51 [PATCH 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
2026-07-15 15:51 ` [PATCH 1/4] regulator: dt-bindings: Add Silergy SYR82X allowed modes Victor Krawiec
2026-07-15 16:02   ` sashiko-bot
2026-07-15 15:51 ` [PATCH 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode Victor Krawiec
2026-07-15 15:51 ` [PATCH 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants Victor Krawiec
2026-07-15 15:51 ` [PATCH 4/4] regulator: fan53555: Add support for mode operations on Silergy devices Victor Krawiec
2026-07-15 16:02   ` sashiko-bot [this message]

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=20260715160239.C26461F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=victor.krawiec@arturia.com \
    /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.