summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-06-21 03:58:41 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-27 22:54:20 +0000
commitf8171d72f30392807af3b69450b7153ef0b1082f (patch)
tree6eaeb90e1d4b0a230127284dc6888f8816e7a580
parent9924b19d6fa21d4c7b807017b30c3ee07a204733 (diff)
downloadchrome-ec-f8171d72f30392807af3b69450b7153ef0b1082f.tar.gz
samus: temporary fix to allow dead battery charging w/o AC PRESENT signal
This is a temporary workaround to allow dead battery charging without an AC PRESENT signal by delaying going into hibernate with an extremely low value in order to check if AC is present by waiting for PD MCU. BUG=chrome-os-partner:29842 BRANCH=none TEST=Test with a dead battery that when you plug in AC and reboot, it is able to charge. Previous to this change with a dead battery and AC plugged in the EC would boot and almost immediately go back into hibernate Change-Id: I338a0cc9ee37dab3e6caf29369ac6e819772ca91 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205147 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/charge_state_v2.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 94d53a90cb..ba88aabc2d 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -387,6 +387,23 @@ static inline int battery_too_low(void)
curr.batt.voltage <= batt_info->voltage_min));
}
+#ifdef BOARD_SAMUS
+/*
+ * TODO(crosbug.com/p/29842): remove this workaround once the AC_PRESENT
+ * input is avaible.
+ */
+static void check_deep_discharge_again(void)
+{
+ /* Check again if power is present */
+ if (!extpower_is_present()) {
+ /* AP is off, so shut down the EC now */
+ CPRINTS("charge force EC hibernate due to low battery");
+ system_hibernate(0, 0);
+ }
+}
+DECLARE_DEFERRED(check_deep_discharge_again);
+#endif
+
/* Shut everything down before the battery completely dies. */
static void prevent_deep_discharge(void)
{
@@ -394,9 +411,17 @@ static void prevent_deep_discharge(void)
return;
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+#ifdef BOARD_SAMUS
+ /*
+ * TODO(crosbug.com/p/29842): remove this workaround once
+ * the AC_PRESENT input is avaible.
+ */
+ hook_call_deferred(check_deep_discharge_again, 10*SECOND);
+#else
/* AP is off, so shut down the EC now */
CPRINTS("charge force EC hibernate due to low battery");
system_hibernate(0, 0);
+#endif
} else if (!shutdown_warning_time.val) {
/* Warn AP battery level is so low we'll shut down */
CPRINTS("charge warn shutdown due to low battery");