diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-01-13 11:35:09 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-04-16 23:06:54 -0400 |
commit | 8fd9daf0363e6d0bda8cc9a6330eb08a0c98543f (patch) | |
tree | 8f6b79fee9ca39f4f66b0e178481de980dddb503 /include/asm-generic | |
parent | d2c07e56ab3ef0cec99335aa8dafbed691d23739 (diff) |
gpio: add ops to set dir flags
Add the ops for GPIO driver set_dir_flags() to set the dir flags.
The user can update the direction and configuration
of each GPIO with a only call to dm_gpio_set_dir_flags() or
dm_gpio_set_dir() and respecting the configuration provided by
device tree (saved in desc->flags).
When these optional ops are absent, the gpio uclass use the mandatory
ops (direction_output, direction_input, get_value) and desc->flags
to manage only the main dir flags:
- GPIOD_IS_IN
- GPIOD_IS_OUT
- GPIOD_IS_OUT_ACTIVE
- GPIOD_ACTIVE_LOW
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 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 7c1f71b1ac..859f41a0d4 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -299,6 +299,22 @@ struct dm_gpio_ops { struct ofnode_phandle_args *args); /** + * set_dir_flags() - Set GPIO dir flags + * + * This function should set up the GPIO configuration according to the + * information provide by the direction flags bitfield. + * + * This method is optional. + * + * @dev: GPIO device + * @offset: GPIO offset within that device + * @flags: GPIO configuration to use + * @return 0 if OK, -ve on error + */ + int (*set_dir_flags)(struct udevice *dev, unsigned int offset, + ulong flags); + + /** * get_dir_flags() - Get GPIO dir flags * * This function return the GPIO direction flags used. |