svn commit: r340989 - head/sys/dev/extres/regulator

Emmanuel Vadot manu at FreeBSD.org
Mon Nov 26 18:46:16 UTC 2018


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);


More information about the svn-src-head mailing list