mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user