Devicetree
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v1 5/7] regulator: lp872x: Remove platform_data based probing
Date: Wed, 7 Oct 2026 10:39:16 +0200	[thread overview]
Message-ID: <asYFNNwVRAcX1V9o@sirena.co.uk> (raw)
In-Reply-To: <20261006154431.318936-6-clamor95@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1839 bytes --]

On Tue, Oct 06, 2026 at 06:44:29PM +0300, Svyatoslav Ryhel wrote:

> The platform_data-based probing is tightly integrated into the lp872x
> driver structure itself; removing just the platform data support is
> impossible without remodeling major parts of the probe sequence.

>  static int lp872x_init_dvs(struct lp872x *lp)
>  {
> -	struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
> -	enum gpiod_flags pinstate;
> +	struct device *dev = lp->dev;
>  	u32 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M };
>  	u32 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS };
> +	u8 dvs_state;

> +	device_property_read_u8(dev, "ti,dvs-vsel", (u8 *)&lp->vsel);

Since you're updating this we should fix to read into a local u8 and
assign the value - the cast won't work on big endian.

> +	device_property_read_u8(dev, "ti,dvs-state", &dvs_state);

If these properties are absent then dvs_state won't be updated...

> +	lp->dvs_pin = dvs_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;

...so this will be random.

> +	lp->dvs_gpio = devm_gpiod_get_optional(dev, "dvs", lp->dvs_pin);
> +	if (IS_ERR(lp->dvs_gpio)) {
> +		dev_err(dev, "gpio request err: %ld\n", PTR_ERR(lp->dvs_gpio));
> +		return PTR_ERR(lp->dvs_gpio);
>  	}

dev_err_probe()

>  static int lp872x_probe(struct i2c_client *cl)
>  {
> -	const struct i2c_device_id *id = i2c_client_get_device_id(cl);
> +	struct device *dev = &cl->dev;
>  	struct lp872x *lp;
> -	struct lp872x_platform_data *pdata;
> +	u8 general_config;

> +	device_property_read_u8(dev, "ti,general-config", &general_config);
> +	if (device_property_read_bool(dev, "ti,update-config")) {
> +		ret = regmap_write(lp->regmap, LP872X_GENERAL_CFG, general_config);

Same issue here with general_config being uninitialised if absent; this
is a buggy DT but we should still handle it better.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2026-10-07  8:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 15:44 [PATCH v1 0/7] lp872x: remove platform_data based probing and adjustments Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 1/7] regulator: dt-bindings: ti,lp872x: Convert to DT schema Svyatoslav Ryhel
2026-10-06 15:54   ` sashiko-bot
2026-10-06 15:44 ` [PATCH v1 2/7] regulator: dt-bindings: ti,lp872x: Document input supplies Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 3/7] regulator: lp872x: Fold driver header into driver file Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 4/7] regulator: lp872x: Remove redundant regmap wrappers Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 5/7] regulator: lp872x: Remove platform_data based probing Svyatoslav Ryhel
2026-10-06 15:54   ` sashiko-bot
2026-10-07  8:39   ` Mark Brown [this message]
2026-10-07  8:59     ` Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 6/7] regulator: lp872x: Add support for input and regulator power supplies Svyatoslav Ryhel
2026-10-06 15:44 ` [PATCH v1 7/7] regulator: lp872x: Use macro to fill regulator descriptor Svyatoslav Ryhel

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=asYFNNwVRAcX1V9o@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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