summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-05-08 18:52:33 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-11 23:22:15 -0700
commit0b6da3c5d846cd163b47536bd789b0bdc94a5040 (patch)
tree232c509366fb994d10fc791ddec3f72a1110ab5c
parent344e8220b51261e17381af77bc2248ea83233ef0 (diff)
downloadchrome-ec-0b6da3c5d846cd163b47536bd789b0bdc94a5040.tar.gz
charge_state_v2: keep track of AC_PRESENT flag
the EC should not clear the AC_PRESENT flag in the ACPI flags when we know that we're on a charger. ACPI rules on the AP side do special things when they see AC_PRESENT off, like forcing the EC to limit the charge current to 512mA. BUG=b:78509594 BRANCH=none TEST=chargestate current no longer stuck at 512mA Change-Id: I54ddea6d2661a9d6b1593431a5912a8a60db572d Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1050917 Commit-Ready: Caveh Jalali <caveh@google.com> Tested-by: Caveh Jalali <caveh@google.com> Reviewed-by: Duncan Laurie <dlaurie@google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/charge_state_v2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 958257ea71..f5da9b8873 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -696,6 +696,7 @@ static int update_static_battery_info(void)
{
char *batt_str;
int batt_serial;
+ uint8_t batt_flags = 0;
/*
* The return values have type enum ec_error_list, but EC_SUCCESS is
* zero. We'll just look for any failures so we can try them all again.
@@ -743,7 +744,9 @@ static int update_static_battery_info(void)
*(int *)host_get_memmap(EC_MEMMAP_BATT_RATE) = 0;
*(int *)host_get_memmap(EC_MEMMAP_BATT_CAP) = 0;
*(int *)host_get_memmap(EC_MEMMAP_BATT_LFCC) = 0;
- *host_get_memmap(EC_MEMMAP_BATT_FLAG) = 0;
+ if (extpower_is_present())
+ batt_flags |= EC_BATT_FLAG_AC_PRESENT;
+ *host_get_memmap(EC_MEMMAP_BATT_FLAG) = batt_flags;
if (rv)
problem(PR_STATIC_UPDATE, rv);