diff options
author | Patrice Chotard <patrice.chotard@foss.st.com> | 2022-08-30 14:09:14 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-15 09:55:30 -0400 |
commit | f6f681642f0d730887bfe944b029cb6f76a35fb6 (patch) | |
tree | 0c2b7993902b2a1ade43b7dce4bcb00b12d8fd02 /drivers/gpio/sandbox.c | |
parent | 2c38f7c31806c5724a2f9c58a47cf76979fd6f0a (diff) |
gpio: sandbox: Add GPIOD_IS_AF for gpio configured in alternate function
This allows to test if a pin's label if displayed using gpio_get_status()
when this pin is configured in alternate function.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'drivers/gpio/sandbox.c')
-rw-r--r-- | drivers/gpio/sandbox.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c index 106b2a7b27..305f9a6ff6 100644 --- a/drivers/gpio/sandbox.c +++ b/drivers/gpio/sandbox.c @@ -196,6 +196,8 @@ static int sb_gpio_get_function(struct udevice *dev, unsigned offset) return GPIOF_OUTPUT; if (get_gpio_flag(dev, offset, GPIOD_IS_IN)) return GPIOF_INPUT; + if (get_gpio_flag(dev, offset, GPIOD_IS_AF)) + return GPIOF_FUNC; return GPIOF_INPUT; /*GPIO is not configurated */ } @@ -219,6 +221,9 @@ static int sb_gpio_xlate(struct udevice *dev, struct gpio_desc *desc, if (args->args[1] & GPIO_OUT_ACTIVE) desc->flags |= GPIOD_IS_OUT_ACTIVE; + if (args->args[1] & GPIO_AF) + desc->flags |= GPIOD_IS_AF; + return 0; } |