Re-enable keyboard scanning at end of debounce interval

This fixes a problem where a very short power button press would
disable scanning, but not debounce to down so we'd never have a
debounced release to re-enable scanning.

BUG=chrome-os-partner:14678
BRANCH=link
TEST=tap power button very quickly, then see if keyboard still works
(may need to repeat that a few times to be sure it always works)

Change-Id: I3dd3d3f2d892f309a507463d7ad6accf32df30c4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34225
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
This commit is contained in:
Randall Spangler
2012-09-27 15:28:06 -07:00
committed by Gerrit
parent 194ad20c5b
commit f847d33740

View File

@@ -194,7 +194,6 @@ static void power_button_released(uint64_t tnow)
tnext_state = tnow;
*memmap_switches &= ~EC_SWITCH_POWER_BUTTON_PRESSED;
keyboard_set_power_button(0);
keyboard_enable_scanning(1);
}
@@ -262,7 +261,6 @@ 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;
}
@@ -420,12 +418,10 @@ 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
@@ -464,6 +460,14 @@ void power_button_task(void)
/* Handle debounce timeouts for power button and lid switch */
if (tdebounce_pwr && t >= tdebounce_pwr) {
tdebounce_pwr = 0;
/*
* Re-enable keyboard scanning if the power button is
* no longer pressed.
*/
if (!get_power_button_pressed())
keyboard_enable_scanning(1);
if (get_power_button_pressed() !=
debounced_power_pressed)
power_button_changed(t);