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 | |
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>
-rw-r--r-- | board/daisy/board.c | 4 | ||||
-rw-r--r-- | board/daisy/board.h | 4 | ||||
-rw-r--r-- | common/gaia_power.c | 24 |
3 files changed, 16 insertions, 16 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c index a0ef122f45..21ccdada28 100644 --- a/board/daisy/board.c +++ b/board/daisy/board.c @@ -42,7 +42,7 @@ void gaia_power_event(enum gpio_signal signal); /* GPIO signal list. Must match order from enum gpio_signal. */ const struct gpio_info gpio_list[GPIO_COUNT] = { /* Inputs with interrupt handlers are first for efficiency */ - {"KB_PWR_ON", GPIO_B, (1<<5), GPIO_INT_BOTH, gaia_power_event}, + {"KB_PWR_ON_L", GPIO_B, (1<<5), GPIO_INT_BOTH, gaia_power_event}, {"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, gaia_power_event}, {"XPSHOLD", GPIO_A, (1<<3), GPIO_INT_RISING, gaia_power_event}, {"CHARGER_INT", GPIO_C, (1<<4), GPIO_INT_RISING, NULL}, @@ -62,7 +62,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL}, {"EN_PP5000", GPIO_A, (1<<11), GPIO_OUT_LOW, NULL}, {"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL}, - {"PMIC_PWRON", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL}, + {"PMIC_PWRON_L", GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL}, {"ENTERING_RW", GPIO_H, (1<<0), GPIO_OUT_LOW, NULL}, {"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL}, {"EC_INT", GPIO_B, (1<<9), GPIO_HI_Z, NULL}, diff --git a/board/daisy/board.h b/board/daisy/board.h index 6e8dc05f9e..fb3efd51a5 100644 --- a/board/daisy/board.h +++ b/board/daisy/board.h @@ -19,7 +19,7 @@ /* GPIO signal list */ enum gpio_signal { /* Inputs with interrupt handlers are first for efficiency */ - GPIO_KB_PWR_ON = 0, /* Keyboard power button */ + GPIO_KB_PWR_ON_L = 0, /* Keyboard power button */ GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */ GPIO_SOC1V8_XPSHOLD, /* App Processor ON */ GPIO_CHARGER_INT, @@ -39,7 +39,7 @@ enum gpio_signal { GPIO_EN_PP1350, /* DDR 1.35v rail enable */ GPIO_EN_PP5000, /* 5.0v rail enable */ GPIO_EN_PP3300, /* 3.3v rail enable */ - GPIO_PMIC_PWRON, /* 5v rail ready */ + GPIO_PMIC_PWRON_L, /* 5v rail ready */ GPIO_EC_ENTERING_RW, /* EC is R/W mode for the kbc mux */ GPIO_CHARGER_EN, GPIO_EC_INT, 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); |