jacuzzi: Add keyboard functionality

Added IT8801 io expander (which includes keyboard controller) and
the keyscan task.

BUG=b:133200075
TEST="it8801_dump" should check presence of the IT8801 chip
TEST="ksstate on", press keys, see keyboard log things being printed on console
BRANCH=master

Change-Id: I08e7312cec59b6d293c01daf40b2f784a10b7e72
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1693863
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
This commit is contained in:
Alexandru M Stan 2019-07-09 15:21:41 -07:00 committed by Commit Bot
parent 7abc7ca4ab
commit 941fb7e8e7
4 changed files with 30 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "driver/battery/max17055.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/charger/isl923x.h"
#include "driver/ioexpander_it8801.h"
#include "driver/sync.h"
#include "driver/tcpm/fusb302.h"
#include "driver/usb_mux/it5205.h"
@ -27,6 +28,7 @@
#include "hooks.h"
#include "host_command.h"
#include "i2c.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 */

View File

@ -76,6 +76,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
#ifndef __ASSEMBLER__
enum adc_channel {

View File

@ -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)

View File

@ -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)