mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
poppy: Fix charger_profile_override
When battery is cutoff, it might at times require some current to be applied to it so that it can wake up. Thus, in case where all battery flags indicate error in charger_profile_override, set requested_current and requested_voltage to precharge_current and voltage max. This allows the battery to be woken up. BUG=b:64370648,b:64460667 BRANCH=None TEST=Verified that on connecting AC power after battery-cutoff, there are no "try to wake battery" messages anymore. Change-Id: Ib88369238b492994d8310655126e19bc7e347a0c Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/607034 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
c90eeada8a
commit
fdac380415
@@ -126,10 +126,19 @@ enum battery_disconnect_state battery_get_disconnect_state(void)
|
||||
int charger_profile_override(struct charge_state_data *curr)
|
||||
{
|
||||
const struct battery_info *batt_info;
|
||||
/* battery temp in 0.1 deg C */
|
||||
int bat_temp_c = curr->batt.temperature - 2731;
|
||||
int bat_temp_c;
|
||||
|
||||
batt_info = battery_get_info();
|
||||
|
||||
if ((curr->batt.flags & BATT_FLAG_BAD_ANY) == BATT_FLAG_BAD_ANY) {
|
||||
curr->requested_current = batt_info->precharge_current;
|
||||
curr->requested_voltage = batt_info->voltage_max;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
/* battery temp in 0.1 deg C */
|
||||
bat_temp_c = curr->batt.temperature - 2731;
|
||||
|
||||
/* Don't charge if outside of allowable temperature range */
|
||||
if (bat_temp_c >= batt_info->charging_max_c * 10 ||
|
||||
bat_temp_c < batt_info->charging_min_c * 10) {
|
||||
|
||||
Reference in New Issue
Block a user