On Tue, 2024-12-03 at 06:47 +0000, André Draszik wrote: > Hi Thomas, > > Thanks for looking into this! > > > From: Thomas Antoine <t.antoine@xxxxxxxxxxxx> > > > > The Maxim max77759 fuel gauge has the same interface as the Maxim max1720x > > except for the non-volatile memory slave address which is not available. > > It is not fully compatible, and it also has a lot more registers. > > For example, the voltage now is not in register 0xda as this driver assumes. > With these changes, POWER_SUPPLY_PROP_VOLTAGE_NOW just reads as 0. 0xda > doesn't exist in max77759 > > I haven't compared in depth yet, though. Regarding the regmap in this driver, please see below comparison I had collected some time ago: regmap_reg_range(0x24, 0x26), // exists regmap_reg_range(0x30, 0x31), // exists regmap_reg_range(0x33, 0x34), // exists regmap_reg_range(0x37, 0x37), // exists regmap_reg_range(0x3B, 0x3C), // exists regmap_reg_range(0x40, 0x41), // exists regmap_reg_range(0x43, 0x44), // exists regmap_reg_range(0x47, 0x49), // exists regmap_reg_range(0x4B, 0x4C), // exists regmap_reg_range(0x4E, 0xAF), // 0x4e 0x4f exists regmap_reg_range(0xB1, 0xB3), // exists regmap_reg_range(0xB5, 0xB7), // exists regmap_reg_range(0xBF, 0xD0), // 0xd0 exists 0xd1 .. 0xdb don't exist regmap_reg_range(0xDB, 0xDB), regmap_reg_range(0xE0, 0xFF), // 0xfb 0xff exist the comments refer to whether or not the register exists in max77759 > > > No slave is available at address 0xb of the i2c bus, which is coherent > > with the following driver from google: line 5836 disables non-volatile > > memory for m5 gauge. > > > > Link: > > https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef474573cc8629cc1d121eb6a81ab68c/max1720x_battery.c > > > > Add support for the max77759 by allowing to use the non-volatile > > memory or not based on the chip. Value for RSense comes from the following > > stock devicetree: > > > > Link: > > https://android.googlesource.com/kernel/devices/google/gs101/+/33eca36d43da6c2b6a546806eb3e7411bbe6d60d/dts/gs101-raviole-battery.dtsi > > > > Signed-off-by: Thomas Antoine <t.antoine@xxxxxxxxxxxx> > > --- > > drivers/power/supply/max1720x_battery.c | 71 +++++++++++++++++++++++++++- > > ----- > > 1 file changed, 59 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/power/supply/max1720x_battery.c > > b/drivers/power/supply/max1720x_battery.c > > index > > 33105419e2427bb37963bda9948b647c239f8faa..faf336938dd4306dd2ceeb0a84b90ca8 > > 0ad41a9f 100644 > > --- a/drivers/power/supply/max1720x_battery.c > > +++ b/drivers/power/supply/max1720x_battery.c > > @@ -13,6 +13,7 @@ > > #include <linux/nvmem-provider.h> > > #include <linux/power_supply.h> > > #include <linux/regmap.h> > > +#include <linux/types.h> > > Please keep file names in alphabetical order. Ignore that, it's too early :-) Cheers, Andre'