WSL2-Linux-Kernel/include/linux/power
Hans de Goede 75a7e9de60 power: supply: bq27xxx: Ensure power_supply_changed() is called on current sign changes
[ Upstream commit 939a116142 ]

On gauges where the current register is signed, there is no charging
flag in the flags register. So only checking flags will not result
in power_supply_changed() getting called when e.g. a charger is plugged
in and the current sign changes from negative (discharging) to
positive (charging).

This causes userspace's notion of the status to lag until userspace
does a poll.

And when a power_supply_leds.c LED trigger is used to indicate charging
status with a LED, this LED will lag until the capacity percentage
changes, which may take many minutes (because the LED trigger only is
updated on power_supply_changed() calls).

Fix this by calling bq27xxx_battery_current_and_status() on gauges with
a signed current register and checking if the status has changed.

Fixes: 297a533b3e ("bq27x00: Cache battery registers")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-05 09:21:12 +02:00
..
bq27xxx_battery.h power: supply: bq27xxx: Ensure power_supply_changed() is called on current sign changes 2023-06-05 09:21:12 +02:00
bq2415x_charger.h power: fix duplicated words in bq2415x_charger.h 2020-07-27 00:10:14 +02:00
bq24190_charger.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
bq24735-charger.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
charger-manager.h power: supply: charger-manager: Update extcon functions 2020-08-28 19:27:45 +02:00
generic-adc-battery.h power: supply: generic-adc-battery: Use GPIO descriptors 2020-11-30 02:42:42 +01:00
gpio-charger.h power: supply: gpio-charger: Convert to GPIO descriptors 2020-08-27 16:47:14 +02:00
jz4740-battery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151 2019-05-30 11:26:28 -07:00
max17042_battery.h power: supply: max17042_battery: more robust chip type checks 2021-08-17 15:33:52 +02:00
sbs-battery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
smartreflex.h soc: ti: Remove pm_runtime_irq_safe() usage for smartreflex 2021-08-10 15:51:22 -07:00
twl4030_madc_battery.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151 2019-05-30 11:26:28 -07:00