All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Victor Krawiec" <victor.krawiec@arturia.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 4/4] regulator: fan53555: Add support for mode operations on Silergy devices
Date: Mon, 20 Jul 2026 10:16:26 +0000	[thread overview]
Message-ID: <20260720101627.018E41F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260720100336.62004-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() incorrectly updates the voltage register instead of the mode register when setting REGULATOR_MODE_NORMAL, causing severe voltage corruption on chips where these registers are distinct.
--

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

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

This commit makes the PWM mode configurable from devicetree for Silergy
devices. It adds a mapping function for devicetree mode flags to regulator
modes, allowing boards to force PWM mode to manage supply ripple.

> diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
> index c282236959b18..85f46874eb49d 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_map_mode(unsigned int mode)
> +{
> +	switch (mode) {
> +	case FAN53555_REGULATOR_MODE_FORCE_PWM:
> +		return REGULATOR_MODE_FAST;
> +	case FAN53555_REGULATOR_MODE_AUTO:
> +		return REGULATOR_MODE_NORMAL;

[Severity: High]
This isn't a bug introduced by this patch, but mapping to REGULATOR_MODE_NORMAL
exposes a pre-existing issue in fan53555_set_mode().

When REGULATOR_MODE_NORMAL is selected, fan53555_set_mode() updates di->vol_reg
instead of di->mode_reg:

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

On chips where the mode register and voltage register are distinct (such as
RK8602, FAN53526, or TCS), clearing di->mode_mask inside di->vol_reg corrupts
the voltage selection bits. This can cause a sudden, unintended drop in output
voltage leading to a system lockup.

Is it possible to correct the register used in fan53555_set_mode() before
enabling this mode mapping?

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

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

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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 10:03 [PATCH v2 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
2026-07-20 10:03 ` [PATCH v2 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
2026-07-20 10:12   ` sashiko-bot
2026-07-21  8:29   ` Krzysztof Kozlowski
2026-07-20 10:03 ` [PATCH v2 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode Victor Krawiec
2026-07-20 10:11   ` sashiko-bot
2026-07-20 10:03 ` [PATCH v2 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants Victor Krawiec
2026-07-20 10:03 ` [PATCH v2 4/4] regulator: fan53555: Add support for mode operations on Silergy devices Victor Krawiec
2026-07-20 10:16   ` 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=20260720101627.018E41F00A3A@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.