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
This commit is contained in:
David Hendricks
2012-05-29 12:58:04 -07:00
parent f267899861
commit b8eefd91c1

View File

@@ -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;