lkml.org 
[lkml]   [2021]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v3 7/9] power: supply: add simple-gauge for SOC estimation and CC correction
On Tue, Nov 16, 2021 at 1:28 PM Matti Vaittinen
<matti.vaittinen@fi.rohmeurope.com> wrote:

> Add generic 'simple gauge' helper for performing iterative SOC estimation
> and coulomb counter correction for devices with a (drifting) coulomb
> counter. This should allow few charger/fuel-gauge drivers to use generic
> loop instead of implementing their own.
>
> Charger/fuel-gauge drivers can register 'simple-gauge' which does
> periodically poll the driver and:
> - get battery state
> - adjust coulomb counter value (to fix drifting caused for example by ADC
> offset) if:
> - Battery is relaxed and OCV<=>SOC table is given
> - Battery is full charged
> - get battery age (cycles) from driver
> - get battery temperature
> - do battery capacity correction
> - by battery temperature
> - by battery age
> - by computed Vbat/OCV difference at low-battery condition if
> low-limit is set and OCV table given
> - by IC specific low-battery correction if provided
> - compute current State Of Charge (SOC)
> - do periodical calibration if IC supports that. (Many ICs do calibration
> of CC by shorting the ADC pins and getting the offset).
> - provide the user-space a consistent interface for getting/setting the
> battery-cycle information for ICs which can't store the battery aging
> information. Uses POWER_SUPPLY_PROP_CYCLE_COUNT for this.
>
> The simple gauge provides the last computed SOC as
> POWER_SUPPLY_PROP_CAPACITY to power_supply_class when requested.
>
> Things that should/could be added but are missing from this commit:
> - Support starting calibration in HW when entering to suspend. This
> is useful for ICs supporting delayed calibration to mitigate CC error
> during suspend - and to make periodical wake-up less critical.
> - periodical wake-up for performing SOC estimation computation (RTC
> integration)
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

This is the right ambition, I haven't looked close at it but the way
you use it seem to be what you need, so:
Acked-by: Linus Walleij <linus.walleij@linaro.org>
(and the rest of the patches to the Rohm chips)

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2021-11-19 02:55    [W:0.319 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site