diff options
-rw-r--r-- | board/samus/board.h | 1 | ||||
-rw-r--r-- | board/samus/panel.c | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/board/samus/board.h b/board/samus/board.h index 8e124b066e..09daf86757 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -27,6 +27,7 @@ #define CONFIG_POWER_BUTTON #define CONFIG_POWER_BUTTON_X86 +#define CONFIG_BACKLIGHT_REQ_GPIO GPIO_PCH_BL_EN #define CONFIG_BATTERY_CHECK_CONNECTED #define CONFIG_BATTERY_LINK #define CONFIG_BATTERY_SMART diff --git a/board/samus/panel.c b/board/samus/panel.c index 9b62f0e2c9..c9c9c3f6cb 100644 --- a/board/samus/panel.c +++ b/board/samus/panel.c @@ -21,7 +21,7 @@ /** * Enable PWM mode in backlight controller and turn it on. */ -static int lp8555_enable_pwm_mode(void) +static void lp8555_enable_pwm_mode(void) { int reg; @@ -39,9 +39,8 @@ static int lp8555_enable_pwm_mode(void) reg |= LP8555_REG_COMMAND_ON; i2c_write8(I2C_PORT_BACKLIGHT, I2C_ADDR_BACKLIGHT, LP8555_REG_COMMAND, reg); - - return EC_SUCCESS; } +DECLARE_DEFERRED(lp8555_enable_pwm_mode); /** * Host command to toggle backlight. @@ -67,7 +66,7 @@ void backlight_interrupt(enum gpio_signal signal) * PCH indicates it is turning on backlight so we should * attempt to put the backlight controller into PWM mode. */ - lp8555_enable_pwm_mode(); + hook_call_deferred(lp8555_enable_pwm_mode, 0); } /** @@ -80,6 +79,8 @@ static void update_backlight(void) * the AP in hardware. */ gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); + if (lid_is_open()) + hook_call_deferred(lp8555_enable_pwm_mode, 0); } DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); @@ -89,6 +90,6 @@ DECLARE_HOOK(HOOK_LID_CHANGE, update_backlight, HOOK_PRIO_DEFAULT); static void backlight_init(void) { gpio_enable_interrupt(GPIO_PCH_BL_EN); - update_backlight(); + gpio_set_level(GPIO_ENABLE_BACKLIGHT, lid_is_open()); } DECLARE_HOOK(HOOK_INIT, backlight_init, HOOK_PRIO_DEFAULT); |