From df3441b92b1a461df49d21724db46a6c7f4156a0 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Thu, 17 Dec 2020 19:35:46 +0800 Subject: drobit: Implement keyboard matrix and keyboard backlight function 1. Base on keyboard spec, modify the keyboard related setting. 2. Implement keyboard backlight function. BUG=b:175851434 BRANCH=firmware-volteer-13521.B TEST=make BOARD=drobit 1. Verify keyboard function behavior. 2. Verify keyboard backlight behavior. Signed-off-by: Jacky Wang Change-Id: I4472f7d73126324df31b4e7c3d58bcf3d6c153dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597127 Reviewed-by: Michael5 Chen Reviewed-by: Keith Short Tested-by: Michael5 Chen --- board/drobit/board.c | 40 +++++++++++++++++++++++++++++++++++++++- board/drobit/board.h | 2 ++ 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'board/drobit') diff --git a/board/drobit/board.c b/board/drobit/board.c index 722cdee8a1..7a84951465 100644 --- a/board/drobit/board.c +++ b/board/drobit/board.c @@ -54,11 +54,34 @@ struct keyboard_scan_config keyscan_config = { .min_post_scan_delay_us = 1000, .poll_timeout_us = 100 * MSEC, .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, + 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */ }, }; +static const struct ec_response_keybd_config drobit_kb = { + .num_top_row_keys = 10, + .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_VOL_MUTE, /* T8 */ + TK_VOL_DOWN, /* T9 */ + TK_VOL_UP, /* T10 */ + }, + .capabilities = KEYBD_CAP_SCRNLOCK_KEY, +}; + +__override const struct ec_response_keybd_config +*board_vivaldi_keybd_config(void) +{ + return &drobit_kb; +} + /******************************************************************************/ /* * FW_CONFIG defaults for Volteer if the CBI data is not initialized. @@ -430,3 +453,18 @@ int ppc_get_alert_status(int port) else return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0; } + +/* Called on AP S0ix -> S0 tranition */ +static void board_chipset_resume(void) +{ + gpio_set_level(GPIO_EC_KB_BL_EN, 1); +} +DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); + +/* Called on AP S0 -> S0ix transition */ +static void board_chipset_suspend(void) +{ + gpio_set_level(GPIO_EC_KB_BL_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); + diff --git a/board/drobit/board.h b/board/drobit/board.h index 19866743f4..d30c42ee02 100644 --- a/board/drobit/board.h +++ b/board/drobit/board.h @@ -36,6 +36,8 @@ #define CONFIG_LED_PWM_COUNT 1 /* Keyboard features */ +#define CONFIG_KEYBOARD_VIVALDI +#define CONFIG_KEYBOARD_REFRESH_ROW3 /* Sensors */ #undef CONFIG_TABLET_MODE -- cgit v1.2.1