From 73162e60afd2559c9df9836c756dde523275de14 Mon Sep 17 00:00:00 2001 From: Benjamin Gordon Date: Tue, 23 Jan 2018 09:24:21 -0700 Subject: [PATCH] zoombini: Enable LM3630A driver for keyboard backlight BUG=b:69379749 BRANCH=None TEST=kblight 100; kblight 50; kblight 0 Change-Id: I096ed43859e11a7984d9672bfab406f0cb91015f Signed-off-by: Benjamin Gordon Reviewed-on: https://chromium-review.googlesource.com/881945 Reviewed-by: Aseda Aboagye --- board/zoombini/board.c | 17 +++++++++++++++++ board/zoombini/board.h | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/board/zoombini/board.c b/board/zoombini/board.c index 42a21cfc1b..b6966f1642 100644 --- a/board/zoombini/board.c +++ b/board/zoombini/board.c @@ -14,6 +14,7 @@ #include "console.h" #include "compile_time_macros.h" #include "driver/als_opt3001.h" +#include "driver/led/lm3630a.h" #include "driver/pmic_tps650x30.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/ps8xxx.h" @@ -482,6 +483,22 @@ static void board_pmic_init(void) } DECLARE_HOOK(HOOK_INIT, board_pmic_init, HOOK_PRIO_INIT_I2C+1); +#ifdef BOARD_ZOOMBINI +static void board_kblight_init(void) +{ + gpio_set_level(GPIO_KB_BL_EN, 1); + lm3630a_poweron(); +} +DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_kblight_init, HOOK_PRIO_DEFAULT); + +static void board_kblight_stop(void) +{ + lm3630a_poweroff(); + gpio_set_level(GPIO_KB_BL_EN, 0); +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_kblight_stop, HOOK_PRIO_DEFAULT); +#endif /* defined(BOARD_ZOOMBINI) */ + void board_reset_pd_mcu(void) { /* GPIO_USB_PD_RST_L resets all the TCPCs. */ diff --git a/board/zoombini/board.h b/board/zoombini/board.h index d61c182760..95e98522ff 100644 --- a/board/zoombini/board.h +++ b/board/zoombini/board.h @@ -33,6 +33,11 @@ #define CONFIG_LPC #define CONFIG_PWM +/* KB backlight driver */ +#ifdef BOARD_ZOOMBINI +#define CONFIG_LED_DRIVER_LM3630A +#endif /* defined(BOARD_ZOOMBINI) */ + /* TODO(aaboagye): Verify the right address. */ #define CONFIG_ALS_OPT3001 #define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1