Module Name:    src
Committed By:   jmcneill
Date:           Sat Nov 21 12:19:47 UTC 2015

Modified Files:
        src/sys/dev/i2c: as3722.c as3722.h

Log Message:
expose pmic reset functionality


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/as3722.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/as3722.h

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/as3722.c
diff -u src/sys/dev/i2c/as3722.c:1.2 src/sys/dev/i2c/as3722.c:1.3
--- src/sys/dev/i2c/as3722.c:1.2	Sat Nov 21 10:56:40 2015
+++ src/sys/dev/i2c/as3722.c	Sat Nov 21 12:19:47 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: as3722.c,v 1.2 2015/11/21 10:56:40 jmcneill Exp $ */
+/* $NetBSD: as3722.c,v 1.3 2015/11/21 12:19:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.2 2015/11/21 10:56:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.3 2015/11/21 12:19:47 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1
 
 #define AS3722_RESET_CTRL_REG		0x36
 #define AS3722_RESET_CTRL_POWER_OFF	__BIT(1)
+#define AS3722_RESET_CTRL_FORCE_RESET	__BIT(0)
 
 #define AS3722_WATCHDOG_CTRL_REG	0x38
 #define AS3722_WATCHDOG_CTRL_MODE	__BITS(2,1)
@@ -251,3 +252,19 @@ as3722_poweroff(device_t dev)
 
 	return error;
 }
+
+int
+as3722_reboot(device_t dev)
+{
+	struct as3722_softc * const sc = device_private(dev);
+	int error;
+
+	const int flags = I2C_F_POLL;
+
+	iic_acquire_bus(sc->sc_i2c, flags);
+	error = as3722_write(sc, AS3722_RESET_CTRL_REG,
+	    AS3722_RESET_CTRL_FORCE_RESET, flags);
+	iic_release_bus(sc->sc_i2c, flags);
+
+	return error;
+}

Index: src/sys/dev/i2c/as3722.h
diff -u src/sys/dev/i2c/as3722.h:1.1 src/sys/dev/i2c/as3722.h:1.2
--- src/sys/dev/i2c/as3722.h:1.1	Wed Nov 11 12:35:22 2015
+++ src/sys/dev/i2c/as3722.h	Sat Nov 21 12:19:47 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: as3722.h,v 1.1 2015/11/11 12:35:22 jmcneill Exp $ */
+/* $NetBSD: as3722.h,v 1.2 2015/11/21 12:19:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -30,5 +30,6 @@
 #define _DEV_I2C_AS3722_H
 
 int	as3722_poweroff(device_t);
+int	as3722_reboot(device_t);
 
 #endif /* !_DEV_I2C_AS3722_H */

Reply via email to