Re: [PATCH V2 14/15] power: supply: axp20x_battery: add support for AXP717

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Aug 2024 16:13:01 -0500
Chris Morgan <macroalpha82@xxxxxxxxx> wrote:

> On Sat, Aug 03, 2024 at 12:10:44PM +0100, Jonathan Cameron wrote:
> > On Fri,  2 Aug 2024 14:20:25 -0500
> > Chris Morgan <macroalpha82@xxxxxxxxx> wrote:
> >   
> > > From: Chris Morgan <macromorgan@xxxxxxxxxxx>
> > > 
> > > Add support for the AXP717 PMIC battery charger. The AXP717 differs
> > > greatly from existing AXP battery chargers in that it cannot measure
> > > the discharge current. The datasheet does not document the current
> > > value's offset or scale, so the POWER_SUPPLY_PROP_CURRENT_NOW is left
> > > unscaled.
> > > 
> > > Tested-by: Philippe Simons <simons.philippe@xxxxxxxxx>
> > > Signed-off-by: Chris Morgan <macromorgan@xxxxxxxxxxx>  
> > Hi.
> > 
> > A few drive by comments,
> > 
> > Jonathan
> >   
> > > ---
> > >  drivers/power/supply/axp20x_battery.c | 444 ++++++++++++++++++++++++++
> > >  1 file changed, 444 insertions(+)
> > > 
> > > diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c
> > > index c903c588b361..53af4ad0549d 100644
> > > --- a/drivers/power/supply/axp20x_battery.c
> > > +++ b/drivers/power/supply/axp20x_battery.c
> > > @@ -32,9 +32,19 @@
> > >  #include <linux/mfd/axp20x.h>
> > >  
> > >  #define AXP20X_PWR_STATUS_BAT_CHARGING	BIT(2)
> > > +#define AXP717_PWR_STATUS_MASK		GENMASK(6, 5)
> > > +#define AXP717_PWR_STATUS_BAT_STANDBY	(0 << 5)
> > > +#define AXP717_PWR_STATUS_BAT_CHRG	(1 << 5)
> > > +#define AXP717_PWR_STATUS_BAT_DISCHRG	(2 << 5)  
> > 
> > Fine to match local style in this patch, but just thought I'd
> > comment that this driver would probably be more readable with
> > use of FIELD_PREP and changing convention to not shift the defined
> > values for contents of each field.
> > 
> > To change to that it would either need to be before this patch,
> > or done as a follow up.  
> 
> I'll take your other comments and apply them, but if it's okay with
> you I'll opt to not use FIELD_PREP/FIELD_GET for the moment, so the
> style remains the same. I will make sure to use those macros for
> other drivers I'm working on though as they seem handy.
That's fine, though if you are in a position to test, it would be good to follow
up with a tidy up of this driver as that style is much more compact and
helps with maintenance longer term.

Jonathan




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux