summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru M Stan <amstan@chromium.org>2019-07-09 15:21:41 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-19 07:22:39 +0000
commit941fb7e8e73ff1cb4e6ed170bee8e755a5416a50 (patch)
tree4c1ee5c64463387e5c4ae34cd1201e2d1e2256ad
parent7abc7ca4abbc2f4154e177389924c258ea37ff5d (diff)
downloadchrome-ec-941fb7e8e73ff1cb4e6ed170bee8e755a5416a50.tar.gz
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>
-rw-r--r--board/jacuzzi/board.c20
-rw-r--r--board/jacuzzi/board.h7
-rw-r--r--board/jacuzzi/ec.tasklist1
-rw-r--r--board/jacuzzi/gpio.inc3
4 files changed, 30 insertions, 1 deletions
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index 1dd26c0e4b..3b81029f73 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/board.c
@@ -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 */
diff --git a/board/jacuzzi/board.h b/board/jacuzzi/board.h
index 2d76d56c42..1595d8b86d 100644
--- a/board/jacuzzi/board.h
+++ b/board/jacuzzi/board.h
@@ -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 {
diff --git a/board/jacuzzi/ec.tasklist b/board/jacuzzi/ec.tasklist
index f4fb8670ea..4b7574652e 100644
--- a/board/jacuzzi/ec.tasklist
+++ b/board/jacuzzi/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/jacuzzi/gpio.inc b/board/jacuzzi/gpio.inc
index 7b4754678e..10957c5328 100644
--- a/board/jacuzzi/gpio.inc
+++ b/board/jacuzzi/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)