From 5b93f04c195675c8ad093bd2c36c85088e68ab74 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Mon, 10 Aug 2015 15:26:03 -0700 Subject: mec1322: Allow GPIO hibernate state to be specified at board-level Add a new board-level function board_get_gpio_hibernate_state which can optionally be defined to set the desired state of a GPIO during 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 Change-Id: Ica11554e231e88773c3e139fea4622377ebe1e42 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/292471 Reviewed-by: Aaron Durbin --- include/gpio.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/gpio.h') diff --git a/include/gpio.h b/include/gpio.h index 5ffb1bd0ab..2e7555d241 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -49,6 +49,11 @@ /* Convert GPIO mask to GPIO number / index. */ #define GPIO_MASK_TO_NUM(mask) (31 - __builtin_clz(mask)) +/* Convert a GPIO to a port + mask pair */ +#define GPIO_TO_PORT_MASK_PAIR(gpio) \ + { gpio_list[(gpio)].port, \ + GPIO_MASK_TO_NUM(gpio_list[(gpio)].mask) } + /* NOTE: This is normally included from board.h, thru config.h and common.h But, * some boards and unit tests don't have a gpio_signal enum defined, so we * define an emtpy one here.*/ -- cgit v1.2.1