power: supply: cw2015: avoid frequent psy change report

Signed-off-by: Chen Shunqing <csq@rock-chips.com>
Change-Id: I63bedab66cb7c65a54ba10c1c2fb0970d32a9d31
This commit is contained in:
Chen Shunqing
2021-12-21 15:45:18 +08:00
committed by Tao Huang
parent 325213d280
commit dc6c7a9c42

View File

@@ -411,13 +411,12 @@ static void cw_update_time_to_empty(struct cw_battery *cw_bat)
int time_to_empty;
time_to_empty = cw_get_time_to_empty(cw_bat);
if (time_to_empty < 0)
if (time_to_empty < 0) {
dev_err(cw_bat->dev, "Failed to get time to empty from gauge: %d\n",
time_to_empty);
else if (cw_bat->time_to_empty != time_to_empty) {
cw_bat->time_to_empty = time_to_empty;
cw_bat->battery_changed = true;
return;
}
cw_bat->time_to_empty = time_to_empty;
}
static void cw_bat_work(struct work_struct *work)