diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-01-26 23:04:42 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-01-26 23:04:42 +0000 |
commit | 8ade892e9bce2ee93aa311a93d73986b15f81a52 (patch) | |
tree | cc11818495026ad3af2abc39d001eaba927f3d22 | |
parent | 0c43808edafd73b1ab4d05a987e95e46c8b4be65 (diff) |
The enable-gpios property is an optional property, so don't error out if
it's not there. This allows pwmbl(4) to attach and work on the Pinebook
Pro.
-rw-r--r-- | sys/dev/fdt/pwmbl.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/fdt/pwmbl.c b/sys/dev/fdt/pwmbl.c index d2c336568b8..db9dde295c1 100644 --- a/sys/dev/fdt/pwmbl.c +++ b/sys/dev/fdt/pwmbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwmbl.c,v 1.1 2019/10/21 20:52:33 kettenis Exp $ */ +/* $OpenBSD: pwmbl.c,v 1.2 2020/01/26 23:04:41 patrick Exp $ */ /* * Copyright (c) 2019 Krystian Lewandowski * Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org> @@ -86,18 +86,14 @@ pwmbl_attach(struct device *parent, struct device *self, void *aux) sc->sc_pwm_len = len; len = OF_getproplen(faa->fa_node, "enable-gpios"); - if (len < 0) { - free(sc->sc_pwm, M_DEVBUF, sc->sc_pwm_len); - printf(": no gpio\n"); - return; + if (len > 0) { + gpios = malloc(len, M_TEMP, M_WAITOK); + OF_getpropintarray(faa->fa_node, "enable-gpios", gpios, len); + gpio_controller_config_pin(&gpios[0], GPIO_CONFIG_OUTPUT); + gpio_controller_set_pin(&gpios[0], 1); + free(gpios, M_TEMP, len); } - gpios = malloc(len, M_TEMP, M_WAITOK); - OF_getpropintarray(faa->fa_node, "enable-gpios", gpios, len); - gpio_controller_config_pin(&gpios[0], GPIO_CONFIG_OUTPUT); - gpio_controller_set_pin(&gpios[0], 1); - free(gpios, M_TEMP, len); - len = OF_getproplen(faa->fa_node, "brightness-levels"); if (len < 0) { free(sc->sc_pwm, M_DEVBUF, sc->sc_pwm_len); |