diff options
-rw-r--r-- | common/extpower_gpio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/extpower_gpio.c b/common/extpower_gpio.c index d027b3d221..b73d748701 100644 --- a/common/extpower_gpio.c +++ b/common/extpower_gpio.c @@ -50,8 +50,16 @@ void extpower_interrupt(enum gpio_signal signal) static void extpower_init(void) { + uint8_t *memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG); + debounced_extpower_presence = gpio_get_level(GPIO_AC_PRESENT); + /* Initialize the memory-mapped AC_PRESENT flag */ + if (debounced_extpower_presence) + *memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT; + else + *memmap_batt_flags &= ~EC_BATT_FLAG_AC_PRESENT; + /* Enable interrupts, now that we've initialized */ gpio_enable_interrupt(GPIO_AC_PRESENT); } |