diff options
author | Philip Chen <philipchen@google.com> | 2018-05-23 20:18:59 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-05-25 23:45:57 +0000 |
commit | 37168486d3f5543b5dd7a8e5d819c68c4c68c5b0 (patch) | |
tree | 1e5f6714423bd3ce84ba99ed68db5abe69396373 | |
parent | c6b6626cdccef04b0ff203aaed0d84dbdcecf8b7 (diff) | |
download | chrome-ec-37168486d3f5543b5dd7a8e5d819c68c4c68c5b0.tar.gz |
scarlet: Disable idle mode in a special case
When AC is plugged, battery is full and AP is off,
there is a small chance that rt946x would be damaged.
I'm told that consuming more current in this case would
mitigate the issue. So let's disable idle mode in this case.
BUG=b:78792296
BRANCH=scarlet
TEST=manually test on scarlet and confirm idle mode is disabled
in the described special case
Change-Id: Idc3a3165ebaa2f99bdd5df56675c3945eaeae9fa
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1071124
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
-rw-r--r-- | board/scarlet/battery.c | 20 | ||||
-rw-r--r-- | board/scarlet/board.h | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c index 25b161dee2..62a733e463 100644 --- a/board/scarlet/battery.c +++ b/board/scarlet/battery.c @@ -8,6 +8,7 @@ #include "battery.h" #include "battery_smart.h" #include "charge_state.h" +#include "chipset.h" #include "console.h" #include "driver/battery/max17055.h" #include "driver/charger/rt946x.h" @@ -15,6 +16,7 @@ #include "extpower.h" #include "gpio.h" #include "hooks.h" +#include "system.h" #include "util.h" /* @@ -248,13 +250,29 @@ int charger_profile_override(struct charge_state_data *curr) * BATTERY_LEVEL_NEAR_FULL. So we can ensure both Chrome OS UI * and battery LED indicate full charge. */ - if (rt946x_is_charge_done()) + if (rt946x_is_charge_done()) { curr->batt.state_of_charge = MAX(BATTERY_LEVEL_NEAR_FULL, curr->batt.state_of_charge); + /* + * This is a workaround for b:78792296. When AP is off and + * charge termination is detected, we disable idle mode. + */ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF | + CHIPSET_STATE_ANY_SUSPEND)) + disable_idle(); + else + enable_idle(); + } return 0; } +static void board_enable_idle(void) +{ + enable_idle(); +} +DECLARE_HOOK(HOOK_AC_CHANGE, board_enable_idle, HOOK_PRIO_DEFAULT); + static void board_charge_termination(void) { static uint8_t te; diff --git a/board/scarlet/board.h b/board/scarlet/board.h index eb4ba03d97..278f3cb016 100644 --- a/board/scarlet/board.h +++ b/board/scarlet/board.h @@ -23,6 +23,7 @@ #define CONFIG_I2C_PASSTHRU_RESTRICTED #define CONFIG_LED_COMMON #define CONFIG_LOW_POWER_IDLE +#define CONFIG_LOW_POWER_IDLE_LIMITED #define CONFIG_POWER_COMMON #define CONFIG_SPI #define CONFIG_SPI_MASTER |