Aw: Re: Re: Driver load order

Ahmad Fatoum a.fatoum at pengutronix.de
Tue May 24 01:53:12 PDT 2022


Hello Frank,

On 21.05.22 12:31, Frank Wunderlich wrote:
> Hi,
> 
> current state is that pmu/ldo regulators work, but not the SWITCH ones.
> 
> these are read by linux using the supply of the regulator itself
> 
> 	} else if (rdev->supply) {
> 		ret = regulator_get_voltage_rdev(rdev->supply->rdev);
> 
> tried to port this to barebox, but regulator-struct there does not have the supply member
> 
> 	} else if (rdev->supply) {
> 		ret = regulator_get_voltage(rdev->supply);
> 
> so i added it here:
> 
> +++ b/include/regulator.h
> @@ -86,6 +86,7 @@ struct regulator_dev {
>         struct regmap *regmap;
>         bool boot_on;
>         bool always_on;
> +       struct regulator *supply;

I think this should go into struct regulator_internal instead?
(You'll need to rename the current const char *supply there).

>         /* the device this regulator device belongs to */
>         struct device_d *dev;
> 
> but now this needs to be set somwhere...linux set this in
> 
> set_supply(struct regulator_dev *rdev,
> 		      struct regulator_dev *supply_rdev)
> which is called in regulator_resolve_supply (called by _regulator_get).

Ah, I missed b8074eba2a6b ("regulator: RK808: Add proper input supplies
for rk808"). I recall now that I had ported an older version of the Linux
driver to make porting work easier. 

You should probably add a supply_name member into struct regulator_desc
and then propagate this to core, so core can request it.

Cheers,
Ahmad

> 
> regards Frank
> 
> 
>> Gesendet: Donnerstag, 19. Mai 2022 um 15:10 Uhr
>> Von: "Sascha Hauer" <sha at pengutronix.de>
>> I gave it a test with your rk808 driver. It just works \o/
>>
>> regulator_get() triggers probing of the rk808 regulator driver and
>> returns a valid regulator.
>>
>> Sascha
> 
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list