summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2021-03-04 15:05:51 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-05 01:43:10 +0000
commit50095ea120ae45950e4d1b791870eec76e7f7be9 (patch)
tree9ac3748da7fcd74d88bdd3846c4f06bae7e1b28b
parent146c9b244cbeeacb4f743b67cfea6f00142eaaf6 (diff)
downloadchrome-ec-50095ea120ae45950e4d1b791870eec76e7f7be9.tar.gz
brya: Add keyboard support
This adds keyboard support. Brya uses a non-vivaldi style keyboard. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I6b703f37a773990d81530d4d99b76711efa238e0 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2737548 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--baseboard/brya/baseboard.h12
-rw-r--r--board/brya/board.h1
-rw-r--r--board/brya/build.mk1
-rw-r--r--board/brya/ec.tasklist4
-rw-r--r--board/brya/keyboard.c25
5 files changed, 42 insertions, 1 deletions
diff --git a/baseboard/brya/baseboard.h b/baseboard/brya/baseboard.h
index b70b9de734..aebcdb9563 100644
--- a/baseboard/brya/baseboard.h
+++ b/baseboard/brya/baseboard.h
@@ -56,6 +56,18 @@
/* Chipset config */
#define CONFIG_CHIPSET_ALDERLAKE_SLG4BD44540
+/* Common Keyboard Defines */
+#define CONFIG_CMD_KEYBOARD
+#define CONFIG_KEYBOARD_BOARD_CONFIG
+#define CONFIG_KEYBOARD_COL2_INVERTED
+#define CONFIG_KEYBOARD_KEYPAD
+#define CONFIG_KEYBOARD_PROTOCOL_8042
+#ifdef CONFIG_KEYBOARD_VIVALDI
+#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2
+#else
+#define CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3
+#endif
+
/* Thermal features */
#define CONFIG_THROTTLE_AP
#define CONFIG_CHIPSET_CAN_THROTTLE
diff --git a/board/brya/board.h b/board/brya/board.h
index 8c89a3e917..7583b4347c 100644
--- a/board/brya/board.h
+++ b/board/brya/board.h
@@ -33,6 +33,7 @@
#define GPIO_AC_PRESENT GPIO_ACOK_EC_OD
#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
#define GPIO_LID_OPEN GPIO_LID_OPEN_OD
#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
diff --git a/board/brya/build.mk b/board/brya/build.mk
index bfe748269e..2033590344 100644
--- a/board/brya/build.mk
+++ b/board/brya/build.mk
@@ -16,6 +16,7 @@ board-y+=battery.o
board-y+=board.o
board-y+=fans.o
board-y+=i2c.o
+board-y+=keyboard.o
board-y+=pwm.o
board-y+=sensors.o
board-y+=usbc_config.o
diff --git a/board/brya/ec.tasklist b/board/brya/ec.tasklist
index a12286148d..56cd411da0 100644
--- a/board/brya/ec.tasklist
+++ b/board/brya/ec.tasklist
@@ -9,6 +9,8 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE)
+ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
diff --git a/board/brya/keyboard.c b/board/brya/keyboard.c
new file mode 100644
index 0000000000..b2f1c9f10c
--- /dev/null
+++ b/board/brya/keyboard.c
@@ -0,0 +1,25 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "keyboard_scan.h"
+#include "timer.h"
+
+/* Keyboard scan setting */
+struct keyboard_scan_config keyscan_config = {
+ /* Increase from 50 us, because KSO_02 passes through the H1. */
+ .output_settle_us = 80,
+ /* 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,
+ .actual_key_mask = {
+ 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
+ 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
+ },
+};