summaryrefslogtreecommitdiff
path: root/board/scarlet
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2018-05-23 20:18:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-30 20:38:47 -0700
commit815251b070b5ab2d0c9a78ab659e02ce69ec50e8 (patch)
tree62d91c5a45917747368e6d89d750063776105de2 /board/scarlet
parente8f009b64b0b7bedc563b55efae296e3d59a15b9 (diff)
downloadchrome-ec-815251b070b5ab2d0c9a78ab659e02ce69ec50e8.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> (cherry picked from commit 37168486d3f5543b5dd7a8e5d819c68c4c68c5b0) Reviewed-on: https://chromium-review.googlesource.com/1076709 Commit-Ready: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'board/scarlet')
-rw-r--r--board/scarlet/battery.c20
-rw-r--r--board/scarlet/board.h1
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 db4330d521..a3c9683c7c 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