Re: [PATCH] regulator: core: Fix resolve supply

From: Kory Maincent
Date: Thu Nov 14 2024 - 09:37:01 EST


On Thu, 14 Nov 2024 13:27:55 +0000
Mark Brown <broonie@xxxxxxxxxx> wrote:

> On Wed, Nov 13, 2024 at 05:36:42PM +0100, Kory Maincent wrote:
>
> > My issue is that it does not look for the regulator supply in the OF node
> > described in the regulator_config structure:
> > https://elixir.bootlin.com/linux/v6.11.7/source/include/linux/regulator/driver.h#L445
> > It looks at the parent device OF node instead.
> >
> > My use case is that a PSE controller have several PIs (Power Interface)
> > which can have different regulator supply. A regulator device is registered
> > for each PIs. The OF node used by the regulator core to lookup for the
> > regulator supply is the PSE controller node and its children instead of the
> > node of the PI which is described by the regulator_config->of_node.
>
> Please resubmit with a clearer commit log.

Still I am not sure it is the right way to do it.
In regulator_dev_lookup function if the regulator is not found in the dt it uses
the dev_name string to look for it.
https://elixir.bootlin.com/linux/v6.11.7/source/drivers/regulator/core.c#L2035

The dev name of the rdev->dev.parent device or the rdev->dev virtual device is
not the same. I am not regulator expert therefore I am afraid that the suggested
change could break things.

Maybe this change is safer: https://termbin.com/g0xi

Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com