summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-08-21 17:12:20 +0100
committerGerrit <chrome-bot@google.com>2012-08-27 14:27:14 -0700
commiteb2348d05f00839d28b98936deff3c925e180749 (patch)
treea8f81085482529c58ecceca57c4906b303baada0
parentd7ed508b66dc50b408b0a6a49b2c5558157b3826 (diff)
downloadchrome-ec-eb2348d05f00839d28b98936deff3c925e180749.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>
-rw-r--r--README7
-rw-r--r--board/snow/board.c9
-rw-r--r--board/snow/board.h4
-rw-r--r--common/pmu_tps65090.c7
4 files changed, 24 insertions, 3 deletions
diff --git a/README b/README
index 1efc6a730c..3a122e1894 100644
--- a/README
+++ b/README
@@ -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 b58e8cde86..d4cd99cd16 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -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 */
diff --git a/board/snow/board.h b/board/snow/board.h
index 07b29f0fb7..262fe14890 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
@@ -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 */
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c
index d26b855756..d6c8b1f994 100644
--- a/common/pmu_tps65090.c
+++ b/common/pmu_tps65090.c
@@ -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'