diff --git a/board/nautilus/board.c b/board/nautilus/board.c index 78f07ef354..c95f1ceab2 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -625,6 +625,14 @@ static void board_pmic_enable_slp_s0_vr_decay(void) i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a); } +void power_board_handle_host_sleep_event(enum host_sleep_event state) +{ + if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND) + board_pmic_enable_slp_s0_vr_decay(); + else if (state == HOST_SLEEP_EVENT_S0IX_RESUME) + board_pmic_disable_slp_s0_vr_decay(); +} + static void board_pmic_init(void) { if (system_jumped_to_this_image()) @@ -949,7 +957,6 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); static void board_chipset_resume(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1); - board_pmic_disable_slp_s0_vr_decay(); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -957,7 +964,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0); - board_pmic_enable_slp_s0_vr_decay(); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); diff --git a/board/poppy/board.c b/board/poppy/board.c index 58b108bb26..4baf488a85 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -636,6 +636,14 @@ static void board_pmic_enable_slp_s0_vr_decay(void) i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x38, 0x7a); } +void power_board_handle_host_sleep_event(enum host_sleep_event state) +{ + if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND) + board_pmic_enable_slp_s0_vr_decay(); + else if (state == HOST_SLEEP_EVENT_S0IX_RESUME) + board_pmic_disable_slp_s0_vr_decay(); +} + static void board_pmic_init(void) { if (system_jumped_to_this_image()) @@ -1019,7 +1027,6 @@ DECLARE_HOOK(HOOK_INIT, board_sensor_init, HOOK_PRIO_DEFAULT); static void board_chipset_resume(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1); - board_pmic_disable_slp_s0_vr_decay(); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); @@ -1027,7 +1034,6 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); static void board_chipset_suspend(void) { gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0); - board_pmic_enable_slp_s0_vr_decay(); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);