summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-08-10 15:26:03 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-11 21:21:28 +0000
commit5b93f04c195675c8ad093bd2c36c85088e68ab74 (patch)
treea307cc07989047b263dee827e9b4317a16a80b43 /include/gpio.h
parentfba4f335a9a78f4112980fcf1cc36d44cfda0406 (diff)
downloadchrome-ec-5b93f04c195675c8ad093bd2c36c85088e68ab74.tar.gz
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 <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/292471 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h5
1 files changed, 5 insertions, 0 deletions
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.*/