gpio: uclass: show DT gpio-line-names

gpio status -a does not have labels: the existing path walks
the per-bank requested label table.
Issue: The boards that populate the standard gpio-line-names
property in their device tree end up with anonymous entries,
which is not logic with the purpose of having those names in the DT.

No impact with boards that does not set gpio-line-names.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
This commit is contained in:
Vincent Jardin
2026-05-10 23:28:18 +02:00
committed by Tom Rini
parent e9848e30bd
commit ed5d719bc2

View File

@@ -877,8 +877,19 @@ static int get_function(struct udevice *dev, int offset, bool skip_unused,
return -ENODEV;
if (offset < 0 || offset >= uc_priv->gpio_count)
return -EINVAL;
if (namep)
if (namep) {
*namep = uc_priv->name[offset];
/* Fall back to DT "gpio-line-names" for unrequested pins. */
if (CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LINE_NAME) &&
(!*namep || !**namep)) {
const char *dt_name = NULL;
if (!dev_read_string_index(dev, "gpio-line-names",
offset, &dt_name) &&
dt_name && *dt_name)
*namep = dt_name;
}
}
if (skip_unused && !gpio_is_claimed(uc_priv, offset))
return GPIOF_UNUSED;
if (ops->get_function) {