diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-02-25 12:56:40 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-06 06:51:30 -0800 |
commit | dcd378e1cde499fe3c33efd98bd7e737b034ff77 (patch) | |
tree | 8f8f022e28de1986e604faae0440d49ca5e7f5c9 /board/scarlet | |
parent | f2ea9714253427c81f9d154d0502d0d10124a8d2 (diff) | |
download | chrome-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 'board/scarlet')
-rw-r--r-- | board/scarlet/board.c | 10 | ||||
-rw-r--r-- | board/scarlet/board.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 7f217bcd80..80a3a73c4e 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -137,10 +137,14 @@ void board_reset_pd_mcu(void) { } -int board_critical_shutdown_check(struct charge_state_data *curr) +enum critical_shutdown board_critical_shutdown_check( + struct charge_state_data *curr) { - return ((curr->batt.flags & BATT_FLAG_BAD_VOLTAGE) || - (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH)); + if ((curr->batt.flags & BATT_FLAG_BAD_VOLTAGE) || + (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH)) + return CRITICAL_SHUTDOWN_CUTOFF; + else + return CRITICAL_SHUTDOWN_IGNORE; } uint16_t tcpc_get_alert_status(void) diff --git a/board/scarlet/board.h b/board/scarlet/board.h index 1d7e8203de..c5698fd096 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -119,8 +119,6 @@ #define CONFIG_USBC_VCONN_SWAP #define CONFIG_USB_PD_COMM_LOCKED -#define CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF -#define CONFIG_BATTERY_CRITICAL_CUT_OFF_CUSTOM_CONDITION #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_PRESENT_CUSTOM #define CONFIG_BATTERY_RETRY_NACK |