summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-08-27 14:54:27 -0700
committerGerrit <chrome-bot@google.com>2012-08-28 11:34:04 -0700
commit619032a77c171ff11251648a4af61fb0578dd097 (patch)
treeca06e57d8e4e31b7f6c35eca791caf113a1f4484
parent6a59616721b8afc4c2a615ff0035da881d3c5d6f (diff)
downloadchrome-ec-619032a77c171ff11251648a4af61fb0578dd097.tar.gz
snow: toggle pull-up on PA7 (SUSPEND_L) on power on/off
This adds hooks to re-configure SUSPEND_L (GPIO PA7) when the system turns on/off. When the system is turned on, PA7 will have its internal pull-up enabled. This is required since SUSPEND_L is driven by an open- drain buffer. When the AP is off, we can disable the pull-up (configure PA7 as floating input) to reduce leakage. Signed-off-by: David Hendricks <dhendrix@chromium.org> BRANCH=snow BUG=chrome-os-partner:12700,chrome-os-partner:13200 TEST=see notes below 1. Dump GPIO_A CRL when system is off: read 0x40010800 = 0x41484144 2. Dump GPIO_A CRL when system is on: read 0x40010800 = 0x81484144 3. Dump GPIO_A when system is put into suspend: read 0x40010800 = 0x81484144 4. Resume, see power LED react quickly. 5. Soft poweroff, dump GPIO_A CRL: read 0x40010800 = 0x41484144 Change-Id: I62f02324a2a1fbfb6eff539fc6fdc35a035fa020 Reviewed-on: https://gerrit.chromium.org/gerrit/31315 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r--board/snow/board.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/board/snow/board.c b/board/snow/board.c
index 8fe510a020..55edbedd2d 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -10,6 +10,7 @@
#include "console.h"
#include "dma.h"
#include "gpio.h"
+#include "hooks.h"
#include "i2c.h"
#include "pmu_tpschrome.h"
#include "power_led.h"
@@ -21,6 +22,9 @@
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT (GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+#define INT_BOTH_FLOATING (GPIO_INPUT | GPIO_INT_BOTH)
+#define INT_BOTH_PULL_UP (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
+
/* GPIO interrupt handlers prototypes */
#ifndef CONFIG_TASK_GAIAPOWER
#define gaia_power_event NULL
@@ -43,7 +47,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH, gaia_power_event},
{"CHARGER_INT", GPIO_C, (1<<4), GPIO_INT_FALLING, pmu_irq_handler},
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_RISING, gaia_lid_event},
- {"SUSPEND_L", GPIO_A, (1<<7), GPIO_INT_BOTH, gaia_suspend_event},
+ {"SUSPEND_L", GPIO_A, (1<<7), INT_BOTH_FLOATING, gaia_suspend_event},
{"WP_L", GPIO_B, (1<<4), GPIO_INPUT, NULL},
{"KB_IN00", GPIO_C, (1<<8), GPIO_KB_INPUT, matrix_interrupt},
{"KB_IN01", GPIO_C, (1<<9), GPIO_KB_INPUT, matrix_interrupt},
@@ -197,6 +201,21 @@ void board_power_led_config(enum powerled_config config)
}
}
+static int board_startup_hook(void)
+{
+ gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP);
+ return 0;
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_startup_hook, HOOK_PRIO_DEFAULT);
+
+static int board_shutdown_hook(void)
+{
+ /* Disable pull-up on SUSPEND_L during shutdown to prevent leakage */
+ gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_FLOATING);
+ return 0;
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown_hook, HOOK_PRIO_DEFAULT);
+
enum {
/* Time between requesting bus and deciding that we have it */
BUS_SLEW_DELAY_US = 10,