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>
This commit is contained in:
Simon Glass
2012-08-21 17:12:20 +01:00
committed by Gerrit
parent d7ed508b66
commit eb2348d05f
4 changed files with 24 additions and 3 deletions

7
README
View File

@@ -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.

View File

@@ -58,7 +58,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},
@@ -144,6 +144,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 */

View File

@@ -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
@@ -107,6 +109,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 */

View File

@@ -305,9 +305,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");
}
@@ -434,6 +434,9 @@ void pmu_init(void)
/* Enable charger interrupt. */
gpio_enable_interrupt(GPIO_CHARGER_INT);
#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'