aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Meloun <mmel@FreeBSD.org>2025-11-06 19:37:14 +0000
committerMichal Meloun <mmel@FreeBSD.org>2026-02-22 17:53:28 +0000
commit9de43130f989896d92dda22ed73ca3033863efd7 (patch)
tree4b0e55e422104a1c2a1aed5c8f537e2ce41e1e36
parent92c66dc5f8723083530efbbc5cfa4068105f472c (diff)
regulator_fixed: add support for 'gpios' property
This is a newer version of the "gpio" property. MFC after: 3 weeks
-rw-r--r--sys/dev/regulator/regulator_fixed.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/regulator/regulator_fixed.c b/sys/dev/regulator/regulator_fixed.c
index 55cdb5e4aeae..148bd28cdd16 100644
--- a/sys/dev/regulator/regulator_fixed.c
+++ b/sys/dev/regulator/regulator_fixed.c
@@ -380,6 +380,7 @@ regfix_parse_fdt(struct regfix_softc * sc)
{
phandle_t node;
int rv;
+ char *name;
struct regnode_init_def *init_def;
node = ofw_bus_get_node(sc->dev);
@@ -405,15 +406,21 @@ regfix_parse_fdt(struct regfix_softc * sc)
if (OF_hasprop(node, "gpio-open-drain"))
sc->init_def.gpio_open_drain = true;
- if (!OF_hasprop(node, "gpio"))
- return (0);
- rv = ofw_bus_parse_xref_list_alloc(node, "gpio", "#gpio-cells", 0,
- &sc->gpio_prodxref, &sc->gpio_ncells, &sc->gpio_cells);
+ if (OF_hasprop(node, "gpio"))
+ name = "gpio";
+ else if (OF_hasprop(node, "gpios"))
+ name = "gpios";
+ else
+ return(0);
+
+ rv = ofw_bus_parse_xref_list_alloc(node, name, "#gpio-cells",
+ 0, &sc->gpio_prodxref, &sc->gpio_ncells, &sc->gpio_cells);
if (rv != 0) {
sc->gpio_prodxref = 0;
- device_printf(sc->dev, "Malformed gpio property\n");
+ device_printf(sc->dev, "Malformed gpios property\n");
return (ENXIO);
}
+
return (0);
}