summaryrefslogtreecommitdiff
path: root/include/charge_state_v2.h
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2019-02-25 12:56:40 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-06 06:51:30 -0800
commitdcd378e1cde499fe3c33efd98bd7e737b034ff77 (patch)
tree8f8f022e28de1986e604faae0440d49ca5e7f5c9 /include/charge_state_v2.h
parentf2ea9714253427c81f9d154d0502d0d10124a8d2 (diff)
downloadchrome-ec-dcd378e1cde499fe3c33efd98bd7e737b034ff77.tar.gz
chgstv2: Make board_critical_shutdown_check specify action on critical soc
Currently, board_critical_shutdown_check is used only in the context of CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF. It returns true to cutoff the battery or false to take no action. This patch extends board_critical_shutdown_check to allow it to control what actions to take on critical battery condition. With this change, each board can also customize critical battery actions with more granularity (per OEM, BOARD_VERSION, etc.). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/123727148 BRANCH=nami TEST=Verify a battery is cutoff at critical low charge on Scarlet and DUT wakes up by AC plugin on cros/firmware-scarlet-10388.B. Change-Id: Id49e860b05e21c3bfa4d75f27c48b55c2a3ad95f Reviewed-on: https://chromium-review.googlesource.com/1487113 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/charge_state_v2.h')
-rw-r--r--include/charge_state_v2.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index e3a43d8bcf..ec164ea507 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -110,10 +110,21 @@ void board_enable_base_power(int enable);
void board_base_reset(void);
/**
- * Don't cut off battery in critical battery condition when this
- * board-specific routine returns 0.
+ * Callback with which boards determine action on critical low battery
+ *
+ * The default implementation is provided in charge_state_v2.c. Overwrite it
+ * to customize it.
+ *
+ * @param curr Pointer to struct charge_state_data
+ * @return Action to take.
*/
-int board_critical_shutdown_check(struct charge_state_data *curr);
+enum critical_shutdown {
+ CRITICAL_SHUTDOWN_IGNORE,
+ CRITICAL_SHUTDOWN_HIBERNATE,
+ CRITICAL_SHUTDOWN_CUTOFF,
+};
+enum critical_shutdown board_critical_shutdown_check(
+ struct charge_state_data *curr);
-#endif /* __CROS_EC_CHARGE_STATE_V2_H */
+#endif /* __CROS_EC_CHARGE_STATE_V2_H */