mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: zain_zhou@realsil.com.cn
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Lee Jones <lee@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Vikash Bansal <vikash.bansal@nxp.com>,
	Aman Kumar Pandey <aman.kumarpandey@nxp.com>,
	Lakshay Piplani <lakshay.piplani@nxp.com>,
	devicetree@vger.kernel.org, linux-i3c@lists.infradead.org,
	linux-kernel@vger.kernel.org, mfd@lists.linux.dev,
	Wei Wang <wei_wang@realsil.com.cn>
Subject: Re: [RFC PATCH 3/4] regulator: rts490x: Add driver for on-die regulators
Date: Mon, 21 Sep 2026 12:23:39 +0200	[thread overview]
Message-ID: <arEFq_jDaUcbbDvo@sirena.co.uk> (raw)
In-Reply-To: <20260920100501.4091351-4-zain_zhou@realsil.com.cn>

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

On Sun, Sep 20, 2026 at 06:05:00PM +0800, zain_zhou@realsil.com.cn wrote:

> Add regulator support for the four programmable LDO outputs in the
> Realtek RTS490x I3C hub. The driver exposes the LDO voltage and enable
> controls through the regulator framework while preserving protected
> register state across updates.

> +static int rts490x_regulator_unprotect(struct regulator_dev *rdev,
> +				       struct rts490x_reg_state *state)
> +{
> +	int ret;
> +
> +	state->restore = false;
> +
> +	ret = regmap_read(rdev->regmap, RTS490X_PROTECTION_CODE,
> +			  &state->original);
> +	if (ret)
> +		return ret;
> +
> +	if (state->original == RTS490X_REGISTERS_UNLOCK_CODE)
> +		return 0;
> +
> +	ret = regmap_write(rdev->regmap, RTS490X_PROTECTION_CODE,
> +			   RTS490X_REGISTERS_UNLOCK_CODE);
> +	if (!ret)
> +		state->restore = true;
> +
> +	return ret;
> +}

What's going on with all this restore tracking?

> +static int rts490x_regulator_probe(struct platform_device *pdev)
> +{

> +	if (!pdev->dev.of_node) {
> +		dev_warn(&pdev->dev,
> +			 "no OF node; skipping on-chip LDO registration\n");
> +		return 0;
> +	}

The hardware is there no matter what, you should just load the driver so
the state is visible.  Without constraints the hardware state won't be
touched.

> +	regulators = of_get_available_child_by_name(pdev->dev.of_node, "regulators");
> +	if (!regulators)
> +		return 0;

The driver should just register all the regulators the silicon has
unconditionally.

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

  parent reply	other threads:[~2026-09-21 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 10:04 [RFC PATCH 0/4] Add support for Realtek RTS490x I3C hub zain_zhou
2026-09-20 10:04 ` [RFC PATCH 1/4] dt-bindings: i3c: Add Realtek RTS490x I3C hub support zain_zhou
2026-09-20 10:04 ` [RFC PATCH 2/4] mfd: Add driver for Realtek RTS490x I3C hub zain_zhou
2026-09-20 10:05 ` [RFC PATCH 3/4] regulator: rts490x: Add driver for on-die regulators zain_zhou
2026-09-20 13:05   ` Krzysztof Kozlowski
2026-09-21  3:46     ` 回复: " 周寅
2026-09-21 14:07       ` Krzysztof Kozlowski
2026-09-21 10:23   ` Mark Brown [this message]
2026-09-20 10:05 ` [RFC PATCH 4/4] i3c: hub: Add Realtek RTS490x I3C hub support zain_zhou

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=arEFq_jDaUcbbDvo@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=aman.kumarpandey@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lakshay.piplani@nxp.com \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=vikash.bansal@nxp.com \
    --cc=wei_wang@realsil.com.cn \
    --cc=zain_zhou@realsil.com.cn \
    /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

all inboxes | Powered by JetHome®