From 3872ac2772f97cbd919d1537599c52a749b2b8ec Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Fri, 8 May 2020 15:30:30 -0700 Subject: keyboard_scan: Update the default scan delay to compensate H1 signal delay The default value of the keyboard scan delay was measured at around 2013. That time H1 hadn't been introduced. The keyscan lines go straightforward to the keyboard matrix. In recent Chrome OS clamshell/convertible devices, the KSO2 line goes through H1. It adds more signal delay for inverting the signal. The default keyboard scan rate seems too fast for the KSO2 line. When an user presses Refresh key (KSO2, KSI2), EC iterates to assert the next KSO3, KSO2 still remains asserted that causes T key (KSO3, KSI2) detected unexpectedly. Most of the boards override this default value. But a board, which just uses the default value, may have this Refresh-triggering-T bug. People debug the same issue over and over again. Should update the default value and save people time. BRANCH=None BUG=b:156007029, b:155696516 TEST=Press Refresh key, only Refresh key detected, no sign of T key. Change-Id: I5a9ee8058adcac123fdd5500d478913926b00497 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190953 Reviewed-by: Alexandru M Stan Reviewed-by: Paul Fagerburg --- common/keyboard_scan.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 5e147a1f46..82c811dd92 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -56,7 +56,18 @@ #ifndef CONFIG_KEYBOARD_BOARD_CONFIG /* Use default keyboard scan config, because board didn't supply one */ struct keyboard_scan_config keyscan_config = { +#ifdef CONFIG_KEYBOARD_COL2_INVERTED + /* + * CONFIG_KEYBOARD_COL2_INVERTED is defined for passing the column 2 + * to H1 which inverts the signal. The signal passing through H1 + * adds more delay. Need a larger delay value. Otherwise, pressing + * Refresh key will also trigger T key, which is in the next scanning + * column line. See http://b/156007029. + */ + .output_settle_us = 80, +#else .output_settle_us = 50, +#endif /* CONFIG_KEYBOARD_COL2_INVERTED */ .debounce_down_us = 9 * MSEC, .debounce_up_us = 30 * MSEC, .scan_period_us = 3 * MSEC, -- cgit v1.2.1