diff options
author | amber.chen <amber.chen@lcfc.corp-partner.google.com> | 2021-09-02 09:42:22 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-08 04:13:13 +0000 |
commit | 1bcc3daf150e5718910ea331f78e4477d21864fa (patch) | |
tree | 37481f27c37d2dd2fa4f52c353d8c7ee3b6fca3c | |
parent | 6e3fe471dbe4c9875797ba121c8b50278042f50e (diff) | |
download | chrome-ec-1bcc3daf150e5718910ea331f78e4477d21864fa.tar.gz |
taeko/taeland: add keyboard backlight function
BUG=b:194477160
BRANCH=main
TEST=make -j BOARD=taeko
Signed-off-by: amber.chen <amber.chen@lcfc.corp-partner.google.com>
Change-Id: I4ca063b7b65ba78c9c3bb0e76217b7d76b6c2829
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139593
Reviewed-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Commit-Queue: Boris Mittelberg <bmbm@google.com>
-rw-r--r-- | board/taeko/board.c | 14 | ||||
-rw-r--r-- | board/taeko/fw_config.c | 5 | ||||
-rw-r--r-- | board/taeko/fw_config.h | 8 |
3 files changed, 21 insertions, 6 deletions
diff --git a/board/taeko/board.c b/board/taeko/board.c index e4a3814901..d7fe4e4399 100644 --- a/board/taeko/board.c +++ b/board/taeko/board.c @@ -53,9 +53,10 @@ static void board_chipset_resume(void) { /* Allow keyboard backlight to be enabled */ - /* TODO(b/194477160) - * Implement keyboard backlight control policy later. - */ + if (ec_cfg_has_keyboard_backlight() == 1) + gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); + else + gpio_set_level(GPIO_EC_KB_BL_EN_L, 0); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -64,9 +65,10 @@ static void board_chipset_suspend(void) { /* Turn off the keyboard backlight if it's on. */ - /* TODO(b/194477160) - * Implement keyboard backlight control policy later. - */ + if (ec_cfg_has_keyboard_backlight() == 1) + gpio_set_level(GPIO_EC_KB_BL_EN_L, 0); + else + gpio_set_level(GPIO_EC_KB_BL_EN_L, 1); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); diff --git a/board/taeko/fw_config.c b/board/taeko/fw_config.c index 886c56b314..4e450b7dfa 100644 --- a/board/taeko/fw_config.c +++ b/board/taeko/fw_config.c @@ -58,3 +58,8 @@ enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void) { return fw_config.usb_db; } + +bool ec_cfg_has_keyboard_backlight(void) +{ + return (fw_config.kb_bl == KEYBOARD_BACKLIGHT_ENABLED); +} diff --git a/board/taeko/fw_config.h b/board/taeko/fw_config.h index 7e59a4308e..db4c6d60c0 100644 --- a/board/taeko/fw_config.h +++ b/board/taeko/fw_config.h @@ -51,4 +51,12 @@ union taeko_cbi_fw_config get_fw_config(void); */ enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void); +/** + * Check if the FW_CONFIG has enabled keyboard backlight. + * + * @return true if board supports keyboard backlight, false if the board + * doesn't support it. + */ +bool ec_cfg_has_keyboard_backlight(void); + #endif /* __BOARD_TAEKO_FW_CONFIG_H_ */ |