On Mon, Mar 13, 2023 at 8:49 AM Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote: > On 3/10/23 10:29, Linus Walleij wrote: > > On Thu, Mar 9, 2023 at 11:50 PM Sebastian Reichel <sre@xxxxxxxxxx> wrote: > > > >> Drop CHARGE_NOW support, which requires a platform specific > >> calculation method. > >> > >> Signed-off-by: Sebastian Reichel <sre@xxxxxxxxxx> > > > > I agree. If we want to support this, we should use the generic > > methods with interpolation tables defined in DT as well, and it also > > ideally requires load compensated resistance calculation to figure > > out Ri so this can bring any kind of reasonable precision. > > I guess you have your reasons, besides you have far better insight to > things than I do - hence I am not really objecting this - just asking a > question ;) > > Do we have generic facilities of computing this based on the DT tables / > Ri in place(?) Not yet, for the Samsung batteries I used a static look-up table derived from the compatible string for calculating Ri from VBAT and from that calculate the capacity from estimated open circuit voltage, see drivers/power/supply/samsung-sdi-battery.c > I guess that we do need/see platform specific > implementations as long as there is no generic "de-facto" way of doing > this available... The method I used with Samsung batteries is fine as long as all you need to know to know everything about a battery is the compatible string. Pretty much any Lion battery with a clearly defined product name can be done this way. The only reason to put the interpolation tables into the device tree would be to support any random battery, such as one that you do not know the model or this can change. I am however mildly sceptic about adding that: if you know the VBAT-to-Ri and OCV-to-capacity tables, you must have a datasheet, and then you know the name of the battery product and hence you know the right compatible string... I think the right way to handle any capacity curves for any battery would be to create static data like I did for the Samsung batteries. Yours, Linus Walleij