From 41ee17ad17806fc742a9622341d34b0f0fe5c80d Mon Sep 17 00:00:00 2001 From: Devin Lu Date: Wed, 13 Oct 2021 15:58:10 +0800 Subject: anahera: Enable keyboard factory scanning This patch adds the factory keyboard connector test. BUG=b:202914217 BRANCH=none TEST=Short keyboard pins and make sure "ectool kbfactorytest" works. Signed-off-by: Devin Lu Change-Id: I9d06b8a44e6274e27f6ce96e23b48de799eaad61 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3220039 Reviewed-by: Boris Mittelberg Commit-Queue: Boris Mittelberg --- board/anahera/board.h | 6 ++++++ board/anahera/keyboard.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/board/anahera/board.h b/board/anahera/board.h index e9764d0ef0..52666ff8e2 100644 --- a/board/anahera/board.h +++ b/board/anahera/board.h @@ -142,6 +142,7 @@ #define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Keyboard features */ +#define CONFIG_KEYBOARD_FACTORY_TEST #define CONFIG_KEYBOARD_VIVALDI #define CONFIG_KEYBOARD_REFRESH_ROW3 @@ -195,6 +196,11 @@ enum mft_channel { MFT_CH_COUNT }; +#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/anahera/keyboard.c b/board/anahera/keyboard.c index 6d65e7b78d..f4c03d06bf 100644 --- a/board/anahera/keyboard.c +++ b/board/anahera/keyboard.c @@ -120,3 +120,21 @@ board_vivaldi_keybd_config(void) return &keybd_wo_privacy_wo_kblight; } } + +#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}, {0, 5}, {1, 1}, {1, 0}, {0, 6}, + {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7}, + {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7}, + {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3}, + {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1}, +}; + +const int keyboard_factory_scan_pins_used = + ARRAY_SIZE(keyboard_factory_scan_pins); +#endif -- cgit v1.2.1