summaryrefslogtreecommitdiff
path: root/common/battery_v2.c
diff options
context:
space:
mode:
authorTim Van Patten <timvp@google.com>2022-06-14 17:13:52 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-15 17:45:07 +0000
commitf119e0eb408baa4230f8d6a724966bbc5eca5e83 (patch)
tree725cc2f945fcd7f0ff1a6a169d948260f57a569c /common/battery_v2.c
parente1d5970ad8ab0e80de6fc7f48b2c0bd7de4b882b (diff)
downloadchrome-ec-f119e0eb408baa4230f8d6a724966bbc5eca5e83.tar.gz
battery: Set battery cutoff flag
When the command `ectool batterycutoff` is issued, set a flag in the ACPI memory mapped area so ACPI code can respond appriopriately (for example, throttling the SOC). This allows us to test that a device can boot without a battery connected. BUG=b:217911928 TEST=ectool batterycutoff BRANCH=none Change-Id: Ie73ee9bd930d78b4d84040cc0e31c42a89f8259e Signed-off-by: Tim Van Patten <timvp@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3704470 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com>
Diffstat (limited to 'common/battery_v2.c')
-rw-r--r--common/battery_v2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/battery_v2.c b/common/battery_v2.c
index 4d4a14e113..67bfedab4c 100644
--- a/common/battery_v2.c
+++ b/common/battery_v2.c
@@ -367,6 +367,9 @@ void update_dynamic_battery_info(void)
tmp |= curr->batt_is_charging ? EC_BATT_FLAG_CHARGING :
EC_BATT_FLAG_DISCHARGING;
+ if (battery_is_cut_off())
+ tmp |= EC_BATT_FLAG_CUT_OFF;
+
/* Tell the AP to re-read battery status if charge state changes */
if (bd->flags != tmp)
send_batt_status_event++;