summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-05-29 12:58:04 -0700
committerDavid Hendricks <dhendrix@chromium.org>2012-05-29 13:17:42 -0700
commitb8eefd91c1f0b9c86c0b9d06daedec5c81ee8863 (patch)
tree433811efb78d5eb21831f0dad746b54abcaef1e0
parentf2678998617771edbfb3574b66c4573d75e6dda7 (diff)
downloadchrome-ec-b8eefd91c1f0b9c86c0b9d06daedec5c81ee8863.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
-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 5a9f5bde3d..519099d0eb 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;