summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-03-09 21:36:38 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-10 20:00:23 +0000
commitee972e4f32d3b19ed9a6104459ab420c4e8782ec (patch)
tree2ab64bce85ab2a382a63eea3ba28e7ac5d09f19d /common
parent91dea358f4b0c8a8c8d3daf1dbe4d71524730ce2 (diff)
downloadchrome-ec-ee972e4f32d3b19ed9a6104459ab420c4e8782ec.tar.gz
charge_state_v2: Guard system_hibernate call with CONFIG_HIBERNATE
This change guards the call to `system_hibernate` with IS_ENABLED(CONFIG_HIBERNATE). This is to ensure that boards are not forced to provide the implementation of `system_hiberate` if CONFIG_HIBERNATE is not selected. It allows early bring up boards to enable charger functionality without enabling hibernation at the same time. BUG=b:173575131 BRANCH=None TEST=make -j buildall Signed-off-by: Furquan Shaikh <furquan@google.com> Change-Id: Idcccd3904e9b25f6aa4e06dc90a4845a1a87b2c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748034 Auto-Submit: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_state_v2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 8d256a3cb2..7d97cafba7 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1455,8 +1455,10 @@ static int shutdown_on_critical_battery(void)
if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
switch (board_critical_shutdown_check(&curr)) {
case CRITICAL_SHUTDOWN_HIBERNATE:
- CPRINTS("Hibernate due to critical battery");
- system_hibernate(0, 0);
+ if (IS_ENABLED(CONFIG_HIBERNATE)) {
+ CPRINTS("Hibernate due to critical battery");
+ system_hibernate(0, 0);
+ }
break;
case CRITICAL_SHUTDOWN_CUTOFF:
CPRINTS("Cutoff due to critical battery");