mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
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>
This commit is contained in:
committed by
Tom Rini
parent
4292fb16bf
commit
9360bb06f1
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user