diff options
author | Simon Glass <sjg@chromium.org> | 2012-05-02 11:15:48 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2012-05-03 22:06:33 -0700 |
commit | 763eb6197eb9efd0861ae3a461e3b3a76677dded (patch) | |
tree | 2f37b4adf879fa608d8c365ad9a8ecf10ce6028d /common/gaia_power.c | |
parent | ea845714fd4cc163002ca1bbd3c14ab4e35ed3ec (diff) | |
download | chrome-ec-763eb6197eb9efd0861ae3a461e3b3a76677dded.tar.gz |
daisy: Rename power signals to indicate polarity
GPIO_KB_PWR_ON and GPIO_PMIC_PWRON are active low, so add _L to each
name to make this clearer.
BUG=chrome-os-partner:9424
TEST=very ad-hoc:
1. build and boot on daisy, flash U-Boot with USB using
'cros_bundle_firmware -w usb', inserting daisy
USB cable when it says 'Reseting board via servo...'
2. Press cold reset, then power on, see that it powers on
3. Then hold power-on for 8 seconds and see that it power off
4. XPSHOLD function not tested yet
Change-Id: Ibdc0064477c36e8658ef5605cdd5811c2283aff9
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/gaia_power.c')
-rw-r--r-- | common/gaia_power.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c index 04e72929b4..1683ecb006 100644 --- a/common/gaia_power.c +++ b/common/gaia_power.c @@ -81,7 +81,7 @@ static void wait_for_power_off(void) while (1) { /* wait for power button press or XPSHOLD falling edge */ - while ((gpio_get_level(GPIO_KB_PWR_ON) == 1) && + while ((gpio_get_level(GPIO_KB_PWR_ON_L) == 1) && (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 1)) { task_wait_event(-1); } @@ -91,22 +91,22 @@ static void wait_for_power_off(void) return; /* relay to PMIC */ - gpio_set_level(GPIO_PMIC_PWRON, 0); + gpio_set_level(GPIO_PMIC_PWRON_L, 0); /* check if power button is pressed for 8s */ deadline.val = get_time().val + DELAY_FORCE_SHUTDOWN; - while ((gpio_get_level(GPIO_KB_PWR_ON) == 0) && + while ((gpio_get_level(GPIO_KB_PWR_ON_L) == 0) && (gpio_get_level(GPIO_SOC1V8_XPSHOLD) == 1)) { now = get_time(); if ((now.val >= deadline.val) || (task_wait_event(deadline.val - now.val) == TASK_EVENT_TIMER)) { - gpio_set_level(GPIO_PMIC_PWRON, 1); + gpio_set_level(GPIO_PMIC_PWRON_L, 1); return; } } - gpio_set_level(GPIO_PMIC_PWRON, 1); + gpio_set_level(GPIO_PMIC_PWRON_L, 1); /* * Holding down the power button causes this loop to spin @@ -125,7 +125,7 @@ void gaia_power_event(enum gpio_signal signal) int gaia_power_init(void) { /* Enable interrupts for our GPIOs */ - gpio_enable_interrupt(GPIO_KB_PWR_ON); + gpio_enable_interrupt(GPIO_KB_PWR_ON_L); gpio_enable_interrupt(GPIO_PP1800_LDO2); gpio_enable_interrupt(GPIO_SOC1V8_XPSHOLD); @@ -165,10 +165,10 @@ void gaia_power_task(void) ap_on = 0; /* wait for Power button press */ - wait_in_signal(GPIO_KB_PWR_ON, 0, -1); + wait_in_signal(GPIO_KB_PWR_ON_L, 0, -1); usleep(KB_PWR_ON_DEBOUNCE); - if (gpio_get_level(GPIO_KB_PWR_ON) == 1) + if (gpio_get_level(GPIO_KB_PWR_ON_L) == 1) continue; /* Enable 5v power rail */ @@ -177,7 +177,7 @@ void gaia_power_task(void) usleep(DELAY_5V_SETUP); /* Startup PMIC */ - gpio_set_level(GPIO_PMIC_PWRON, 0); + gpio_set_level(GPIO_PMIC_PWRON_L, 0); /* wait for all PMIC regulators to be ready */ wait_in_signal(GPIO_PP1800_LDO2, 1, PMIC_TIMEOUT); @@ -201,7 +201,7 @@ void gaia_power_task(void) */ wait_in_signal(GPIO_SOC1V8_XPSHOLD, 1, FAIL_TIMEOUT); /* release PMIC startup signal */ - gpio_set_level(GPIO_PMIC_PWRON, 1); + gpio_set_level(GPIO_PMIC_PWRON_L, 1); /* Power ON state */ ap_on = 1; @@ -216,7 +216,7 @@ void gaia_power_task(void) CPUTS("Shutdown complete.\n"); /* Ensure the power button is released */ - wait_in_signal(GPIO_KB_PWR_ON, 1, -1); + wait_in_signal(GPIO_KB_PWR_ON_L, 1, -1); } } @@ -226,7 +226,7 @@ void gaia_power_task(void) static int command_force_power(int argc, char **argv) { /* simulate power button pressed */ - force_signal = GPIO_KB_PWR_ON; + force_signal = GPIO_KB_PWR_ON_L; force_value = 1; /* Wake up the task */ task_wake(TASK_ID_GAIAPOWER); |