From cd3aace7aa0a3a01220e716c36a17af312d63ae4 Mon Sep 17 00:00:00 2001 From: Zick Wei Date: Fri, 29 Nov 2019 11:20:33 +0800 Subject: kappa: Add keyboard functionality Clone from CL:1693863 Added IT8801 io expandor (which include keyboard controller) and the keyscan task. BUG=none BRANCH=none TEST=make buildall Change-Id: Ibd74f55e37e8c9bef1d1866b0e538dec37000d66 Signed-off-by: Zick Wei Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1943496 Reviewed-by: Ting Shen --- board/kappa/board.c | 20 ++++++++++++++++++++ board/kappa/board.h | 7 +++++++ board/kappa/ec.tasklist | 1 + board/kappa/gpio.inc | 3 ++- 4 files changed, 30 insertions(+), 1 deletion(-) (limited to 'board/kappa') diff --git a/board/kappa/board.c b/board/kappa/board.c index 0c73590d1e..8927ec129c 100644 --- a/board/kappa/board.c +++ b/board/kappa/board.c @@ -27,6 +27,8 @@ #include "hooks.h" #include "host_command.h" #include "i2c.h" +#include "it8801.h" +#include "keyboard_scan.h" #include "lid_switch.h" #include "power.h" #include "power_button.h" @@ -79,6 +81,24 @@ const struct power_signal_info power_signal_list[] = { }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); +/* Keyboard scan setting */ +struct keyboard_scan_config keyscan_config = { + /* + * TODO(b/133200075): Tune this once we have the final performance + * out of the driver and the i2c bus. + */ + .output_settle_us = 35, + .debounce_down_us = 5 * MSEC, + .debounce_up_us = 40 * MSEC, + .scan_period_us = 3 * MSEC, + .min_post_scan_delay_us = 1000, + .poll_timeout_us = 100 * MSEC, + .actual_key_mask = { + 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */ + }, +}; + /******************************************************************************/ /* SPI devices */ /* TODO: to be added once sensors land via CL:1714436 */ diff --git a/board/kappa/board.h b/board/kappa/board.h index 420d27af72..62a5fdfc6b 100644 --- a/board/kappa/board.h +++ b/board/kappa/board.h @@ -79,6 +79,13 @@ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON)) +#define CONFIG_EC_KEYBOARD +#define CONFIG_KEYBOARD_DEBUG +#define CONFIG_KEYBOARD_NOT_RAW +#define CONFIG_IO_EXPANDER_IT8801 +#define CONFIG_KEYBOARD_BOARD_CONFIG +#define CONFIG_KEYBOARD_COL2_INVERTED + #define PD_OPERATING_POWER_MW 30000 #ifndef __ASSEMBLER__ diff --git a/board/kappa/ec.tasklist b/board/kappa/ec.tasklist index f4fb8670ea..4b7574652e 100644 --- a/board/kappa/ec.tasklist +++ b/board/kappa/ec.tasklist @@ -15,6 +15,7 @@ TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \ TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, 1024) \ TASK_ALWAYS_RO(EMMC, emmc_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/kappa/gpio.inc b/board/kappa/gpio.inc index 1e9b815067..0f40c9cf19 100644 --- a/board/kappa/gpio.inc +++ b/board/kappa/gpio.inc @@ -33,9 +33,10 @@ GPIO_INT(AC_PRESENT, PIN(A, 6), GPIO_INT_BOTH, extpower_interrupt) /* ACOK_OD */ GPIO_INT(BC12_EC_INT_ODL, PIN(C, 9), GPIO_INT_FALLING, bc12_interrupt) +GPIO_INT(IT8801_SMB_INT, PIN(A, 8), GPIO_INT_FALLING | GPIO_PULL_UP, + io_expander_it8801_interrupt) /* KB_INT_ODL */ /* Unimplemented interrupts */ -GPIO(KB_INT_ODL, PIN(A, 8), GPIO_INPUT) GPIO(ALS_RGB_INT_ODL, PIN(C, 10), GPIO_INPUT) GPIO(TABLET_MODE_L, PIN(B, 11), GPIO_INPUT) -- cgit v1.2.1