From: dlg Date: Fri, 7 Apr 2023 06:18:26 +0000 (+0000) Subject: fixed regulators could have a "gpios" or "gpio" property. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4c7a860af8792aaaf26bc4a1996c1f8ae5ddb49a;p=openbsd 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@ --- 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);