diff options
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | board/snow/board.c | 9 | ||||
-rw-r--r-- | board/snow/board.h | 4 | ||||
-rw-r--r-- | common/pmu_tps65090.c | 8 |
4 files changed, 25 insertions, 3 deletions
@@ -65,3 +65,10 @@ Build Options Define this to call configure_board_late() after initial system init is complete (and after GPIOs are set up). + +- CONFIG_AC_POWER_STATUS + + Monitor the state of the AC power input and drive out a GPIO to + the AP indicating this state. The GPIO will be driven low when + AC power is not connected, and high when it is connected. This + uses GPIO_AC_STATUS for this purpose. diff --git a/board/snow/board.c b/board/snow/board.c index de4c3fe6cf..214c069bb9 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -62,7 +62,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"SPI1_NSS", GPIO_A, (1<<4), GPIO_PULL_UP, NULL}, /* Outputs */ - {"AC_STATUS", GPIO_A, (1<<5), GPIO_OUT_HIGH, NULL}, + {"AC_STATUS", GPIO_A, (1<<5), GPIO_DEFAULT, NULL}, {"SPI1_MISO", GPIO_A, (1<<6), GPIO_OUT_HIGH, NULL}, {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL}, {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, @@ -149,6 +149,13 @@ void configure_board(void) gpio_set_level(GPIO_EC_INT, 1); } +void configure_board_late(void) +{ +#ifdef CONFIG_AC_POWER_STATUS + gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH); +#endif +} + void board_interrupt_host(int active) { /* interrupt host by using active low EC_INT signal */ diff --git a/board/snow/board.h b/board/snow/board.h index 47cc385b57..9f19283f33 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -17,6 +17,8 @@ /* use I2C for host communication */ #define CONFIG_I2C +#define CONFIG_CONFIGURE_BOARD_LATE + /* Debug features */ #define CONFIG_PANIC_HELP #undef CONFIG_PANIC_NEW_STACK @@ -111,6 +113,8 @@ enum gpio_signal { void configure_board(void); +void configure_board_late(void); + void matrix_interrupt(enum gpio_signal signal); /* Signal to AP that data is waiting */ diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c index 1e5dbed70b..0804ce3c8b 100644 --- a/common/pmu_tps65090.c +++ b/common/pmu_tps65090.c @@ -296,9 +296,9 @@ int pmu_low_current_charging(int enable) void pmu_irq_handler(enum gpio_signal signal) { - /* TODO(rongchang): remove GPIO_AC_STATUS, we're not using it */ +#ifdef CONFIG_AC_POWER_STATUS gpio_set_level(GPIO_AC_STATUS, pmu_get_ac()); - +#endif task_wake(TASK_ID_PMU_TPS65090_CHARGER); CPRINTF("Charger IRQ received.\n"); } @@ -445,6 +445,10 @@ void pmu_init(void) if (failure) board_hard_reset(); + +#ifdef CONFIG_AC_POWER_STATUS + gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH); +#endif } /* Initializes PMU when power is turned on. This is necessary because the TPS' |