summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorYilun Lin <yllin@chromium.org>2019-11-08 22:51:28 +0800
committerCommit Bot <commit-bot@chromium.org>2019-11-11 07:06:07 +0000
commitb6be04071411efc7d22c9b9d0d3fd44242278a04 (patch)
tree8170d496eccebe43d0e7042d1fef8f43791bc5ab /power
parenta9629611a9f8d3d301363683bc3e7db2fbbf769c (diff)
downloadchrome-ec-b6be04071411efc7d22c9b9d0d3fd44242278a04.tar.gz
power/mt8183: Need 1s pwrbtn press to exit off state
To prevent mispressed cases, we decide to increase the power button press boot time to at least 1s. TEST=aps; powerbtn $sec; where $sec is between 0~1000 and see it won't boot TEST=aps; powerbtn $sec; where $sec > 1000 and see it boot TEST=aps; ensures the physical power button press is working as expected. BUG=b:131856041 BRANCH=kukui Change-Id: Ie3099ba9639a729cee77b7d444a459fbef72733d Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1906387 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/mt8183.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/power/mt8183.c b/power/mt8183.c
index 892cc6d718..44012eeb6a 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -38,6 +38,11 @@
/* Long power key press to force shutdown in S0. go/crosdebug */
#define FORCED_SHUTDOWN_DELAY (10 * SECOND)
+/* Long power key press to boot from S5/G3 state. */
+#ifndef POWERBTN_BOOT_DELAY
+#define POWERBTN_BOOT_DELAY (1 * SECOND)
+#endif
+
#define CHARGER_INITIALIZED_DELAY_MS 100
#define CHARGER_INITIALIZED_TRIES 40
@@ -136,6 +141,14 @@ void chipset_force_shutdown_button(void)
}
DECLARE_DEFERRED(chipset_force_shutdown_button);
+void chipset_exit_hard_off_button(void)
+{
+ /* Power up from off */
+ forcing_shutdown = 0;
+ chipset_exit_hard_off();
+}
+DECLARE_DEFERRED(chipset_exit_hard_off_button);
+
/* If chipset needs to be reset, EC also reboots to RO. */
void chipset_reset(enum chipset_reset_reason reason)
{
@@ -447,17 +460,16 @@ enum power_state power_handle_state(enum power_state state)
static void power_button_changed(void)
{
if (power_button_is_pressed()) {
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
- /* Power up from off */
- forcing_shutdown = 0;
- chipset_exit_hard_off();
- }
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ hook_call_deferred(&chipset_exit_hard_off_button_data,
+ POWERBTN_BOOT_DELAY);
/* Delayed power down from S0/S3, cancel on PB release */
hook_call_deferred(&chipset_force_shutdown_button_data,
FORCED_SHUTDOWN_DELAY);
} else {
- /* Power button released, cancel deferred shutdown */
+ /* Power button released, cancel deferred shutdown/boot */
+ hook_call_deferred(&chipset_exit_hard_off_button_data, -1);
hook_call_deferred(&chipset_force_shutdown_button_data, -1);
}
}