diff options
author | Simon Glass <sjg@chromium.org> | 2012-08-21 17:12:20 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2012-08-29 22:10:41 -0700 |
commit | b24a09c8f7c76ada451b0478eca84ca3003be3d3 (patch) | |
tree | 04355b48018470b62565cd0e9f4412c28cb22b83 | |
parent | 3b3aeffe014a4a5e3ebba13c54a923c7dad05f58 (diff) | |
download | chrome-ec-b24a09c8f7c76ada451b0478eca84ca3003be3d3.tar.gz |
Make AC status feature optional at compile time
This feature is not actually used on current platforms. Avoid setting
up the GPIO unless it is specifically enabled.
BUG=chrome-os-partner:13064
BRANCH=snow
TEST=manual
build and boot on snow. See the AC power GPIO does not change when
un/plugging power.
Change-Id: I6731625a19f30f6dd35471b126f3083b39747203
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31304
Reviewed-by: David Hendricks <dhendrix@chromium.org>
(cherry picked from commit eb2348d05f00839d28b98936deff3c925e180749)
Reviewed-on: https://gerrit.chromium.org/gerrit/31823
-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' |