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

From: Torreno, Alexis Czezar
Date: Thu Feb 27 2025 - 23:02:02 EST




> -----Original Message-----
> From: Mark Brown <broonie@xxxxxxxxxx>
> Sent: Wednesday, February 26, 2025 7:35 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 2/2] regulator: adp5055: Add driver for adp5055
>
> [External]
>
> On Wed, Feb 26, 2025 at 02:24:58AM +0000, Torreno, Alexis Czezar wrote:
>
> > > > +// SPDX-License-Identifier: GPL-2.0
> > > > +/*
> > > > + * Regulator driver for Analog Devices ADP5055
> > > > + *
> > > > + * Copyright (C) 2025 Analog Devices, Inc.
> > > > + */
>
> > > Please make the entire comment block a C++ one so things look more
> > > intentional.
>
> > Am not familiar with this, is this where each line use // rather than /**/?
>
> Yes.
>
> > > > +static int adp5055_en_func(struct regulator_dev *dev, int en_val) {
> > > > + struct adp5055 *adp5055 = rdev_get_drvdata(dev);
>
> > > Just use the standard GPIO and regmap helpers for this.
>
> > Confused on this, I thought these were standard 'regmap_update_bits'
> > and 'gpiod_set_value_cansleep'
>
> You've open coded the operations instead of using the framework helpers, you
> shouldn't need to anything other than supply data here.

I did code this similar to the helper functions like regulator_enable_regmap.

I can reduce the code a bit if I use 'regulator_enable_regmap' inside my
custom 'adp5055_en_func'.
ADP5055 can be enabled by SW or HW and I didn't see a helper function that
can do both depending on another property/register hence I coded a custom.

if having both gpio and register enable isn't that common, I guess it's an option
to remove the gpios and stay purely software