Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michiel van Beers" <michielvanbeers@gmail.com>
Cc: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/3] regulator: Add Maxim MAX17135 driver
Date: Wed, 02 Dec 2026 16:54:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-246267@kernel.org> (raw)
In-Reply-To: <20261202-max17135-v1-2-beae6b70d575@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] regulator: max17135: range clamping marks VCOM programmed in
  max17135_probe()
--

commit 35331644fea93af4e5f64e9e127a8eda105b1887
Author: Michiel van Beers <michielvanbeers@gmail.com>

regulator: Add Maxim MAX17135 driver

This commit adds a regulator driver for the Maxim MAX17135 E-paper display
PMIC, exposing the vposneg and vcom regulators and creating an auxiliary
device for the temperature sensor.

> diff --git a/drivers/regulator/max17135.c b/drivers/regulator/max17135.c
> new file mode 100644
> index 0000000000000..b192a228d0aa6
> --- /dev/null
> +++ b/drivers/regulator/max17135.c
[ ... ]
> +static int max17135_vcom_set_voltage_sel(struct regulator_dev *rdev,
> +					 unsigned int selector)
> +{
> +	struct max17135 *ddata = rdev_get_drvdata(rdev);
> +	int ret;
> +
> +	ret = regulator_set_voltage_sel_regmap(rdev, selector);
> +	if (ret)
> +		return ret;
> +
> +	ddata->vcom_sel = selector;
> +	ddata->vcom_programmed = true;
> +
> +	return 0;
> +}
> +
> +static const struct regulator_ops max17135_vcom_ops = {
> +	.list_voltage = regulator_list_voltage_linear,
> +	.map_voltage = regulator_map_voltage_linear,
> +	.get_voltage_sel = regulator_get_voltage_sel_regmap,
> +	.set_voltage_sel = max17135_vcom_set_voltage_sel,
> +	.enable = max17135_vcom_enable,
> +	.disable = max17135_vcom_disable,
> +	.is_enabled = max17135_vcom_is_enabled,
> +};
> +
> +static int max17135_vcom_of_parse(struct device_node *np,
> +				  const struct regulator_desc *desc,
> +				  struct regulator_config *config)
> +{
> +	struct max17135 *ddata = config->driver_data;
> +	u32 min, max;
> +
> +	/* A single voltage in the DT is the calibration of this panel. */
> +	if (!of_property_read_u32(np, "regulator-min-microvolt", &min) &&
> +	    !of_property_read_u32(np, "regulator-max-microvolt", &max) &&
> +	    min == max)
> +		ddata->vcom_programmed = true;
> +
> +	return 0;
> +}

[Severity: Medium]
Can constraint clamping during devm_regulator_register() prematurely mark
ddata->vcom_programmed true when the device tree defines a voltage range
(min < max)?

When both regulator-min-microvolt and regulator-max-microvolt are
specified, of_get_regulation_constraints() sets constraints->apply_uV =
true.  If the chip's default MAX17135_REG_DVR value (such as
MAX17135_DVR_POR at 3.05 V or MAX17135_DVR_FACTORY at 1.77 V) falls
outside [min, max], machine_constraints_voltage() clamps the voltage into
range by calling max17135_vcom_set_voltage_sel() before
devm_regulator_register() returns.

That writes the uncalibrated range boundary into MAX17135_REG_DVR and sets
ddata->vcom_programmed = true, which suppresses the uncalibrated VCOM
warning in max17135_probe() and allows max17135_vcom_enable() to enable
VCOM at the boundary voltage before a consumer sets a calibrated value.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-max17135-v1-0-beae6b70d575@gmail.com?part=2

  reply	other threads:[~2026-12-02 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:43 [PATCH 0/3] regulator: Add Maxim MAX17135 E-paper PMIC driver Michiel van Beers via B4 Relay
2026-12-02 16:43 ` [PATCH 1/3] regulator: dt-bindings: Add Maxim MAX17135 Michiel van Beers via B4 Relay
2026-12-02 16:43 ` [PATCH 2/3] regulator: Add Maxim MAX17135 driver Michiel van Beers via B4 Relay
2026-12-02 16:54   ` sashiko-bot [this message]
2026-12-02 16:43 ` [PATCH 3/3] hwmon: Add Maxim MAX17135 temperature sensor driver Michiel van Beers via B4 Relay

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-246267@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=michielvanbeers@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox