From 95958b0da984aca8863fd039f76339a2e2a85e86 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Fri, 25 Sep 2020 12:18:40 -0700 Subject: Trogdor: Mask proper Search key location on the board level Don't use the default key mask, which enables both the old location (KSO_01/KSI_00) and the new location (KSO_00/KSI_03) for the Search key. It makes EC over-doing ghost detection. Define the key mask on the board level: * Trogdor/Lazor uses the old location * Pompom uses the new location * Coachz has no keyboard BRANCH=None BUG=b:169361784 TEST=Tested on Lazor, enabled "ksstate on" in EC console, pressed Grave + Tab + Left-Ctrl and saw these keys detected. Change-Id: I0cf37921901a4f997edbef3ac6a89e4351e742d7 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432449 Reviewed-by: Douglas Anderson --- board/lazor/board.c | 20 ++++++++++++++++++++ board/lazor/board.h | 1 + board/pompom/board.c | 21 +++++++++++++++++++++ board/pompom/board.h | 1 + board/trogdor/board.c | 21 +++++++++++++++++++++ board/trogdor/board.h | 1 + 6 files changed, 65 insertions(+) diff --git a/board/lazor/board.c b/board/lazor/board.c index 1ced66747a..6ef3e2c0f9 100644 --- a/board/lazor/board.c +++ b/board/lazor/board.c @@ -110,6 +110,26 @@ static void switchcap_interrupt(enum gpio_signal signal) ln9310_interrupt(signal); } +/* Keyboard scan setting */ +struct keyboard_scan_config keyscan_config = { + /* Use 80 us, because KSO_02 passes through the H1. */ + .output_settle_us = 80, + /* + * Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key); + * as it still uses the legacy location (KSO_01/KSI_00). + */ + .actual_key_mask = { + 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca + }, + /* Other values should be the same as the default configuration. */ + .debounce_down_us = 9 * MSEC, + .debounce_up_us = 30 * MSEC, + .scan_period_us = 3 * MSEC, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = 100 * MSEC, +}; + /* I2C port map */ const struct i2c_port_t i2c_ports[] = { {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL, diff --git a/board/lazor/board.h b/board/lazor/board.h index cc24f2435c..162e03b08e 100644 --- a/board/lazor/board.h +++ b/board/lazor/board.h @@ -26,6 +26,7 @@ #define CONFIG_LN9310 /* Keyboard */ +#define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_PWM_KBLIGHT /* Battery */ diff --git a/board/pompom/board.c b/board/pompom/board.c index a3700d56bc..041993b01b 100644 --- a/board/pompom/board.c +++ b/board/pompom/board.c @@ -89,6 +89,27 @@ static void board_connect_c0_sbu(enum gpio_signal s) hook_call_deferred(&board_connect_c0_sbu_deferred_data, 0); } +/* Keyboard scan setting */ +struct keyboard_scan_config keyscan_config = { + /* Use 80 us, because KSO_02 passes through the H1. */ + .output_settle_us = 80, + /* + * Unmask 0x01 in [1] (KSO_01/KSI_00, the old location of Search key); + * as it uses the new location (KSO_00/KSI_03). And T11 key, which maps + * to KSO_01/KSI_00, is not there. + */ + .actual_key_mask = { + 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca + }, + /* Other values should be the same as the default configuration. */ + .debounce_down_us = 9 * MSEC, + .debounce_up_us = 30 * MSEC, + .scan_period_us = 3 * MSEC, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = 100 * MSEC, +}; + /* I2C port map */ const struct i2c_port_t i2c_ports[] = { {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL, diff --git a/board/pompom/board.h b/board/pompom/board.h index fa5517da74..11d48a5d40 100644 --- a/board/pompom/board.h +++ b/board/pompom/board.h @@ -24,6 +24,7 @@ #define CONFIG_FLASH_SIZE (512 * 1024) /* 512KB internal spi flash */ /* Keyboard */ +#define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_PWM_KBLIGHT /* BC 1.2 Charger */ diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 36e4e4452a..b39e100b56 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -16,6 +16,7 @@ #include "driver/tcpm/tcpci.h" #include "gpio.h" #include "hooks.h" +#include "keyboard_scan.h" #include "lid_switch.h" #if BOARD_REV >= TROGDOR_REV1 #include "pi3usb9201.h" @@ -102,6 +103,26 @@ static void board_connect_c0_sbu(enum gpio_signal s) hook_call_deferred(&board_connect_c0_sbu_deferred_data, 0); } +/* Keyboard scan setting */ +struct keyboard_scan_config keyscan_config = { + /* Use 80 us, because KSO_02 passes through the H1. */ + .output_settle_us = 80, + /* + * Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key); + * as it still uses the legacy location (KSO_01/KSI_00). + */ + .actual_key_mask = { + 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca + }, + /* Other values should be the same as the default configuration. */ + .debounce_down_us = 9 * MSEC, + .debounce_up_us = 30 * MSEC, + .scan_period_us = 3 * MSEC, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = 100 * MSEC, +}; + /* I2C port map */ const struct i2c_port_t i2c_ports[] = { {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL, diff --git a/board/trogdor/board.h b/board/trogdor/board.h index 66b2e69c5f..e593207f29 100644 --- a/board/trogdor/board.h +++ b/board/trogdor/board.h @@ -26,6 +26,7 @@ #define CONFIG_FLASH_SIZE (1024 * 1024) /* 1MB internal spi flash */ /* Keyboard */ +#define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_PWM_KBLIGHT /* BC 1.2 Charger */ -- cgit v1.2.1