Date: Mon, 26 Nov 2018 18:46:15 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340989 - head/sys/dev/extres/regulator Message-ID: <201811261846.wAQIkFx8053914@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: manu Date: Mon Nov 26 18:46:15 2018 New Revision: 340989 URL: https://svnweb.freebsd.org/changeset/base/340989 Log: regulator_fixed: Do not disable fixed regulator at probe If the regulator is unused it will be disabled by the regulator_shutdown sysinit. Tested on pinebook where the backlight is controlled by a fixed-regulator. The regulator doesn't have a regulator-boot-on param (I'm gonna upstream this) and so we disable it at probe. We later enable it but this cause the screen to go black. Linux doesn't disable regulator at boot (at least for fixed-regulator) so better match this to have the same UX. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D17978 Modified: head/sys/dev/extres/regulator/regulator_fixed.c Modified: head/sys/dev/extres/regulator/regulator_fixed.c ============================================================================== --- head/sys/dev/extres/regulator/regulator_fixed.c Mon Nov 26 18:31:00 2018 (r340988) +++ head/sys/dev/extres/regulator/regulator_fixed.c Mon Nov 26 18:46:15 2018 (r340989) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811261846.wAQIkFx8053914>