diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-12-03 10:11:55 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-15 03:55:27 +0000 |
commit | 7ef0196dd3bf701575aba3fc6ea9bfa9f4f0d64e (patch) | |
tree | 349ddc73fba821ecf1affbeadae5321ea0185b87 /zephyr/include/dt-bindings/gpio_defines.h | |
parent | c3d4badd49ab9c6239c67ea67f566ee810796793 (diff) | |
download | chrome-ec-7ef0196dd3bf701575aba3fc6ea9bfa9f4f0d64e.tar.gz |
gpio_defines: make header visible to chameleon
Move this to include/ so chameleon can use it too.
BUG=b:174754428
TEST=compiles
Change-Id: I8898a7e2beb5c30c0577fe0fd36d69fe631d0624
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2570998
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2630149
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/include/dt-bindings/gpio_defines.h')
-rw-r--r-- | zephyr/include/dt-bindings/gpio_defines.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/zephyr/include/dt-bindings/gpio_defines.h b/zephyr/include/dt-bindings/gpio_defines.h new file mode 100644 index 0000000000..07a499299b --- /dev/null +++ b/zephyr/include/dt-bindings/gpio_defines.h @@ -0,0 +1,47 @@ +/* + * Copyright 2020 Google LLC. + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef DT_BINDINGS_GPIO_DEFINES_H_ +#define DT_BINDINGS_GPIO_DEFINES_H_ + +#include <dt-bindings/gpio/gpio.h> + +/* + * The GPIO_INPUT and GPIO_OUTPUT defines are normally not available to + * the device tree. For GPIOs that are controlled by the platform/ec module, we + * allow device tree to set the initial state. + * + * Note the raw defines (e.g. GPIO_OUTPUT) in this file are copies from + * <drivers/gpio.h> + * + * The combined defined (e.g. GPIO_OUT_LOW) have been renamed to fit with + * gpio defined in platform/ec codebase. + */ + +/** Enables pin as input. */ +#define GPIO_INPUT (1U << 8) + +/** Enables pin as output, no change to the output state. */ +#define GPIO_OUTPUT (1U << 9) + +/* Initializes output to a low state. */ +#define GPIO_OUTPUT_INIT_LOW (1U << 10) + +/* Initializes output to a high state. */ +#define GPIO_OUTPUT_INIT_HIGH (1U << 11) + +/** Configures GPIO pin as output and initializes it to a low state. */ +#define GPIO_OUT_LOW (GPIO_OUTPUT | GPIO_OUTPUT_INIT_LOW) + +/** Configures GPIO pin as output and initializes it to a high state. */ +#define GPIO_OUT_HIGH (GPIO_OUTPUT | GPIO_OUTPUT_INIT_HIGH) + +/** Configures GPIO pin as ODR output and initializes it to a low state. */ +#define GPIO_ODR_LOW (GPIO_OUT_LOW | GPIO_OPEN_DRAIN) + +/** Configures GPIO pin as ODR output and initializes it to a high state. */ +#define GPIO_ODR_HIGH (GPIO_OUT_HIGH | GPIO_OPEN_DRAIN) + +#endif /* DT_BINDINGS_GPIO_DEFINES_H_ */ |