From b9d7ff7c90cef5771907b97e2be6457a297f0003 Mon Sep 17 00:00:00 2001 From: Josh Tsai Date: Tue, 13 Apr 2021 16:59:37 +0800 Subject: brya: add function to enabled/disabled keyboard backlight Enabled keyboard backlight when system resume to S0 Disabled keyboard backlight when system suspend BUG=b:184103439 BRANCH=none TEST=Keyboard backlight can work normally Signed-off-by: Josh Tsai Change-Id: Idd4454bfba48d92bdfd75144141afac34c3781c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822275 Reviewed-by: Josh Tsai Reviewed-by: caveh jalali Tested-by: Josh Tsai Commit-Queue: Josh Tsai --- board/brya/board.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'board/brya') diff --git a/board/brya/board.c b/board/brya/board.c index eca893cc2b..8d6b6f9209 100644 --- a/board/brya/board.c +++ b/board/brya/board.c @@ -13,6 +13,7 @@ #include "driver/accel_lis2dw12.h" #include "driver/accelgyro_lsm6dso.h" #include "driver/als_tcs3400.h" +#include "hooks.h" #include "power_button.h" #include "power.h" #include "switch.h" @@ -48,6 +49,22 @@ __override void board_cbi_init(void) config_usb_db_type(); } +/* Called on AP S3 -> S0 transition */ +static void board_chipset_resume(void) +{ + /* Allow keyboard backlight to be enabled */ + gpio_set_level(GPIO_EC_KB_BL_EN, 1); +} +DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); + +/* Called on AP S0 -> S3 transition */ +static void board_chipset_suspend(void) +{ + /* Turn off the keyboard backlight if it's on. */ + gpio_set_level(GPIO_EC_KB_BL_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); + #ifdef CONFIG_CHARGE_RAMP_SW /* -- cgit v1.2.1