]> git.baikalelectronics.ru Git - kernel.git/commit
power: supply: axp20x_battery: properly report current when discharging
authorEvgeny Boger <boger@wirenboard.com>
Wed, 12 Jan 2022 08:47:27 +0000 (11:47 +0300)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 1 Feb 2022 10:18:47 +0000 (11:18 +0100)
commit35f44305769932c2b448bf424be6fb9eb4e740e1
tree48fe5ff3769e1ff50f44d6e08b56241902bb2952
parentc55adddebb4f22c52e3e483cfe338e3eabfaa373
power: supply: axp20x_battery: properly report current when discharging

As stated in [1], negative current values are used for discharging
batteries.

AXP PMICs internally have two different ADC channels for shunt current
measurement: one used during charging and one during discharging.
The values reported by these ADCs are unsigned.
While the driver properly selects ADC channel to get the data from,
it doesn't apply negative sign when reporting discharging current.

[1] Documentation/ABI/testing/sysfs-class-power

Signed-off-by: Evgeny Boger <boger@wirenboard.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/axp20x_battery.c