On Sun, 21 Nov 2021 01:58:08 +0800 Chen-Yu Tsai <wens@xxxxxxxx> wrote: > Hi, > > On Sun, Nov 21, 2021 at 1:44 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > > > > On Wed, 17 Nov 2021 00:37:46 +0300 > > Evgeny Boger <boger@xxxxxxxxxxxxxx> wrote: > > > > > Both the charging and discharging currents on AXP22x are stored as > > > 12-bit integers, in accordance with the datasheet. > > > It's also confirmed by vendor BSP (axp20x_adc.c:axp22_icharge_to_mA). > > > > > > The scale factor of 0.5 is never mentioned in datasheet, nor in the > > > vendor source code. I think it was here to compensate for > > > erroneous addition bit in register width. > > > > > > Tested on custom A40i+AXP221s board with external ammeter as > > > a reference. > > > > > > Signed-off-by: Evgeny Boger <boger@xxxxxxxxxxxxxx> > > > > I know Quentin has moved on from Bootlin, so looking for input from Chen-Yu Tsai > > for these as I have no idea :) > > The datasheet only lists the registers for reading the value, but nothing > is said about how to interpret the data read. And the datasheet lists 13 > bits split between two registers. > > Evgeny mentioned that the original code is wrong, and the BSP code is > likely right, and has test results that match. That's good enough for > me. Unfortunately I don't have any way to double check it right now. So > > Acked-by: Chen-Yu Tsai <wens@xxxxxxxx> Applied to the fixes-togreg branch of iio.git with a fixes tag for the original driver introduction (as it seems this dates back that far) and marked for stable. Thanks, Jonathan