summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-05-29 12:58:04 -0700
committerVincent Palatin <vpalatin@chromium.org>2012-05-31 00:36:23 +0000
commitcf71281c4b948e173d7cf2428c52dde6fad072df (patch)
tree766c4801ede8e63e2b7e06692364794df2d09b7c
parent4f90f89ebff5c9845365a2f068c9a5def8e5c7f5 (diff)
downloadchrome-ec-cf71281c4b948e173d7cf2428c52dde6fad072df.tar.gz
stm32: assert/de-assert GPIO_PMIC_PWRON_L with keyboard power event
This sets the PMIC_PWRON_L signal to correspond with the keyboard power button state. BUG=chrome-os-partner:9821 TEST=Tested on Lucas (see notes below) Signed-off-by: David Hendricks <dhendrix@chromium.org> 1. AC power plugged in, AP off, EC booted > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L 2. AP running, press and release power button (should see screen zoom out and then back in, but I don't have a monitor...) 2a. AP running, power button not pressed > gpioget PMIC_PWRON_L 1 PMIC_PWRON_L 2b. Press power button > Waiting for long power press 280507864 > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L 2c. release power button before 8s > Cancel power off > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L 3. From AP off state, press and hold keyboard power button > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L After 8s, we see: Timeout waiting for GPIO 0/KB_PWR_ON_L Power button was not released in time Shutdown complete. 4. AP on, press and hold keyboard power button > gpioget PMIC_PWRON_L 1 PMIC_PWRON_L > Waiting for long power press 654024769 > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L > Power off after long press now=654025073, 0 ending loop 2 Shutdown complete. <-- Note: This message comes from power_off() which also de-asserts PMIC_PWRON_L > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L Change-Id: I6955771707ecea2926570be0e8bd77ebddbca4d4 (cherry picked from commit b8eefd91c1f0b9c86c0b9d06daedec5c81ee8863)
-rw-r--r--common/gaia_power.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c
index 18e319368b..878798969a 100644
--- a/common/gaia_power.c
+++ b/common/gaia_power.c
@@ -152,6 +152,8 @@ static int check_for_power_off_event(void)
now = get_time();
if (pressed) {
+ gpio_set_level(GPIO_PMIC_PWRON_L, 0);
+
if (!power_button_was_pressed) {
power_off_deadline.val = now.val + DELAY_FORCE_SHUTDOWN;
CPRINTF("Waiting for long power press %u\n",
@@ -164,6 +166,7 @@ static int check_for_power_off_event(void)
}
} else if (power_button_was_pressed) {
CPUTS("Cancel power off\n");
+ gpio_set_level(GPIO_PMIC_PWRON_L, 1);
}
power_button_was_pressed = pressed;