summaryrefslogtreecommitdiff
path: root/common/power_button_x86.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-01-04 16:32:35 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-11 23:14:41 +0000
commit8416a685cfd8a2da2def210ffd33ee437b7bc847 (patch)
tree226027abd611f1603af0de1eec332bcad8e5a6c6 /common/power_button_x86.c
parent51abcc0e389143f326a437ab786cad1c29220198 (diff)
downloadchrome-ec-8416a685cfd8a2da2def210ffd33ee437b7bc847.tar.gz
power_button_x86: Ensure INIT_ON presses button for 200 ms
PWRBTN_STATE_INIT_ON should assert GPIO_PCH_PWRBTN_L for PWRBTN_INITIAL_US (200 milliseconds). It was sometimes releasing it too soon, so then the AP would fail to go to S0. In the failing case: 1) PWRBTN_STATE_INIT_ON calls set_pwrbtn_to_pch(). 2) The user has just released the physical button. 3) I2C activity (for battery_get_disconnect_state() from charge_prevent_power_on() in set_pwrbtn_to_pch()) allows power_button_change_deferred() to run to process the release. 4) set_pwrbtn_to_pch() finishes, setting GPIO_PCH_PWRBTN_L to 0. 5) PWRBTN_STATE_INIT_ON checks power_button_is_pressed(), which returns 0, because power_button_change_deferred() ran at 3. 6) PWRBTN_STATE_INIT_ON sets pwrbtn_state to PWRBTN_STATE_RELEASED instead of PWRBTN_STATE_BOOT_KB_RESET. 7) powerbtn_x86_changed() runs (via HOOK_POWER_BUTTON_CHANGE from 3), sets pwrbtn_state to PWRBTN_STATE_RELEASED (again) and also tnext_state to now. 8) state_machine() runs, PWRBTN_STATE_RELEASED sets GPIO_PCH_PWRBTN_L to 1. This is too soon. Change to always set the next state to PWRBTN_STATE_BOOT_KB_RESET after asserting GPIO_PCH_PWRBTN_L to fix this. This ensures powerbtn_x86_changed() will ignore all physical button changes during the initial 200 ms pulse. BUG=b:121066727 BRANCH=grunt TEST=Press Power+F3 many times. AP always boots. Change-Id: I29828f25793bb35fd75efea28de2af9fc2e85ce5 Signed-off-by: Edward Hill <ecgh@chromium.org> Previous-Reviewed-on: https://chromium-review.googlesource.com/1395759 (cherry picked from commit acaa2c5b54d774c937805395b9643ed433bff5b2) Reviewed-on: https://chromium-review.googlesource.com/c/1405405
Diffstat (limited to 'common/power_button_x86.c')
-rw-r--r--common/power_button_x86.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index c05b5add50..8f990e7cfb 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -367,16 +367,7 @@ static void state_machine(uint64_t tnow)
set_pwrbtn_to_pch(0, 1);
tnext_state = get_time().val + PWRBTN_INITIAL_US;
-
- if (power_button_is_pressed()) {
- if (system_get_reset_flags() & RESET_FLAG_RESET_PIN)
- pwrbtn_state = PWRBTN_STATE_BOOT_KB_RESET;
- else
- pwrbtn_state = PWRBTN_STATE_WAS_OFF;
- } else {
- pwrbtn_state = PWRBTN_STATE_RELEASED;
- }
-
+ pwrbtn_state = PWRBTN_STATE_BOOT_KB_RESET;
break;
case PWRBTN_STATE_BOOT_KB_RESET: