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>
This commit is contained in:
committed by
Tom Rini
parent
2c38f7c318
commit
f6f681642f
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user