summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-uclass.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-01-13 13:35:05 +0300
committerTom Rini <trini@konsulko.com>2020-04-17 06:06:54 +0300
commit9360bb06f1db4597b7d08ea95b48a17025a97618 (patch)
tree25c781e7f536164f1cd415505283b246197c1fcd /drivers/gpio/gpio-uclass.c
parent4292fb16bff1af883b98517b73ea8f7cbfee948f (diff)
downloadu-boot-9360bb06f1db4597b7d08ea95b48a17025a97618.tar.xz
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 'drivers/gpio/gpio-uclass.c')
-rw-r--r--drivers/gpio/gpio-uclass.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index b5cebfdbc6..29c8c0f57b 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -542,12 +542,9 @@ static int _dm_gpio_set_dir_flags(struct gpio_desc *desc, ulong flags)
}
if (flags & GPIOD_IS_OUT) {
- int value = flags & GPIOD_IS_OUT_ACTIVE ? 1 : 0;
-
- if (flags & GPIOD_ACTIVE_LOW)
- value = !value;
- ret = ops->direction_output(dev, desc->offset, value);
- } else if (flags & GPIOD_IS_IN) {
+ ret = ops->direction_output(dev, desc->offset,
+ GPIOD_FLAGS_OUTPUT(flags));
+ } else if (flags & GPIOD_IS_IN) {
ret = ops->direction_input(dev, desc->offset);
}