diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-01-13 11:35:05 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-04-16 23:06:54 -0400 |
commit | 9360bb06f1db4597b7d08ea95b48a17025a97618 (patch) | |
tree | 25c781e7f536164f1cd415505283b246197c1fcd /include/asm-generic | |
parent | 4292fb16bff1af883b98517b73ea8f7cbfee948f (diff) |
gpio: add helper GPIOD_FLAGS_OUTPUT
Add a macro to provide the GPIO output value according
the dir flags content.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/gpio.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 4d5348d8c8..5686df7cec 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -129,6 +129,12 @@ struct gpio_desc { */ }; +/* helper to compute the value of the gpio output */ +#define GPIOD_FLAGS_OUTPUT_MASK (GPIOD_ACTIVE_LOW | GPIOD_IS_OUT_ACTIVE) +#define GPIOD_FLAGS_OUTPUT(flags) \ + (((((flags) & GPIOD_FLAGS_OUTPUT_MASK) == GPIOD_IS_OUT_ACTIVE) || \ + (((flags) & GPIOD_FLAGS_OUTPUT_MASK) == GPIOD_ACTIVE_LOW))) + /** * dm_gpio_is_valid() - Check if a GPIO is valid * |