diff options
-rw-r--r-- | board/glados/board.c | 30 | ||||
-rw-r--r-- | chip/mec1322/system.c | 8 |
2 files changed, 30 insertions, 8 deletions
diff --git a/board/glados/board.c b/board/glados/board.c index 5e026b71b6..3473179cb8 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -319,3 +319,33 @@ void board_chipset_suspend(void) gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 0); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); + +/* Turn off LEDs in hibernate */ +uint32_t board_get_gpio_hibernate_state(uint32_t port, uint32_t pin) +{ + int i; + const uint32_t led_gpios[][2] = { + GPIO_TO_PORT_MASK_PAIR(GPIO_CHARGE_LED_1), + GPIO_TO_PORT_MASK_PAIR(GPIO_CHARGE_LED_2), + }; + +#ifdef GLADOS_BOARD_V1 + /* + * Leave PCH RTCRST deasserted. + * TODO(crosbug.com/p/42774): Remove this once we have a + * pull-down on PCH_RTCRST. + */ + const uint32_t rtcrst_gpio[2] = + GPIO_TO_PORT_MASK_PAIR(GPIO_PCH_RTCRST); + if (port == rtcrst_gpio[0] && pin == rtcrst_gpio[1]) + return GPIO_OUTPUT | GPIO_LOW; +#endif + + /* LED GPIOs should be driven low to turn off LEDs */ + for (i = 0; i < ARRAY_SIZE(led_gpios); ++i) + if (led_gpios[i][0] == port && led_gpios[i][1] == pin) + return GPIO_OUTPUT | GPIO_LOW; + + /* Other GPIOs should be put in a low-power state */ + return GPIO_INPUT | GPIO_PULL_UP; +} diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c index e8d4b0e9ba..d68456777e 100644 --- a/chip/mec1322/system.c +++ b/chip/mec1322/system.c @@ -187,14 +187,6 @@ static uint32_t system_get_gpio_hibernate_state(uint32_t port, uint32_t pin) { int i; const int skip[][2] = { -#ifdef GLADOS_BOARD_V1 - /* - * Leave PCH RTCRST deasserted. - * TODO(crosbug.com/p/42774): Remove this once we have a - * pull-down on PCH_RTCRST. - */ - GPIO_TO_PORT_MASK_PAIR(GPIO_PCH_RTCRST), -#endif /* * Leave USB-C charging enabled in hibernate, in order to * allow wake-on-plug. 5V enable must be pulled low. |