summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2013-11-07 10:37:40 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-11-08 00:53:27 +0000
commit308e02195d2ae9c71ea41512a08b2c17babf482e (patch)
tree966c8f0bd0cc7288ca18723eddd0e933489292b6
parent1d2845d2db7c9023d6c2ee6203cf9ddc1c968abc (diff)
downloadchrome-ec-308e02195d2ae9c71ea41512a08b2c17babf482e.tar.gz
Take XPSHOLD back.
The XPSHOLD is not floated. It connects to +1.8V_VDDIO, which indicates high when AP is on. So, bring it back. Also remove the duplicated GPIO definition (GPIO_PWR_LED1). Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> BUG=chrome-os-partner:23929 BRANCH=nyan TEST=verified on nyan. successfully boot up the machine. Change-Id: I293a899bcdf255f36f6117627f66ed8231c9a70f Reviewed-on: https://chromium-review.googlesource.com/176046 Reviewed-by: Yen Lin <yelin@nvidia.com> Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--board/nyan/board.c4
-rw-r--r--board/nyan/board.h4
-rw-r--r--power/tegra.c18
3 files changed, 5 insertions, 21 deletions
diff --git a/board/nyan/board.c b/board/nyan/board.c
index 19cbfb08b1..0219056d9a 100644
--- a/board/nyan/board.c
+++ b/board/nyan/board.c
@@ -28,6 +28,7 @@
const struct gpio_info gpio_list[] = {
/* Inputs with interrupt handlers are first for efficiency */
{"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, power_interrupt},
+ {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_BOTH, power_interrupt},
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, lid_interrupt},
{"SUSPEND_L", GPIO_C, (1<<7), GPIO_KB_INPUT, power_interrupt},
{"SPI1_NSS", GPIO_A, (1<<4), GPIO_INT_BOTH | GPIO_PULL_UP,
@@ -60,7 +61,7 @@ const struct gpio_info gpio_list[] = {
{"I2C1_SDA", GPIO_B, (1<<7), GPIO_ODR_HIGH, NULL},
{"I2C2_SCL", GPIO_B, (1<<10), GPIO_ODR_HIGH, NULL},
{"I2C2_SDA", GPIO_B, (1<<11), GPIO_ODR_HIGH, NULL},
- {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL},
+ {"LED_POWER_L", GPIO_A, (1<<2), GPIO_OUT_HIGH, NULL}, /* PWR_LED1 */
{"PMIC_PWRON_L", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
{"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
{"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
@@ -77,7 +78,6 @@ const struct gpio_info gpio_list[] = {
{"KB_OUT11", GPIO_C, (1<<4), GPIO_KB_OUTPUT, NULL},
{"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL},
{"PWR_LED0", GPIO_B, (1<<10), GPIO_OUT_LOW, NULL},
- {"PWR_LED1", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL},
{"BAT_LED0", GPIO_B, (1<<11), GPIO_OUT_LOW, NULL},
{"BAT_LED1", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
{"CHARGING", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL},
diff --git a/board/nyan/board.h b/board/nyan/board.h
index 8f90bd66ef..1b1c5aed48 100644
--- a/board/nyan/board.h
+++ b/board/nyan/board.h
@@ -40,6 +40,7 @@
enum gpio_signal {
/* Inputs with interrupt handlers are first for efficiency */
GPIO_KB_PWR_ON_L = 0,
+ GPIO_SOC1V8_XPSHOLD,
GPIO_LID_OPEN,
GPIO_SUSPEND_L,
GPIO_SPI1_NSS,
@@ -64,7 +65,7 @@ enum gpio_signal {
GPIO_I2C1_SDA,
GPIO_I2C2_SCL,
GPIO_I2C2_SDA,
- GPIO_LED_POWER_L,
+ GPIO_LED_POWER_L, /* alias to GPIO_PWR_LED1 */
GPIO_PMIC_PWRON_L,
GPIO_PMIC_RESET,
GPIO_KB_OUT00,
@@ -81,7 +82,6 @@ enum gpio_signal {
GPIO_KB_OUT11,
GPIO_KB_OUT12,
GPIO_PWR_LED0,
- GPIO_PWR_LED1,
GPIO_BAT_LED0,
GPIO_BAT_LED1,
GPIO_CHARGING,
diff --git a/power/tegra.c b/power/tegra.c
index cc2fefadfc..18b39ea7fe 100644
--- a/power/tegra.c
+++ b/power/tegra.c
@@ -20,6 +20,7 @@
* released
* - Holding pwron for 9s powers off the AP
* - Pressing and releasing pwron within that 9s is ignored
+ * - If XPSHOLD is dropped by the AP, then we power the AP off
*/
#include "clock.h"
@@ -44,8 +45,6 @@
/* Long power key press to force shutdown */
#define DELAY_FORCE_SHUTDOWN (9 * SECOND)
-/* TODO(crosbug.com/p/23853): remove TODO_XPSHOLD */
-#ifdef TODO_XPSHOLD
/*
* If the power key is pressed to turn on, then held for this long, we
* power off.
@@ -55,7 +54,6 @@
* press or XPSHOLD == 0).
*/
#define DELAY_SHUTDOWN_ON_POWER_HOLD (9 * SECOND)
-#endif /* TODO_XPSHOLD */
/* Maximum delay after power button press before we deassert GPIO_PMIC_PWRON */
#define DELAY_RELEASE_PWRON SECOND /* 1s */
@@ -63,13 +61,11 @@
/* debounce time to prevent accidental power-on after keyboard power off */
#define KB_PWR_ON_DEBOUNCE 250 /* 250us */
-#ifdef TODO_XPSHOLD
/*
* nyan's GPIO_SOC1V8_XPSHOLD will go low for ~20ms after initial high.
* XPSHOLD_DEBOUNCE is used to wait this long, then check the signal again.
*/
#define XPSHOLD_DEBOUNCE (30 * 1000) /* 30 ms */
-#endif /* TODO_XPSHOLD */
/* Application processor power state */
static int ap_on;
@@ -204,11 +200,9 @@ static int check_for_power_off_event(void)
power_button_was_pressed = pressed;
-#ifdef TODO_XPSHOLD
/* XPSHOLD released by AP : shutdown immediately */
if (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 0)
return 3;
-#endif /* TODO_XPSHOLD */
return 0;
}
@@ -279,9 +273,7 @@ static int tegra_power_init(void)
{
/* Enable interrupts for our GPIOs */
gpio_enable_interrupt(GPIO_KB_PWR_ON_L);
-#ifdef TODO_XPSHOLD
gpio_enable_interrupt(GPIO_SOC1V8_XPSHOLD);
-#endif /* TODO_XPSHOLD */
gpio_enable_interrupt(GPIO_SUSPEND_L);
/* Leave power off only if requested by reset flags */
@@ -357,14 +349,12 @@ void chipset_force_shutdown(void)
*/
static int check_for_power_on_event(void)
{
-#ifdef TODO_XPSHOLD
/* check if system is already ON */
if (gpio_get_level(GPIO_SOC1V8_XPSHOLD)) {
CPRINTF("[%T system is on, thus clear auto_power_on]\n");
auto_power_on = 0; /* no need to arrange another power on */
return 1;
}
-#endif /* TODO_XPSHOLD */
/* power on requested at EC startup for recovery */
if (auto_power_on) {
@@ -403,11 +393,9 @@ static int power_on(void)
gpio_set_level(GPIO_AP_RESET_L, 1);
set_pmic_pwrok(1);
-#ifdef TODO_XPSHOLD
if (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 0)
/* Initialize non-AP components */
hook_notify(HOOK_CHIPSET_PRE_INIT);
-#endif /* TODO_XPSHOLD */
ap_on = 1;
disable_sleep(SLEEP_MASK_AP_RUN);
@@ -439,7 +427,6 @@ static int wait_for_power_button_release(unsigned int timeout_us)
return 0;
}
-#ifdef TODO_XPSHOLD
/**
* Wait for the XPSHOLD signal from the AP to be asserted within timeout_us
* and if asserted clear the PMIC_PWRON signal
@@ -467,7 +454,6 @@ static int react_to_xpshold(unsigned int timeout_us)
CPRINTF("[%T XPSHOLD seen]\n");
return 0;
}
-#endif /* TODO_XPSHOLD */
/**
* Power off the AP
@@ -542,14 +528,12 @@ void chipset_task(void)
if (!power_on()) {
int continue_power = 0;
-#ifdef TODO_XPSHOLD
if (!react_to_xpshold(DELAY_RELEASE_PWRON)) {
/* AP looks good */
if (!wait_for_power_button_release(
DELAY_SHUTDOWN_ON_POWER_HOLD))
continue_power = 1;
}
-#endif /* TODO_XPSHOLD */
set_pmic_pwrok(0);
if (continue_power) {
power_button_was_pressed = 0;