From 8c44e8b74d79a31a810391511fbe7c73f0bc59d4 Mon Sep 17 00:00:00 2001 From: Louis Yung-Chieh Lo Date: Mon, 11 Jun 2012 16:39:10 +0800 Subject: Fix the keyboard bug on recovery screen. This bug unexpectedly comes from 2 related features: 1. Issue chrome-os-partner:7486: stop driving keyboard columns ASAP when power button is pressed. This is to avoid the keys on ESC column to reset the system if the power button is also pressed. This is done by keyboard_enable_scanning(0) in power_button_interrupt(). 2. During the booting, the power button state is set to BOOT_RECOVERY and will ignore the power button release (to avoid confusing the host). However, before the state is set back to IDLE, the power_button_interrupt() can be triggered ever so that the matrix scan is disabled. Therefore, we have to enable the matrix scan in the BOOT_RECOVERY (and the derived EAT_RELEASE) because they ignore power button release. Note that in the regular states, the power_button_released() is called after debounce time. They are fine. Signed-off-by: Louis Yung-Chieh Lo BUG=chrome-os-partner:10358 TEST=Press ESC+Refresh+Power for many many times with vatious hold time. The tab key works to disable the recovery reason. Change-Id: Ic05fc6e22caadb4a3892a4b201dd5bfc7e9c3f44 Reviewed-on: https://gerrit.chromium.org/gerrit/24991 Reviewed-by: Randall Spangler Commit-Ready: Yung-Chieh Lo Tested-by: Yung-Chieh Lo --- chip/lm4/power_button.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chip/lm4/power_button.c b/chip/lm4/power_button.c index b144d00b62..1ef91ead6c 100644 --- a/chip/lm4/power_button.c +++ b/chip/lm4/power_button.c @@ -272,6 +272,7 @@ static void power_button_changed(uint64_t tnow) * told the PCH the power button was released. */ CPRINTF("[%T PB ignoring release]\n"); pwrbtn_state = PWRBTN_STATE_IDLE; + keyboard_enable_scanning(1); return; } @@ -433,10 +434,12 @@ static void state_machine(uint64_t tnow) * recovery combination doesn't cause the chipset to shut back * down. */ set_pwrbtn_to_pch(1); - if (get_power_button_pressed()) + if (get_power_button_pressed()) { pwrbtn_state = PWRBTN_STATE_EAT_RELEASE; - else + } else { pwrbtn_state = PWRBTN_STATE_IDLE; + keyboard_enable_scanning(1); + } break; case PWRBTN_STATE_WAS_OFF: /* Done stretching initial power button signal, so show the -- cgit v1.2.1