power: supply: cpcap-charger: Provide state updates for battery from charger
authorTony Lindgren <tony@atomide.com>
Sun, 10 Jan 2021 19:53:57 +0000 (21:53 +0200)
committerSebastian Reichel <sre@kernel.org>
Thu, 14 Jan 2021 22:42:42 +0000 (23:42 +0100)
commit2071236b8519673a276ecbf7f60a6f7da7e5cd8a
treeb26d66e593f1d532f353b2c9751dd954907ae735
parent6ddcec581fdc1b9026dd1996b9f8b834c11d868f
power: supply: cpcap-charger: Provide state updates for battery from charger

We want to have the battery update it's status when the charge is done,
and when the charger is disconnected. Otherwise the battery does not know
when it's full unless there's a userspace app polling the battery status.

To do this, we add supplied_to handling to cpcap-battery, and implement
power_supply_changed() for cpcap-charger. When cpcap-charger calls
power_supply_changed(), cpcap-battery will update it's status.

Let's also use new_state variable for the POWER_SUPPLY_STATUS_CHARGING
case to have unified handling for the switch.

Cc: Arthur Demchenkov <spinal.by@gmail.com>
Cc: Carl Philipp Klemm <philipp@uvos.xyz>
Cc: Merlijn Wajer <merlijn@wizzup.org>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/cpcap-battery.c
drivers/power/supply/cpcap-charger.c