RE: [PATCH v3 2/2] regulator: adp5055: Add driver for adp5055

From: Torreno, Alexis Czezar
Date: Thu Apr 03 2025 - 22:34:12 EST




> -----Original Message-----
> From: Mark Brown <broonie@xxxxxxxxxx>
> Sent: Thursday, April 3, 2025 7:09 PM
> To: Torreno, Alexis Czezar <AlexisCzezar.Torreno@xxxxxxxxxx>
> Cc: Liam Girdwood <lgirdwood@xxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>;
> Krzysztof Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley
> <conor+dt@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3 2/2] regulator: adp5055: Add driver for adp5055
>
> [External]
>
> On Thu, Apr 03, 2025 at 10:43:11AM +0800, Alexis Czezar Torreno wrote:
>
> > +static int adp5055_is_enabled(struct regulator_dev *rdev) {
> > + struct adp5055 *adp5055 = rdev_get_drvdata(rdev);
> > + int id = rdev_get_id(rdev);
> > + int val;
> > +
> > + if (adp5055->en_mode_software)
> > + return regulator_is_enabled_regmap(rdev);
> > +
> > + val = gpiod_get_value_cansleep(adp5055->en_gpiod[id]);
> > +
> > + return val;
> > +};
>
> This is absolutely standard enable GPIO support, just let the core handle
> everything. Otherwise this looks fine.

May I ask which core function is the suggested to use here?

I assume I need to change the line in ops:
-> .is_enabled = adp5055_is_enabled,

Not sure which function handles both GPIO and registers since as far as I
understand 'regulator_is_enabled_regmap()' only handles software/registers and
'regulator_is_enabled()' only checks the gpio?