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.