Module Name:    src
Committed By:   jmcneill
Date:           Tue May 28 09:52:17 UTC 2019

Modified Files:
        src/sys/dev/i2c: axppmic.c

Log Message:
Enable always-on and boot-on regulators at attach time


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/i2c/axppmic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.21 src/sys/dev/i2c/axppmic.c:1.22
--- src/sys/dev/i2c/axppmic.c:1.21	Mon May 27 23:28:41 2019
+++ src/sys/dev/i2c/axppmic.c	Tue May 28 09:52:17 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.21 2019/05/27 23:28:41 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.22 2019/05/28 09:52:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.21 2019/05/27 23:28:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.22 2019/05/28 09:52:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1037,10 +1037,16 @@ axpreg_attach(device_t parent, device_t 
 	if (of_getprop_uint32(phandle, "regulator-min-microvolt", &min_uvol) == 0 &&
 	    of_getprop_uint32(phandle, "regulator-max-microvolt", &max_uvol) == 0) {
 		if (uvol < min_uvol || uvol > max_uvol) {
-			aprint_debug_dev(self, "fix voltage %u uV -> %u/%u uV\n", uvol, min_uvol, max_uvol);
+			aprint_debug_dev(self, "fix voltage %u uV -> %u/%u uV\n",
+			    uvol, min_uvol, max_uvol);
 			axpreg_set_voltage(self, min_uvol, max_uvol);
 		}
 	}
+
+	if (of_hasprop(phandle, "regulator-always-on") ||
+	    of_hasprop(phandle, "regulator-boot-on")) {
+		axpreg_enable(self, true);
+	}
 }
 
 CFATTACH_DECL_NEW(axppmic, sizeof(struct axppmic_softc),

Reply via email to