diff options
author | Chris Zhong <zyw@rock-chips.com> | 2014-11-10 00:57:15 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-13 04:23:22 +0000 |
commit | 208f28fac1c24ed9c673ebfe29f1190edece57c9 (patch) | |
tree | 1aee962589d5aaceb86806b0e58365eb4f6c87fa /board/jerry | |
parent | 48b8c34aedd018ff603f00c1daa97a382bd7055e (diff) | |
download | chrome-ec-208f28fac1c24ed9c673ebfe29f1190edece57c9.tar.gz |
Jerry: modify gpio config, hibernate
Added hibernate wakeup pin(EC_WAKE) that covers both AC_PRESENT and LID_OPEN. It pulses a
rising edge when either of them have a rising edge.
The power button was also inverted to handle hibernation better, now it's low
except when pressed it temporarly goes high.
BRANCH=None
BUG=chrome-os-partner:33269 chrome-os-partner:32782
TEST=make BOARD=jerry
Try hibernating, all wakeup sources should work, it shouldn't stay hibernated.
All signals(AC, lid, power button) should work equally well as in pinky.
Change-Id: I894135bdfd5600919296f7510dc9cd1acd567ddc
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/228763
Diffstat (limited to 'board/jerry')
-rw-r--r-- | board/jerry/board.h | 4 | ||||
-rw-r--r-- | board/jerry/gpio.inc | 9 | ||||
-rw-r--r-- | board/jerry/led.c | 29 |
3 files changed, 29 insertions, 13 deletions
diff --git a/board/jerry/board.h b/board/jerry/board.h index 398a56b62a..5a05393717 100644 --- a/board/jerry/board.h +++ b/board/jerry/board.h @@ -28,6 +28,7 @@ #define CONFIG_LOW_POWER_IDLE #define CONFIG_LOW_POWER_S0 #define CONFIG_POWER_BUTTON +#define CONFIG_POWER_BUTTON_ACTIVE_STATE 1 #define CONFIG_POWER_COMMON #define CONFIG_PWM #define CONFIG_SPI @@ -35,6 +36,8 @@ #define CONFIG_VBOOT_HASH #undef CONFIG_WATCHDOG_HELP +#define CONFIG_HIBERNATE_WAKEUP_PINS (STM32_PWR_CSR_EWUP1 | STM32_PWR_CSR_EWUP6) + #ifndef __ASSEMBLER__ /* 48 MHz SYSCLK clock frequency */ @@ -57,7 +60,6 @@ enum power_signal { RK_POWER_GOOD = 0, RK_SUSPEND_ASSERTED, - /* Number of power signals */ POWER_SIGNAL_COUNT }; diff --git a/board/jerry/gpio.inc b/board/jerry/gpio.inc index a0909168c2..29efb848d1 100644 --- a/board/jerry/gpio.inc +++ b/board/jerry/gpio.inc @@ -6,12 +6,12 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) +GPIO(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ GPIO(SOC_POWER_GOOD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) GPIO(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) GPIO(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) GPIO(SPI1_NSS, A, 4, GPIO_INT_BOTH, spi_event) -GPIO(AC_PRESENT, A, 0, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) +GPIO(AC_PRESENT, A, 8, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) /* Keyboard inputs */ GPIO(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) @@ -24,10 +24,10 @@ GPIO(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) GPIO(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(WP_L, B, 4, GPIO_INPUT, NULL) +GPIO(EC_WAKE, A, 0, GPIO_INPUT | GPIO_PULL_DOWN, NULL) /* wk1 */ +GPIO(WP_L, B, 4, GPIO_INPUT, NULL) /* Outputs */ -GPIO(5V_DRV, A, 8, GPIO_OUT_LOW, NULL) GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW, NULL) GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW, NULL) GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW, NULL) @@ -48,6 +48,7 @@ GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT, NULL) GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT, NULL) +GPIO(POWER_LED, A, 2, GPIO_OUT_LOW, NULL) GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW, NULL) GPIO(PMIC_RESET, B, 3, GPIO_OUT_LOW, NULL) GPIO(PMIC_SOURCE_PWREN, B, 10, GPIO_OUT_LOW, NULL) diff --git a/board/jerry/led.c b/board/jerry/led.c index 005f314c7e..aead84efd8 100644 --- a/board/jerry/led.c +++ b/board/jerry/led.c @@ -14,7 +14,9 @@ #include "util.h" const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_BATTERY_LED}; + EC_LED_ID_BATTERY_LED, + EC_LED_ID_POWER_LED, +}; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -39,6 +41,12 @@ static int bat_led_set(enum led_color color, int on) return EC_SUCCESS; } +static int pwr_led_set(int on) +{ + gpio_set_level(GPIO_POWER_LED, on); + return EC_SUCCESS; +} + void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { /* Ignoring led_id as both leds support the same colors */ @@ -48,7 +56,8 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) { - if (EC_LED_ID_BATTERY_LED == led_id) { + switch (led_id) { + case EC_LED_ID_BATTERY_LED: if (brightness[EC_LED_COLOR_GREEN] != 0) { bat_led_set(LED_GREEN, 1); bat_led_set(LED_ORANGE, 0); @@ -59,11 +68,15 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) bat_led_set(LED_GREEN, 0); bat_led_set(LED_ORANGE, 0); } - return EC_SUCCESS; - } else { + break; + case EC_LED_ID_POWER_LED: + pwr_led_set(brightness[EC_LED_COLOR_BLUE]); + break; + default: return EC_ERROR_UNKNOWN; - } + } + return EC_SUCCESS; } static void jerry_led_set_power(void) @@ -78,11 +91,11 @@ static void jerry_led_set_power(void) * Power off: OFF */ if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - bat_led_set(LED_GREEN, 0); + pwr_led_set(0); else if (chipset_in_state(CHIPSET_STATE_ON)) - bat_led_set(LED_GREEN, 1); + pwr_led_set(1); else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) - bat_led_set(LED_GREEN, (power_second & 3) ? 0 : 1); + pwr_led_set((power_second & 3) ? 0 : 1); } |