diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-31 15:07:14 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-31 16:07:27 -0700 |
commit | 77000e73bc11308bbf872fa8bbdd2a43d9e58050 (patch) | |
tree | 6f6e404b65747d6487c67ba32aa456d7bcfe0216 | |
parent | 261beed560e82b0829e6bfc1f082faf1dfdca8b5 (diff) | |
download | chrome-ec-77000e73bc11308bbf872fa8bbdd2a43d9e58050.tar.gz |
Fix setting initial debounced power button state
If it's pressed, need to track that or we'll ignore the release. And
then we'll leave the power button signal asserted to the PCH, and
it'll shut down 4 seconds after the power button was pressed.
BUG=chrome-os-partner:11971
TEST=hibernate 10, then press power button for ~0.5 sec, then release
system should boot normally
Change-Id: Ibb9b8a8827cca6c81bac06dc9543de1a76fa5aad
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28863
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | chip/lm4/power_button.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c index 1a7c462497..dd1712cb69 100644 --- a/chip/lm4/power_button.c +++ b/chip/lm4/power_button.c @@ -287,13 +287,16 @@ static void set_initial_pwrbtn_state(void) { uint32_t reset_flags = system_get_reset_flags(); + /* Set debounced power button state to initial button state */ + debounced_power_pressed = get_power_button_pressed(); + if (system_jumped_to_this_image() && chipset_in_state(CHIPSET_STATE_ON)) { /* * Jumped to this image while the chipset was already on, so * simply reflect the actual power button state. */ - if (get_power_button_pressed()) { + if (debounced_power_pressed) { *memmap_switches |= EC_SWITCH_POWER_BUTTON_PRESSED; CPRINTF("[%T PB init-jumped-held]\n"); set_pwrbtn_to_pch(0); @@ -316,7 +319,7 @@ static void set_initial_pwrbtn_state(void) */ CPRINTF("[%T PB init-off]\n"); set_pwrbtn_to_pch(1); - if (get_power_button_pressed()) + if (debounced_power_pressed) pwrbtn_state = PWRBTN_STATE_EAT_RELEASE; else pwrbtn_state = PWRBTN_STATE_IDLE; @@ -330,7 +333,7 @@ static void set_initial_pwrbtn_state(void) set_pwrbtn_to_pch(0); tnext_state = get_time().val + PWRBTN_INITIAL_US; - if (get_power_button_pressed()) { + if (debounced_power_pressed) { *memmap_switches |= EC_SWITCH_POWER_BUTTON_PRESSED; if (reset_flags & RESET_FLAG_RESET_PIN) |