From f6f681642f0d730887bfe944b029cb6f76a35fb6 Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Tue, 30 Aug 2022 14:09:14 +0200 Subject: 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 Reviewed-by: Simon Glass Reviewed-by: Patrick Delaunay --- drivers/gpio/sandbox.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/gpio/sandbox.c') 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; } -- cgit v1.2.3