mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
power: android-battery: leave full/not-charging status when charger re-sensed
If charger was connected and a charge source change event occurs such that the charger is still connected (or a different charge source connected), do not overwrite an existing state such as full or not-charging. Only switch from discharging to charging on a charge source change event. Change-Id: I1b841c8f3a92bf15074999e18b17d1d19ce028d7 Signed-off-by: Todd Poynor <toddpoynor@google.com>
This commit is contained in:
committed by
Arve Hjønnevåg
parent
dfbc90e2a9
commit
8873f5de28
@@ -399,8 +399,18 @@ static void android_bat_charger_work(struct work_struct *work)
|
||||
break;
|
||||
case CHARGE_SOURCE_USB:
|
||||
case CHARGE_SOURCE_AC:
|
||||
battery->charging_status = POWER_SUPPLY_STATUS_CHARGING;
|
||||
android_bat_enable_charging(battery, true);
|
||||
/*
|
||||
* If charging status indicates a charger was already
|
||||
* connected prior to this and a non-charging status is
|
||||
* set, leave the status alone.
|
||||
*/
|
||||
if (battery->charging_status ==
|
||||
POWER_SUPPLY_STATUS_DISCHARGING ||
|
||||
battery->charging_status == POWER_SUPPLY_STATUS_UNKNOWN) {
|
||||
battery->charging_status = POWER_SUPPLY_STATUS_CHARGING;
|
||||
android_bat_enable_charging(battery, true);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: Invalid charger type\n", __func__);
|
||||
|
||||
Reference in New Issue
Block a user