summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVincent Jardin <[email protected]>2026-05-10 23:28:18 +0200
committerTom Rini <[email protected]>2026-05-25 13:43:24 -0600
commited5d719bc25b3cc9121992d1ffa845ba8cd6a548 (patch)
treec2e09ffef84cceccd75b5520ffcc08c4dd9e6163 /drivers
parente9848e30bd88bf889ef74799dab6c2a2a0628890 (diff)
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 <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-uclass.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index 7651d5360d6..4d40738e5aa 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -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) {