[PATCH v4 2/5] power: supply: add support for max77759 fuel gauge
Pavel Machek
pavel at ucw.cz
Thu Jul 3 13:12:28 PDT 2025
Hi!
> > Other differences include the lack of V_BATT register to read the battery
> > level. The voltage must instead be read from V_CELL, the lowest voltage of
> > all cells. The mask to identify the chip is different. The computation of
> > the charge must also be changed to take into account TASKPERIOD, which
> > can add a factor 2 to the result.
> >
> > Add support for the MAX77759 by taking into account all of those
> > differences based on chip type.
> >
> > Do not advertise temp probes using the non-volatile memory as those are
> > not available.
> >
> > The regmap was proposed by André Draszik in
> >
> > Link: https://lore.kernel.org/all/d1bade77b5281c1de6b2ddcb4dbbd033e455a116.camel@linaro.org/
> >
> > Signed-off-by: Thomas Antoine <t.antoine at uclouvain.be>
> > ---
> > drivers/power/supply/max1720x_battery.c | 265 ++++++++++++++++++++++++++++----
> > 1 file changed, 238 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supply/max1720x_battery.c
> > index 68b5314ecf3a234f906ec8fe400e586855b69cd9..c9ad452ada9d0a2a51f37d04fd8c3260be522405 100644
> > --- a/drivers/power/supply/max1720x_battery.c
> > +++ b/drivers/power/supply/max1720x_battery.c
> > @@ -37,6 +37,7 @@
> > #define MAX172XX_REPCAP 0x05 /* Average capacity */
> > #define MAX172XX_REPSOC 0x06 /* Percentage of charge */
> > #define MAX172XX_TEMP 0x08 /* Temperature */
> > +#define MAX172XX_VCELL 0x09 /* Lowest cell voltage */
> [...]
> > case POWER_SUPPLY_PROP_VOLTAGE_NOW:
> [...]
> > + ret = regmap_read(info->regmap, MAX172XX_VCELL, ®_val);
> > + val->intval = max172xx_cell_voltage_to_ps(reg_val);
>
> I haven't reviewed this fully due to all the feedback you already
> got from Peter Griffin and the DT binding being broken, but something
> that catched my eye:
>
> POWER_SUPPLY_PROP_VOLTAGE_NOW provides the voltage of the whole
> battery and not of a single cell. E.g. a typical Li-Ion battery
> with two serial cells has a nominal voltage of roughly 7.4V while
> each cell has just 3.7V.
Phones normally only have one cell...
Best regards,
Pavel
--
I don't work for Nazis and criminals, and neither should you.
Boycott Putin, Trump, and Musk!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250703/c3441cd8/attachment.sig>
More information about the linux-arm-kernel
mailing list