power: rk817-battery: update battery info after plug in/out charger

Signed-off-by: Shunqing Chen <csq@rock-chips.com>
Change-Id: I205804856ca13fa8b3e8a951534dc4ed63a2c852
This commit is contained in:
Shunqing Chen 2020-11-21 08:21:16 +00:00 committed by Tao Huang
parent a02f20c268
commit 6f16b5cc75

View File

@ -620,6 +620,7 @@ struct rk817_battery_device {
int plugout_irq;
int chip_id;
int is_register_chg_psy;
bool change; /* Battery status change, report information */
};
static u64 get_boot_sec(void)
@ -2218,9 +2219,10 @@ static void rk817_bat_power_supply_changed(struct rk817_battery_device *battery)
else if (battery->dsoc < 0)
battery->dsoc = 0;
if (battery->dsoc == old_soc)
if (battery->dsoc == old_soc && !battery->change)
return;
battery->change = false;
old_soc = battery->dsoc;
battery->last_dsoc = battery->dsoc;
power_supply_changed(battery->bat);
@ -2271,6 +2273,7 @@ rk817_bat_update_charging_status(struct rk817_battery_device *battery)
if (is_charging == battery->is_charging)
return;
battery->change = true;
battery->is_charging = is_charging;
if (is_charging)
battery->charge_count++;