mirror of https://gitee.com/openkylin/linux.git
power: supply: charger-manager: Collect all power_supply_changed() calls
Current charger-manager calls power_supply_changed() whenever charging status is changed. Remove the separated power_supply_changed() calls and let it be called at end of try_charger_enable() function which is called to set charging/discharging. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
0a9e0f94bf
commit
dfc63825aa
|
@ -406,8 +406,10 @@ static int try_charger_enable(struct charger_manager *cm, bool enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err) {
|
||||||
cm->charger_enabled = enable;
|
cm->charger_enabled = enable;
|
||||||
|
power_supply_changed(cm->charger_psy);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -460,10 +462,8 @@ static void fullbatt_vchk(struct charger_manager *cm)
|
||||||
|
|
||||||
dev_info(cm->dev, "VBATT dropped %duV after full-batt\n", diff);
|
dev_info(cm->dev, "VBATT dropped %duV after full-batt\n", diff);
|
||||||
|
|
||||||
if (diff > desc->fullbatt_vchkdrop_uV) {
|
if (diff > desc->fullbatt_vchkdrop_uV)
|
||||||
try_charger_restart(cm);
|
try_charger_restart(cm);
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -493,7 +493,6 @@ static int check_charging_duration(struct charger_manager *cm)
|
||||||
if (duration > desc->charging_max_duration_ms) {
|
if (duration > desc->charging_max_duration_ms) {
|
||||||
dev_info(cm->dev, "Charging duration exceed %ums\n",
|
dev_info(cm->dev, "Charging duration exceed %ums\n",
|
||||||
desc->charging_max_duration_ms);
|
desc->charging_max_duration_ms);
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
try_charger_enable(cm, false);
|
try_charger_enable(cm, false);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +503,6 @@ static int check_charging_duration(struct charger_manager *cm)
|
||||||
is_ext_pwr_online(cm)) {
|
is_ext_pwr_online(cm)) {
|
||||||
dev_info(cm->dev, "Discharging duration exceed %ums\n",
|
dev_info(cm->dev, "Discharging duration exceed %ums\n",
|
||||||
desc->discharging_max_duration_ms);
|
desc->discharging_max_duration_ms);
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
try_charger_enable(cm, true);
|
try_charger_enable(cm, true);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
@ -613,8 +611,7 @@ static bool _cm_monitor(struct charger_manager *cm)
|
||||||
*/
|
*/
|
||||||
if (temp_alrt) {
|
if (temp_alrt) {
|
||||||
cm->emergency_stop = temp_alrt;
|
cm->emergency_stop = temp_alrt;
|
||||||
if (!try_charger_enable(cm, false))
|
try_charger_enable(cm, false);
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check whole charging duration and discharging duration
|
* Check whole charging duration and discharging duration
|
||||||
|
@ -639,16 +636,13 @@ static bool _cm_monitor(struct charger_manager *cm)
|
||||||
} else if (!cm->emergency_stop && is_full_charged(cm) &&
|
} else if (!cm->emergency_stop && is_full_charged(cm) &&
|
||||||
cm->charger_enabled) {
|
cm->charger_enabled) {
|
||||||
dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n");
|
dev_info(cm->dev, "EVENT_HANDLE: Battery Fully Charged\n");
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
|
|
||||||
try_charger_enable(cm, false);
|
try_charger_enable(cm, false);
|
||||||
|
|
||||||
fullbatt_vchk(cm);
|
fullbatt_vchk(cm);
|
||||||
} else {
|
} else {
|
||||||
cm->emergency_stop = 0;
|
cm->emergency_stop = 0;
|
||||||
if (is_ext_pwr_online(cm)) {
|
if (is_ext_pwr_online(cm)) {
|
||||||
if (!try_charger_enable(cm, true))
|
try_charger_enable(cm, true);
|
||||||
power_supply_changed(cm->charger_psy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue