diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/poppy/board.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c index 227d812f1d..a2cbb5e8a0 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -308,6 +308,21 @@ void base_detect_interrupt(enum gpio_signal signal) base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US; } +static void base_enable(void) +{ + /* Enable base detection interrupt. */ + base_detect_debounce_time = get_time().val; + hook_call_deferred(&base_detect_deferred_data, 0); + gpio_enable_interrupt(GPIO_BASE_DET_A); +} + +static void base_disable(void) +{ + /* Disable base detection interrupt and disable power to base. */ + gpio_disable_interrupt(GPIO_BASE_DET_A); + base_detect_change(BASE_DISCONNECTED); +} + #include "gpio_list.h" /* power signal list. Must match order of enum power_signal. */ @@ -583,11 +598,6 @@ static void board_init(void) /* Enable pericom BC1.2 interrupts */ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L); gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L); - - /* Enable base detection interrupt */ - base_detect_debounce_time = get_time().val; - hook_call_deferred(&base_detect_deferred_data, 0); - gpio_enable_interrupt(GPIO_BASE_DET_A); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -949,6 +959,8 @@ static void board_chipset_startup(void) */ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x41, 0x01); i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x2a, 0x02); + + base_enable(); } DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT); @@ -962,6 +974,8 @@ static void board_chipset_shutdown(void) */ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x41, 0x0); i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x2a, 0x0); + + base_disable(); } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT); |