summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-12-20 20:04:30 +0100
committerPatrick Georgi <pgeorgi@google.com>2021-04-18 20:45:02 +0000
commit4dc92782fca59e797556f6278c247b88f91c09ec (patch)
treeb9035d1ab70b2bc6d5d9aaba9d029d7072b6f547 /payloads/libpayload
parente97d320df2e5d0401982f5c90e7d4e7f182fb592 (diff)
libpayload/keyboard: Add a detention state
Instead of ignoring keyboards indefinitely when they failed to initialize, we wait 5s and then start over with the hotplug detection. As we always assume a present keyboard at first, we'd otherwise never have a chance to hot plug a device after the initial 30s timer ran out. Change-Id: I8dec4921b2e932442d52b5118cdcf27090633498 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48774 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index 6d0cdd1c7b..cc412ac6e0 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -259,7 +259,7 @@ static enum keyboard_state {
STATE_ENABLE_SCAN,
STATE_RUNNING,
STATE_RUNNING_ECHO,
- STATE_IGNORE,
+ STATE_DETENTION,
} keyboard_state;
#define STATE_NAMES_ENTRY(name) [STATE_##name] = #name
@@ -279,7 +279,7 @@ static const char *const state_names[] = {
STATE_NAMES_ENTRY(ENABLE_SCAN),
STATE_NAMES_ENTRY(RUNNING),
STATE_NAMES_ENTRY(RUNNING_ECHO),
- STATE_NAMES_ENTRY(IGNORE),
+ STATE_NAMES_ENTRY(DETENTION),
};
__attribute__((unused))
@@ -455,8 +455,9 @@ static void keyboard_poll(void)
state_time = timer_us(0);
break;
- case STATE_IGNORE:
- /* TODO: Try again after timeout if it ever seems useful. */
+ case STATE_DETENTION:
+ if (timer_us(state_time) > 5*1000*1000)
+ next_state = STATE_HOTPLUG;
break;
}
@@ -467,11 +468,11 @@ static void keyboard_poll(void)
case STATE_HOTPLUG_ECHO:
case STATE_RUNNING:
case STATE_RUNNING_ECHO:
- case STATE_IGNORE:
+ case STATE_DETENTION:
break;
default:
if (timer_us(keyboard_time) > 30*1000*1000)
- next_state = STATE_IGNORE;
+ next_state = STATE_DETENTION;
break;
}