]> git.ipfire.org Git - thirdparty/linux.git/commit
power: supply: bq27xxx: do not report bogus zero values
authorSicelo A. Mhlongo <absicsz@gmail.com>
Fri, 7 Feb 2025 21:51:44 +0000 (23:51 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 19 Feb 2025 23:49:51 +0000 (00:49 +0100)
commitf3974aca381e81c0b1418d8ecc12fa62e1e9d31f
tree9361491c29f26bb90331d850aa75938dc09a4b43
parent903599768a2c39bdd9976d41b4cbc89fbfc55e38
power: supply: bq27xxx: do not report bogus zero values

On the bq27x00 and bq27x10 variants, a number of conditions may reset the value
stored in the NAC register. This will cause capacity, energy, and charge to
report the value 0, even when the battery is full. On the other hand, the chip
also provides a flag, EDVF, which accurately detects the true battery empty
condition, when capacity, charge, and energy are really 0.  Therefore, discard
readings for these properties if their value is 0 while EDVF is unset.

Tested on the Nokia N900 with bq27200.

Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Link: https://lore.kernel.org/r/20250207220605.106768-1-absicsz@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq27xxx_battery.c