summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-08-10 15:42:12 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-11 21:21:34 +0000
commitccb0c139310671c659fc457cf61c4193a9d64fb1 (patch)
tree387dd04050b9641e09e2eef228b3f3bf14f626d8 /board
parent5b93f04c195675c8ad093bd2c36c85088e68ab74 (diff)
downloadchrome-ec-ccb0c139310671c659fc457cf61c4193a9d64fb1.tar.gz
glados: Turn off LEDs in hibernate
Use new board-level hibernate GPIO state function to turn off LEDs in hibernate. BUG=chrome-os-partner:43807 TEST=Manual on Glados with subsequent commit. Run 'hibernate' on console, verify that LED remains off. Press power button, verify that board wakes. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Id695df9b5e75514f8f807a894b63f71676b66f92 Reviewed-on: https://chromium-review.googlesource.com/292317 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/glados/board.c30
1 files changed, 30 insertions, 0 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;
+}