[RFC PATCH 3/4] regulator: rts490x: Add driver for on-die regulators

Mark Brown broonie at kernel.org
Mon Sep 21 03:23:45 PDT 2026


On Sun, Sep 20, 2026 at 06:05:00PM +0800, zain_zhou at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-i3c/attachments/20260921/9ebcd9a5/attachment-0001.sig>


More information about the linux-i3c mailing list