summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSue Chen <sue.chen@quanta.corp-partner.google.com>2021-06-02 12:54:23 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-23 10:26:34 +0000
commita26ed909873f0166218bb0865e9b272dca5093a6 (patch)
tree7ea6c0beeca6d0348a54661eb209119156477426
parentd83848a947c565163233fcfa536f94320e0230be (diff)
downloadchrome-ec-a26ed909873f0166218bb0865e9b272dca5093a6.tar.gz
Cozmo: support factory keyboard test.
connector-to-GPIO map: {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1}, {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {-1, -1}, {-1, -1}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6}, {-1, -1}, {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}, {GPIO_KSO_H, 5}, {-1, -1}, {GPIO_KSO_H, 6}, {-1, -1}, {-1, -1}, BUG=none BRANCH=icarus TEST=`ectool kbfactorytest` PASS. Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: Ifc22d87f84ce86dee6f68b33a2a9a2964f71170f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2936262 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 354521683e2ec0b3c3b9147c904212f6132f5e9b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2979559 Commit-Queue: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--board/icarus/board.c19
-rw-r--r--board/icarus/board.h6
-rw-r--r--board/icarus/gpio.inc5
3 files changed, 30 insertions, 0 deletions
diff --git a/board/icarus/board.c b/board/icarus/board.c
index defdfd1187..d094210c67 100644
--- a/board/icarus/board.c
+++ b/board/icarus/board.c
@@ -46,6 +46,25 @@
#include "gpio_list.h"
+/*
+ * 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}, {-1, -1}, {-1, -1},
+ {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6}, {-1, -1}, {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}, {GPIO_KSO_H, 5}, {-1, -1},
+ {GPIO_KSO_H, 6}, {-1, -1}, {-1, -1},
+};
+
+const int keyboard_factory_scan_pins_used =
+ ARRAY_SIZE(keyboard_factory_scan_pins);
+
/* Wake-up pins for hibernate */
const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
diff --git a/board/icarus/board.h b/board/icarus/board.h
index a0a52d8a10..230e60b156 100644
--- a/board/icarus/board.h
+++ b/board/icarus/board.h
@@ -115,6 +115,12 @@ enum battery_type {
#include "gpio_signal.h"
#include "registers.h"
+/* support factory keyboard test */
+#define CONFIG_KEYBOARD_FACTORY_TEST
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+extern const int keyboard_factory_scan_pins[][2];
+extern const int keyboard_factory_scan_pins_used;
+
#ifdef SECTION_IS_RO
/* Interrupt handler for AP jump to BL */
void emmc_ap_jump_to_bl(enum gpio_signal signal);
diff --git a/board/icarus/gpio.inc b/board/icarus/gpio.inc
index cf380a0c26..a3a097c17b 100644
--- a/board/icarus/gpio.inc
+++ b/board/icarus/gpio.inc
@@ -129,6 +129,11 @@ GPIO(EC_SPI_FLASH_CLK, PIN(G, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(EC_SPI_FLASH_CS_L, PIN(G, 7), GPIO_OUT_LOW)
/* 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_LOW) /* KSO2 inverted */
/* I2C */
ALTERNATE(PIN_MASK(B, 0x18), 1, MODULE_I2C, 0) /* I2C A */
ALTERNATE(PIN_MASK(C, 0x06), 1, MODULE_I2C, GPIO_SEL_1P8V) /* I2C B */