diff options
author | Matthias Schiffer <matthias.schiffer@ew.tq-group.com> | 2021-03-03 12:54:19 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-05-22 11:59:16 +0300 |
commit | b10f94efbd4decc45925a93953d50ddd5fb29fd1 (patch) | |
tree | 16c01615d98d4dd5810c48323984bf5b55355787 /include/linux/power/bq27xxx_battery.h | |
parent | b52f081fcb424adb73c306a0f74a6137d47bc8ff (diff) | |
download | linux-b10f94efbd4decc45925a93953d50ddd5fb29fd1.tar.xz |
power: supply: bq27xxx: fix power_avg for newer ICs
[ Upstream commit c4d57c22ac65bd503716062a06fad55a01569cac ]
On all newer bq27xxx ICs, the AveragePower register contains a signed
value; in addition to handling the raw value as unsigned, the driver
code also didn't convert it to µW as expected.
At least for the BQ28Z610, the reference manual incorrectly states that
the value is in units of 1mW and not 10mW. I have no way of knowing
whether the manuals of other supported ICs contain the same error, or if
there are models that actually use 1mW. At least, the new code shouldn't
be *less* correct than the old version for any device.
power_avg is removed from the cache structure, se we don't have to
extend it to store both a signed value and an error code. Always getting
an up-to-date value may be desirable anyways, as it avoids inconsistent
current and power readings when switching between charging and
discharging.
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/power/bq27xxx_battery.h')
-rw-r--r-- | include/linux/power/bq27xxx_battery.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h index d6355f49fbae..13d5dd4eb40b 100644 --- a/include/linux/power/bq27xxx_battery.h +++ b/include/linux/power/bq27xxx_battery.h @@ -49,7 +49,6 @@ struct bq27xxx_reg_cache { int capacity; int energy; int flags; - int power_avg; int health; }; |