mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-14 16:46:23 +00:00
meowth: zoombini: Ignore AC when checking cutoff.
When charge manager safe mode is enabled, it prevents us from selecting CHARGE_PORT_NONE if we have a battery which is disconnected/cutoff. The cutoff reporting code was essentially making the assumption that if AC is not present, then we must be running off of battery power. However, AC presence is debounced and can take some time to be reported to the system. Therefore, we may wrongly assume that we are running off of battery power and cut off our AC power source. This commit simply removes that assumption and still consults the battery regarding the cutoff/disconnect state. BUG=b:74125001 BRANCH=stabilize-meowth-10444.B TEST=flash meowth; cutoff battery, insert AC, verify system comes up. Verify that CHARGE_PORT_NONE is not selected until battery wakes up. Change-Id: I79a27bd2d5f09c2ffe65df98402c0ae0182fdba2 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/957888 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
37102a87fb
commit
a96fbd0c97
@@ -89,30 +89,26 @@ enum battery_disconnect_state battery_get_disconnect_state(void)
|
||||
if (not_disconnected)
|
||||
return BATTERY_NOT_DISCONNECTED;
|
||||
|
||||
if (extpower_is_present()) {
|
||||
/* Check if battery charging + discharging is disabled. */
|
||||
rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
|
||||
SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
|
||||
if (rv)
|
||||
return BATTERY_DISCONNECT_ERROR;
|
||||
if (~data[3] & (BATTERY_DISCHARGING_DISABLED |
|
||||
BATTERY_CHARGING_DISABLED)) {
|
||||
not_disconnected = 1;
|
||||
return BATTERY_NOT_DISCONNECTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Battery is neither charging nor discharging. Verify that
|
||||
* we didn't enter this state due to a safety fault.
|
||||
*/
|
||||
rv = sb_read_mfgacc(PARAM_SAFETY_STATUS,
|
||||
SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
|
||||
if (rv || data[2] || data[3] || data[4] || data[5])
|
||||
return BATTERY_DISCONNECT_ERROR;
|
||||
|
||||
/* No safety fault, battery is disconnected */
|
||||
return BATTERY_DISCONNECTED;
|
||||
/* Check if battery charging + discharging is disabled. */
|
||||
rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
|
||||
SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
|
||||
if (rv)
|
||||
return BATTERY_DISCONNECT_ERROR;
|
||||
if (~data[3] & (BATTERY_DISCHARGING_DISABLED |
|
||||
BATTERY_CHARGING_DISABLED)) {
|
||||
not_disconnected = 1;
|
||||
return BATTERY_NOT_DISCONNECTED;
|
||||
}
|
||||
not_disconnected = 1;
|
||||
return BATTERY_NOT_DISCONNECTED;
|
||||
|
||||
/*
|
||||
* Battery is neither charging nor discharging. Verify that
|
||||
* we didn't enter this state due to a safety fault.
|
||||
*/
|
||||
rv = sb_read_mfgacc(PARAM_SAFETY_STATUS,
|
||||
SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
|
||||
if (rv || data[2] || data[3] || data[4] || data[5])
|
||||
return BATTERY_DISCONNECT_ERROR;
|
||||
|
||||
/* No safety fault, battery is disconnected */
|
||||
return BATTERY_DISCONNECTED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user