summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2023-04-07 06:18:27 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2023-04-07 06:18:27 +0000
commit717dd959cc09ee1f9a13518a8394b4211effb353 (patch)
treedd28076f5f62770152376bed1be51283b01df6b0 /sys/dev
parent268edc6c83ad0c54883236b46ef10aad2e5a9a07 (diff)
fixed regulators could have a "gpios" or "gpio" property.
we only handled "gpio" before. figuring this out has wasted many days of my life recently. ok patrick@ kettenis@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ofw/ofw_regulator.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/ofw/ofw_regulator.c b/sys/dev/ofw/ofw_regulator.c
index 2235dbebd46..e58b3a684f0 100644
--- a/sys/dev/ofw/ofw_regulator.c
+++ b/sys/dev/ofw/ofw_regulator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_regulator.c,v 1.17 2023/04/01 08:37:23 kettenis Exp $ */
+/* $OpenBSD: ofw_regulator.c,v 1.18 2023/04/07 06:18:26 dlg Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
@@ -106,13 +106,18 @@ regulator_fixed_set(int node, int enable)
uint32_t *gpio;
uint32_t startup_delay;
int len;
+ char *prop = "gpio";
pinctrl_byname(node, "default");
- /* The "gpio" property is optional. */
- len = OF_getproplen(node, "gpio");
- if (len < 0)
- return 0;
+ /* The "gpio"/"gpios" property is optional. */
+ len = OF_getproplen(node, prop);
+ if (len < 0) {
+ prop = "gpios";
+ len = OF_getproplen(node, prop);
+ if (len < 0)
+ return 0;
+ }
/*
* We deliberately ignore the "enable-active-high" property
@@ -128,7 +133,7 @@ regulator_fixed_set(int node, int enable)
*/
gpio = malloc(len, M_TEMP, M_WAITOK);
- OF_getpropintarray(node, "gpio", gpio, len);
+ OF_getpropintarray(node, prop, gpio, len);
gpio_controller_config_pin(gpio, GPIO_CONFIG_OUTPUT);
if (enable)
gpio_controller_set_pin(gpio, 1);