diff options
author | Hank Xie <hank.xie@quanta.corp-partner.google.com> | 2022-03-14 17:03:55 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-16 02:35:45 +0000 |
commit | f5e2513c3f2160a9f8ce0e50158718a4d9213468 (patch) | |
tree | 13393ea55e098f27f13ea3f97c650658f001b9db /board/lantis/board.c | |
parent | dbbbe2946d44693b183bedbe7d628bfc66b493df (diff) | |
download | chrome-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>
Diffstat (limited to 'board/lantis/board.c')
-rw-r--r-- | board/lantis/board.c | 89 |
1 files changed, 87 insertions, 2 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); |