From c7f6e2a80fcdd9178abec6faaa4d356dc4cab1a4 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Fri, 9 Feb 2018 12:55:35 -0800 Subject: [PATCH] power_button_x86: Honor power_button_pulse setting on sysjump On sysjump, if power button is held down, first check power_button_pulse_enabled setting to decide if powerbtn to pch should be asserted. This is important to prevent accidental shutdowns when user is attempting to do an EC reset with Vup+Pwr held down. BUG=b:73129177 BRANCH=None TEST=Verified following: 1. Reset EC by holding Vup+Pwr. 2. Keep holding Vup+Pwr until AP reaches depthcharge. 3. Ensure that AP does not shutdown. Change-Id: I0375fc8e8baabb40807dfdc6d4c9fa70c9b3b87d Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/912364 Reviewed-by: Aaron Durbin --- common/power_button_x86.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/power_button_x86.c b/common/power_button_x86.c index 19870e0e49..79fdeea82f 100644 --- a/common/power_button_x86.c +++ b/common/power_button_x86.c @@ -204,9 +204,14 @@ static void set_initial_pwrbtn_state(void) chipset_in_state(CHIPSET_STATE_ON)) { /* * Jumped to this image while the chipset was already on, so - * simply reflect the actual power button state. + * simply reflect the actual power button state unless power + * button pulse is disabled. If power button SMI pulse is + * enabled, then it should be honored, else setting power + * button to PCH could lead to x86 platform shutting down. If + * power button is still held by the time control reaches + * state_machine(), it would take the appropriate action there. */ - if (power_button_is_pressed()) { + if (power_button_is_pressed() && power_button_pulse_enabled) { CPRINTS("PB init-jumped-held"); set_pwrbtn_to_pch(0, 0); } else {