Re: [PATCH v2 4/4] power: supply: Add Spreadtrum SC27XX fuel gauge unit driver

From: Linus Walleij
Date: Wed Sep 26 2018 - 04:09:36 EST

On Wed, Sep 26, 2018 at 5:00 AM Baolin Wang <> wrote:

> This patch adds the Spreadtrum SC27XX serial PMICs fuel gauge support,
> which is used to calculate the battery capacity.
> Original-by: Yuanjiang Yu <yuanjiang.yu@xxxxxxxxxx>
> Signed-off-by: Baolin Wang <>
> ---
> Changes from v1:
> - Use battery standard properties to get internal resistance and ocv table.
> - Change devm_gpiod_get_optional() to devm_gpiod_get().
> - Add power_supply_changed() when detecting battery present change.
> - Return micro volts for sc27xx_fgu_get_vbat_ocv().

Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

I see that you need to have the internal resistance as parameter to
this equation so it needs to come in. (I guess as factor/typical
internal resistance as suggested.)

IIUC this reliance on an uncertain internal resistance is the reason
why fuel gauges / coloumb counters are seen as crude ways to
estimate battery capacity, and their accuracy and reliability worsen
over the lifetime of the battery, and this is why safety-critical devices
include ways to measure the internal resistance as well.

But the hardware is as it is, and probably for some good reasons,
like cost.

Linus Walleij