summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2019-06-10 15:10:05 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-18 01:47:41 +0000
commit1bf21560c3c396c670686673682b2a011e7ca14d (patch)
tree1a1bca105131a885dd50e1f64b8499e6b34796bf
parent5a081eb86d7d3de4b55af6a04bb127d5ea0ab35f (diff)
downloadchrome-ec-1bf21560c3c396c670686673682b2a011e7ca14d.tar.gz
Kefka: Wake up from hibernation periodically
This patch makes EC wake up from hibernation every 23 hours. EC will go back to hibernation after it's left idle for 60 minutes. This cycle will be repeated until a battery reaches critical level. When battery reaches the critical level, EC cuts off a battery. If a charger is plugged, EC stays in G3. This is not a new behavior. If a power button is pressed, EC should continue to boot. This patch also - Enables battery cutoff on critical charge. - Sets critical charge level to 6% (5% to cutoff) - Disables pseudo G3 (to enable chip hibernation) Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/128455667,b/134973675 BRANCH=strago TEST=Verify sabin repeats hibernate and wake-up periodically. TEST=Verify sabin boots from hibernation when a power button is pressed. Change-Id: I472c406bd709a1ed2e24f0923360ec4ad239ec26 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1652497 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--board/kefka/board.c6
-rw-r--r--board/kefka/board.h4
-rw-r--r--include/config.h5
-rw-r--r--power/common.c4
4 files changed, 16 insertions, 3 deletions
diff --git a/board/kefka/board.c b/board/kefka/board.c
index fc10a2caac..54b37afe8e 100644
--- a/board/kefka/board.c
+++ b/board/kefka/board.c
@@ -280,3 +280,9 @@ static void get_motion_sensors_count(void)
motion_sensor_count = 0;
}
DECLARE_HOOK(HOOK_INIT, get_motion_sensors_count, HOOK_PRIO_FIRST);
+
+uint8_t board_set_battery_level_shutdown(void)
+{
+ /* Cut off at 5% */
+ return 6;
+}
diff --git a/board/kefka/board.h b/board/kefka/board.h
index e2da997539..d759fb9f56 100644
--- a/board/kefka/board.h
+++ b/board/kefka/board.h
@@ -34,7 +34,7 @@
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_LID_SWITCH
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_LOW_POWER_PSEUDO_G3
+#undef CONFIG_LOW_POWER_PSEUDO_G3
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HOST_EVENT
#define CONFIG_POWER_COMMON
@@ -73,6 +73,8 @@
#define CONFIG_CHARGER_INPUT_CURRENT 3136
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
+#define CONFIG_HIBERNATE_PERIOD (3600 * 23)
+#define CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF
#define CONFIG_PWM
#define CONFIG_LED_COMMON
diff --git a/include/config.h b/include/config.h
index eb667a17da..13371d1dbc 100644
--- a/include/config.h
+++ b/include/config.h
@@ -994,6 +994,11 @@
#define CONFIG_HIBERNATE_DELAY_SEC 3600
/*
+ * Duration in hibernation
+ */
+#undef CONFIG_HIBERNATE_PERIOD
+
+/*
* Use to define going in to hibernate early if low on battery.
* CONFIG_HIBERNATE_BATT_PCT specifies the low battery threshold
* for going into hibernate early, and CONFIG_HIBERNATE_BATT_SEC defines
diff --git a/power/common.c b/power/common.c
index 318367a876..7e304c116b 100644
--- a/power/common.c
+++ b/power/common.c
@@ -180,11 +180,11 @@ static enum power_state power_common_state(enum power_state state)
switch (board_system_is_idle(last_shutdown_time,
&target, now)) {
case CRITICAL_SHUTDOWN_HIBERNATE:
+ CPRINTS("Hibernating");
#ifdef CONFIG_LOW_POWER_PSEUDO_G3
enter_pseudo_g3();
#else
- CPRINTS("hibernating");
- system_hibernate(0, 0);
+ system_hibernate(CONFIG_HIBERNATE_PERIOD, 0);
#endif
break;
#ifdef CONFIG_BATTERY_CUT_OFF