summaryrefslogtreecommitdiff
path: root/board/drawcia
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2020-10-14 09:30:03 +0800
committerCommit Bot <commit-bot@chromium.org>2020-10-16 03:11:01 +0000
commit70c72206fd1e7871a1f7bd15c0017ddf2ac35135 (patch)
tree57fd31c4d21a7d85213e6f04cd81212a556cf74d /board/drawcia
parent8ef11a2aae529d46ea0924eb12dd8654ee3859ad (diff)
downloadchrome-ec-70c72206fd1e7871a1f7bd15c0017ddf2ac35135.tar.gz
drawcia: Enable keyboard factory scanning
This patch add for factory keyboard connector test. BUG=b:170699805 BRANCH=none TEST=Short keyboard pins and make sure "ectool kbfactorytest" works. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I7da348a36611f06da700787774bf1521360a0c66 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2469639 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/drawcia')
-rw-r--r--board/drawcia/board.c19
-rw-r--r--board/drawcia/board.h6
-rw-r--r--board/drawcia/gpio.inc6
3 files changed, 31 insertions, 0 deletions
diff --git a/board/drawcia/board.c b/board/drawcia/board.c
index fd8a8e187f..7f96bdaef3 100644
--- a/board/drawcia/board.c
+++ b/board/drawcia/board.c
@@ -654,3 +654,22 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
*kd = 4;
*kd_div = 40;
}
+
+#ifdef CONFIG_KEYBOARD_FACTORY_TEST
+/*
+ * Map keyboard connector pins to EC GPIO pins for factory test.
+ * Pins mapped to {-1, -1} are skipped.
+ * The connector has 24 pins total, and there is no pin 0.
+ */
+const int keyboard_factory_scan_pins[][2] = {
+ {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
+ {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
+ {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
+ {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
+ {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
+ {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+};
+
+const int keyboard_factory_scan_pins_used =
+ ARRAY_SIZE(keyboard_factory_scan_pins);
+#endif
diff --git a/board/drawcia/board.h b/board/drawcia/board.h
index fb9a5db542..0ca1a74a03 100644
--- a/board/drawcia/board.h
+++ b/board/drawcia/board.h
@@ -64,6 +64,7 @@
#define CONFIG_GMR_TABLET_MODE
/* Keyboard */
+#define CONFIG_KEYBOARD_FACTORY_TEST
#define CONFIG_PWM_KBLIGHT
/* TCPC */
@@ -146,6 +147,11 @@ enum battery_type {
int board_is_sourcing_vbus(int port);
+#ifdef CONFIG_KEYBOARD_FACTORY_TEST
+extern const int keyboard_factory_scan_pins[][2];
+extern const int keyboard_factory_scan_pins_used;
+#endif
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/drawcia/gpio.inc b/board/drawcia/gpio.inc
index cfc6b5e867..d603d93435 100644
--- a/board/drawcia/gpio.inc
+++ b/board/drawcia/gpio.inc
@@ -123,6 +123,12 @@ GPIO(BAT_LED_WHITE_L, PIN(A, 2), GPIO_OUT_HIGH)
GPIO(PWR_LED_WHITE_L, PIN(A, 3), GPIO_OUT_HIGH)
/* Alternate functions GPIO definitions */
+/* Keyboard */
+ALTERNATE(PIN_MASK(KSI, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSI0-7 */
+ALTERNATE(PIN_MASK(KSO_H, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO8-15 */
+ALTERNATE(PIN_MASK(KSO_L, 0xFB), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO0-1, 3-7 */
+GPIO(EC_KSO_02_INV, PIN(KSO_L, 2), GPIO_OUT_HIGH) /* KSO2 inverted */
+
/* UART */
ALTERNATE(PIN_MASK(B, BIT(0) | BIT(1)), 0, MODULE_UART, 0) /* UART for debug */