aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/extres
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2018-11-26 18:46:15 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2018-11-26 18:46:15 +0000
commit3cb36739ce5896759952a5f648990732a410dffb (patch)
tree9c06c0f02aed1f420bf7ec2a83158b2effc5c512 /sys/dev/extres
parent72bce9fff6f10ac433bb3409fd34fd6eeef93f51 (diff)
Notes
Diffstat (limited to 'sys/dev/extres')
-rw-r--r--sys/dev/extres/regulator/regulator_fixed.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/extres/regulator/regulator_fixed.c b/sys/dev/extres/regulator/regulator_fixed.c
index 1362d3a236cc4..5c510bf5d3215 100644
--- a/sys/dev/extres/regulator/regulator_fixed.c
+++ b/sys/dev/extres/regulator/regulator_fixed.c
@@ -145,7 +145,6 @@ regnode_fixed_init(struct regnode *regnode)
struct regnode_fixed_sc *sc;
struct gpiobus_pin *pin;
uint32_t flags;
- bool enable;
int rv;
sc = regnode_get_softc(regnode);
@@ -158,14 +157,15 @@ regnode_fixed_init(struct regnode *regnode)
flags = GPIO_PIN_OUTPUT;
if (sc->gpio_open_drain)
flags |= GPIO_PIN_OPENDRAIN;
- enable = sc->param->boot_on || sc->param->always_on;
- if (!sc->param->enable_active_high)
- enable = !enable;
- rv = GPIO_PIN_SET(pin->dev, pin->pin, enable);
- if (rv != 0) {
- device_printf(dev, "Cannot set GPIO pin: %d\n", pin->pin);
- return (rv);
+ if (sc->param->boot_on || sc->param->always_on) {
+ rv = GPIO_PIN_SET(pin->dev, pin->pin, sc->param->enable_active_high);
+ if (rv != 0) {
+ device_printf(dev, "Cannot set GPIO pin: %d\n",
+ pin->pin);
+ return (rv);
+ }
}
+
rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags);
if (rv != 0) {
device_printf(dev, "Cannot configure GPIO pin: %d\n", pin->pin);