Module Name:    src
Committed By:   macallan
Date:           Tue Nov  9 20:44:49 UTC 2010

Modified Files:
        src/sys/arch/macppc/dev: pmu.c pmuvar.h

Log Message:
add support for controlling power to the modem in some PowerBooks
works at least with my Pismo, probably others


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/dev/pmu.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/dev/pmuvar.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/arch/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.18 src/sys/arch/macppc/dev/pmu.c:1.19
--- src/sys/arch/macppc/dev/pmu.c:1.18	Tue Sep 14 04:40:35 2010
+++ src/sys/arch/macppc/dev/pmu.c	Tue Nov  9 20:44:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.18 2010/09/14 04:40:35 macallan Exp $ */
+/*	$NetBSD: pmu.c,v 1.19 2010/11/09 20:44:49 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.18 2010/09/14 04:40:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.19 2010/11/09 20:44:49 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -758,6 +758,20 @@
 		while (1);
 }
 
+void
+pmu_modem(int on)
+{
+	struct pmu_softc *sc;
+	uint8_t resp[16], cmd[2] = {0, 0};
+
+	if (pmu0 == NULL)
+		return;
+
+	sc = pmu0;
+	cmd[0] = PMU_POW0_MODEM | (on ? PMU_POW0_ON : 0);
+	pmu_send(sc, PMU_POWER_CTRL0, 1, cmd, 16, resp);
+}
+
 static void
 pmu_autopoll(void *cookie, int flag)
 {

Index: src/sys/arch/macppc/dev/pmuvar.h
diff -u src/sys/arch/macppc/dev/pmuvar.h:1.7 src/sys/arch/macppc/dev/pmuvar.h:1.8
--- src/sys/arch/macppc/dev/pmuvar.h:1.7	Tue Apr 29 06:53:02 2008
+++ src/sys/arch/macppc/dev/pmuvar.h	Tue Nov  9 20:44:49 2010
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmuvar.h,v 1.7 2008/04/29 06:53:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmuvar.h,v 1.8 2010/11/09 20:44:49 macallan Exp $");
 
 #ifndef PMUVAR_H
 #define PMUVAR_H
@@ -72,6 +72,7 @@
 #define PMU_I2C_CMD		0x9a	/* i2c commands */
 #define PMU_GET_LID_STATE	0xdc	/* Report lid state */
 #define PMU_GET_VERSION		0xea	/* Identify thyself */
+#define PMU_SET_LED		0xee	/* control system LED */
 
 /* Bits in PMU interrupt and interrupt mask bytes */
 #define PMU_INT_ADB_AUTO	0x04	/* ADB autopoll, when PMU_INT_ADB */
@@ -86,6 +87,7 @@
 #define PMU_POW0_ON		0x80	/* OR this to power ON the device */
 #define PMU_POW0_OFF		0x00	/* leave bit 7 to 0 to power it OFF */
 #define PMU_POW0_HARD_DRIVE	0x04	/* wallstreet/lombard? */
+#define PMU_POW0_MODEM		0x08	/* pismo, maybe others */
 
 /* Bits to use with the PMU_POWER_CTRL command */
 #define PMU_POW_ON		0x80	/* OR this to power ON the device */
@@ -148,5 +150,6 @@
 
 void pmu_poweroff(void);
 void pmu_restart(void);
+void pmu_modem(int);
 
 #endif /* PMUVAR_H */

Reply via email to