diff options
author | Yilun Lin <yllin@chromium.org> | 2019-11-08 22:51:28 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-11 07:06:07 +0000 |
commit | b6be04071411efc7d22c9b9d0d3fd44242278a04 (patch) | |
tree | 8170d496eccebe43d0e7042d1fef8f43791bc5ab | |
parent | a9629611a9f8d3d301363683bc3e7db2fbbf769c (diff) | |
download | chrome-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>
-rw-r--r-- | baseboard/kukui/baseboard.h | 4 | ||||
-rw-r--r-- | board/kodama/board.h | 1 | ||||
-rw-r--r-- | board/kukui/board.h | 1 | ||||
-rw-r--r-- | power/mt8183.c | 24 |
4 files changed, 24 insertions, 6 deletions
diff --git a/baseboard/kukui/baseboard.h b/baseboard/kukui/baseboard.h index 1c4028ecf4..43e95fe13f 100644 --- a/baseboard/kukui/baseboard.h +++ b/baseboard/kukui/baseboard.h @@ -167,6 +167,10 @@ #define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3) #endif /* VARIANT_KUKUI_NO_SENSORS */ +#ifndef VARIANT_KUKUI_TABLET_PWRBTN +#define POWERBTN_BOOT_DELAY 0 +#endif + /* USB PD config */ #define CONFIG_CHARGE_MANAGER #define CONFIG_USB_POWER_DELIVERY diff --git a/board/kodama/board.h b/board/kodama/board.h index ff71117cb9..09a8758bcb 100644 --- a/board/kodama/board.h +++ b/board/kodama/board.h @@ -11,6 +11,7 @@ #define VARIANT_KUKUI_BATTERY_SMART #define VARIANT_KUKUI_CHARGER_MT6370 #define VARIANT_KUKUI_POGO_KEYBOARD +#define VARIANT_KUKUI_TABLET_PWRBTN #ifndef SECTION_IS_RW #define VARIANT_KUKUI_NO_SENSORS diff --git a/board/kukui/board.h b/board/kukui/board.h index 41ea0092c2..f7e55e001d 100644 --- a/board/kukui/board.h +++ b/board/kukui/board.h @@ -18,6 +18,7 @@ #define VARIANT_KUKUI_CHARGER_MT6370 #define VARIANT_KUKUI_DP_MUX_GPIO +#define VARIANT_KUKUI_TABLET_PWRBTN #ifndef SECTION_IS_RW #define VARIANT_KUKUI_NO_SENSORS 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); } } |