Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/fdt Set initial regulator states at attach time
details: https://anonhg.NetBSD.org/src/rev/dabf1406e8a9
branches: trunk
changeset: 838476:dabf1406e8a9
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jan 19 20:51:12 2019 +0000
description:
Set initial regulator states at attach time
diffstat:
sys/dev/fdt/gpioregulator.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (41 lines):
diff -r f1c7ad43bf39 -r dabf1406e8a9 sys/dev/fdt/gpioregulator.c
--- a/sys/dev/fdt/gpioregulator.c Sat Jan 19 20:50:48 2019 +0000
+++ b/sys/dev/fdt/gpioregulator.c Sat Jan 19 20:51:12 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioregulator.c,v 1.1 2017/08/13 18:27:31 jmcneill Exp $ */
+/* $NetBSD: gpioregulator.c,v 1.2 2019/01/19 20:51:12 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpioregulator.c,v 1.1 2017/08/13 18:27:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioregulator.c,v 1.2 2019/01/19 20:51:12 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -100,6 +100,7 @@
const int phandle = faa->faa_phandle;
const uint32_t *pstates;
uint32_t mask;
+ u_int gpios_states;
char *name;
int len, n;
@@ -163,6 +164,14 @@
}
}
+ /* "gpios-states" property */
+ if (of_getprop_uint32(phandle, "gpios-states", &gpios_states) != 0)
+ gpios_states = 0;
+
+ /* Set initial state */
+ for (n = 0; n < sc->sc_npins; n++)
+ fdtbus_gpio_write(sc->sc_pins[n], (gpios_states >> n) & 1);
+
fdtbus_register_regulator_controller(self, phandle,
&gpioregulator_funcs);
Home |
Main Index |
Thread Index |
Old Index