summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHank Xie <hank.xie@quanta.corp-partner.google.com>2022-03-14 17:03:55 +0800
committerCommit Bot <commit-bot@chromium.org>2022-03-16 02:35:45 +0000
commitf5e2513c3f2160a9f8ce0e50158718a4d9213468 (patch)
tree13393ea55e098f27f13ea3f97c650658f001b9db
parentdbbbe2946d44693b183bedbe7d628bfc66b493df (diff)
downloadchrome-ec-f5e2513c3f2160a9f8ce0e50158718a4d9213468.tar.gz
landrid: Porting keyboard.
Add numeric pad for landrid. Porting EC GPIO J4 for T2 refresh key for landrid BUG=b:224648672 BRANCH=dedede TEST=make sure keyboard function of each MB works correctly. Signed-off-by: Hank Xie <hank.xie@quanta.corp-partner.google.com> Change-Id: Iaba03a9bd72516a043000ffc4d6bdb49defe566f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3517431 Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Tested-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--board/lantis/board.c89
-rw-r--r--board/lantis/board.h1
-rw-r--r--board/lantis/gpio.inc2
3 files changed, 89 insertions, 3 deletions
diff --git a/board/lantis/board.c b/board/lantis/board.c
index 380b9e2f4e..4e9e6badad 100644
--- a/board/lantis/board.c
+++ b/board/lantis/board.c
@@ -24,6 +24,7 @@
#include "hooks.h"
#include "intc.h"
#include "keyboard_8042.h"
+#include "keyboard_raw.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
#include "power.h"
@@ -53,6 +54,20 @@ const int usb_port_enable[USB_PORT_COUNT] = {
GPIO_EN_USB_A_5V,
};
+/* Keyboard scan setting */
+__override struct keyboard_scan_config keyscan_config = {
+ .output_settle_us = 80,
+ .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 = {
+ 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xa4, 0xff, 0xfe, 0x55, 0xfe, 0xff, 0xff, 0xff, /* full set */
+ },
+};
+
__override void board_process_pd_alert(int port)
{
/*
@@ -366,7 +381,7 @@ struct motion_sensor_t motion_sensors[] = {
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-static const struct ec_response_keybd_config keybd1 = {
+static const struct ec_response_keybd_config lantis_keybd_backlight = {
.num_top_row_keys = 10,
.action_keys = {
TK_BACK, /* T1 */
@@ -383,10 +398,78 @@ static const struct ec_response_keybd_config keybd1 = {
/* No function keys, no numeric keypad and no screenlock key */
};
+static const struct ec_response_keybd_config landrid_keybd_backlight = {
+ .num_top_row_keys = 13,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_KBD_BKLIGHT_TOGGLE, /* T8 */
+ TK_PLAY_PAUSE, /* T9 */
+ TK_MICMUTE, /* T10 */
+ TK_VOL_MUTE, /* T11 */
+ TK_VOL_DOWN, /* T12 */
+ TK_VOL_UP, /* T13 */
+ },
+ .capabilities = KEYBD_CAP_NUMERIC_KEYPAD,
+ /* No function keys and no screenlock key */
+};
+
+static const struct ec_response_keybd_config landrid_keybd = {
+ .num_top_row_keys = 13,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_PREV_TRACK, /* T8 */
+ TK_PLAY_PAUSE, /* T9 */
+ TK_MICMUTE, /* T10 */
+ TK_VOL_MUTE, /* T11 */
+ TK_VOL_DOWN, /* T12 */
+ TK_VOL_UP, /* T13 */
+ },
+ .capabilities = KEYBD_CAP_NUMERIC_KEYPAD,
+ /* No function keys and no screenlock key */
+};
+
__override const struct ec_response_keybd_config
*board_vivaldi_keybd_config(void)
{
- return &keybd1;
+ if (get_cbi_fw_config_numeric_pad()) {
+ if (get_cbi_fw_config_kblight())
+ return &landrid_keybd_backlight;
+ else
+ return &landrid_keybd;
+ } else {
+ return &lantis_keybd_backlight;
+ }
+}
+
+__override
+uint8_t board_keyboard_row_refresh(void)
+{
+ if (gpio_get_level(GPIO_EC_VIVALDIKEYBOARD_ID))
+ return 3;
+ else
+ return 2;
+}
+
+static void board_update_no_keypad_by_fwconfig(void)
+{
+ if (!get_cbi_fw_config_numeric_pad()) {
+ /* Disable scanning KSO13 & 14 if keypad isn't present. */
+ keyboard_raw_set_cols(KEYBOARD_COLS_NO_KEYPAD);
+ keyscan_config.actual_key_mask[11] = 0xfa;
+ keyscan_config.actual_key_mask[12] = 0xca;
+ }
}
void board_init(void)
@@ -446,6 +529,8 @@ void board_init(void)
on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
CHIPSET_STATE_SOFT_OFF);
board_power_5v_enable(on);
+
+ board_update_no_keypad_by_fwconfig();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/lantis/board.h b/board/lantis/board.h
index df209187ac..ebd88caa42 100644
--- a/board/lantis/board.h
+++ b/board/lantis/board.h
@@ -64,6 +64,7 @@
/* Keyboard */
#define CONFIG_KEYBOARD_FACTORY_TEST
#define CONFIG_PWM_KBLIGHT
+#define CONFIG_KEYBOARD_KEYPAD
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
diff --git a/board/lantis/gpio.inc b/board/lantis/gpio.inc
index c24e20d5ec..2be82d2358 100644
--- a/board/lantis/gpio.inc
+++ b/board/lantis/gpio.inc
@@ -100,6 +100,7 @@ GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT)
GPIO(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */
GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW)
GPIO(EN_PP5000_PEN, PIN(B, 5), GPIO_OUT_LOW)
+GPIO(EC_VIVALDIKEYBOARD_ID, PIN(J, 4), GPIO_INPUT | GPIO_PULL_DOWN) /* keyboard ID */
/* NC pins, enable internal pull-down to avoid floating state. */
GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_DOWN)
@@ -109,7 +110,6 @@ GPIO(GPIOG4_NC, PIN(G, 4), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG5_NC, PIN(G, 5), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG6_NC, PIN(G, 6), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG7_NC, PIN(G, 7), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(GPIOJ4_NC, PIN(J, 4), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOJ5_NC, PIN(J, 5), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOJ6_NC, PIN(J, 6), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOM6_NC, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)