summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-03-23 10:34:02 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-24 02:15:58 +0000
commitf15b0fcff7ab0df04279a3480e80bc67b54ebee5 (patch)
treef7df76067536456e7620c67faa6531d2c99b65db /zephyr
parentf78b94c011083b6a5620df5aefda04a4047e67e7 (diff)
downloadchrome-ec-f15b0fcff7ab0df04279a3480e80bc67b54ebee5.tar.gz
zephyr: lazor: enable keyboard support
Define the keyboard scanlines and the inverted KSO2 GPIO. Enable the keyboard-related configs. Some warning of "MKBP not cleared" or "MKBP FIFO being full" will be showed as the SHI driver is not ready. The MKBP FIFO won't be dequeued. BRANCH=None BUG=b:183445211 TEST=Tested on Lazor by pressing keys, including KSO2. uart:~$ ksstate on [26.075200 KB debounced : -- -- -- -- -- -- -- -- -- -- -- -- --] [26.079600 KB debouncing: -- -- -- -- -- -- -- -- -- -- -- -- --] Keyboard scan disable mask: 0x00000000 Keyboard scan state printing on uart:~$ [29.269700 KB state: -- 02 -- -- -- -- -- -- -- -- -- -- --] [29.392000 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [30.244000 KB state: -- -- 01 -- -- -- -- -- -- -- -- -- --] [30.274000 MKBP not cleared within threshold, toggling.] [30.359600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [31.278800 MKBP not cleared within threshold, toggling.] [31.872900 KB state: -- -- 08 -- -- -- -- -- -- -- -- -- --] [32.005100 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [33.060500 KB state: -- -- 04 -- -- -- -- -- -- -- -- -- --] [33.189500 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [34.065100 MKBP not cleared within threshold, toggling.] [34.454100 KB state: -- -- 02 -- -- -- -- -- -- -- -- -- --] [34.556600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [35.069300 MKBP not cleared within threshold, toggling.] [37.356900 KB state: -- -- -- -- 08 -- -- -- -- -- -- -- --] [37.452900 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [38.361500 MKBP not cleared within threshold, toggling.] [39.365800 MKBP not cleared within threshold, toggling.] Change-Id: I02390e85f9454d5c93cd54d333d2e242e0c54911 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782368 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts35
-rw-r--r--zephyr/projects/trogdor/lazor/include/gpio_map.h1
-rw-r--r--zephyr/projects/trogdor/lazor/prj.conf8
3 files changed, 42 insertions, 2 deletions
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts
index 58fefcf80f..b4b352f202 100644
--- a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts
+++ b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts
@@ -111,6 +111,41 @@
};
soc {
+ cros_kb_raw: cros-kb-raw@400a3000 {
+ compatible = "nuvoton,npcx-cros-kb-raw";
+ reg = <0x400a3000 0x2000>;
+ label = "CROS_KB_RAW_0";
+ interrupts = <49 0>;
+ clocks = <&pcc NPCX_CLOCK_BUS_APB1 NPCX_PWDWN_CTL1 0>;
+ /* No KSO2 (it's inverted and implemented by GPIO) */
+ pinctrl-0 = <&alt7_no_ksi0_sl /* KSI0 PIN31 */
+ &alt7_no_ksi1_sl /* KSI1 PIN30 */
+ &alt7_no_ksi2_sl /* KSI2 PIN27 */
+ &alt7_no_ksi3_sl /* KSI3 PIN26 */
+ &alt7_no_ksi4_sl /* KSI4 PIN25 */
+ &alt7_no_ksi5_sl /* KSI5 PIN24 */
+ &alt7_no_ksi6_sl /* KSI6 PIN23 */
+ &alt7_no_ksi7_sl /* KSI7 PIN22 */
+ &alt8_no_kso00_sl /* KSO00 PIN21 */
+ &alt8_no_kso01_sl /* KSO01 PIN20 */
+ &alt8_no_kso03_sl /* KSO03 PIN16 */
+ &alt8_no_kso04_sl /* KSO04 PIN15 */
+ &alt8_no_kso05_sl /* KSO05 PIN14 */
+ &alt8_no_kso06_sl /* KSO06 PIN13 */
+ &alt8_no_kso07_sl /* KSO07 PIN12 */
+ &alt9_no_kso08_sl /* KSO08 PIN11 */
+ &alt9_no_kso09_sl /* KSO09 PIN10 */
+ &alt9_no_kso10_sl /* KSO10 PIN07 */
+ &alt9_no_kso11_sl /* KSO11 PIN06 */
+ &alt9_no_kso12_sl /* KSO12 PIN05 */
+ &alt9_no_kso13_sl /* KSO13 PIN04 */
+ &alt9_no_kso14_sl /* KSO14 PIN82 */
+ >;
+ wui_maps = <&wui_io31 &wui_io30 &wui_io27 &wui_io26
+ &wui_io25 &wui_io24 &wui_io23 &wui_io22>;
+ status = "disabled";
+ };
+
fiu0: cros-flash@40020000 {
compatible = "nuvoton,npcx-cros-flash";
reg = <0x40020000 0x2000>;
diff --git a/zephyr/projects/trogdor/lazor/include/gpio_map.h b/zephyr/projects/trogdor/lazor/include/gpio_map.h
index 605ba9a41c..7a0d86d2fd 100644
--- a/zephyr/projects/trogdor/lazor/include/gpio_map.h
+++ b/zephyr/projects/trogdor/lazor/include/gpio_map.h
@@ -36,6 +36,7 @@
#define GPIO_WARM_RESET_L NAMED_GPIO(warm_reset_l)
#define GPIO_WP_L NAMED_GPIO(ec_wp_odl)
#define GPIO_EC_INT_L NAMED_GPIO(ec_int_l)
+#define GPIO_KBD_KSO2 NAMED_GPIO(ec_kso_02_inv)
/*
* Set EC_CROS_GPIO_INTERRUPTS to a space-separated list of GPIO_INT items.
diff --git a/zephyr/projects/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf
index 352d003028..c9c03ca100 100644
--- a/zephyr/projects/trogdor/lazor/prj.conf
+++ b/zephyr/projects/trogdor/lazor/prj.conf
@@ -41,9 +41,13 @@ CONFIG_PLATFORM_EC_VBOOT=n
CONFIG_PLATFORM_EC_MKBP_EVENT=y
CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
+CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
+CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
+CONFIG_CROS_KB_RAW_NPCX=y
+
# TODO(b/182398910): bringup these features
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
-CONFIG_PLATFORM_EC_KEYBOARD=n
CONFIG_PLATFORM_EC_SWITCH=n
CONFIG_PLATFORM_EC_VBOOT_HASH=n
-CONFIG_CROS_KB_RAW_NPCX=n