Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/dev add support for controlling power to the...



details:   https://anonhg.NetBSD.org/src/rev/fe7354505549
branches:  trunk
changeset: 758585:fe7354505549
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Nov 09 20:44:49 2010 +0000

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

diffstat:

 sys/arch/macppc/dev/pmu.c    |  18 ++++++++++++++++--
 sys/arch/macppc/dev/pmuvar.h |   5 ++++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diffs (74 lines):

diff -r c536c9dca9b9 -r fe7354505549 sys/arch/macppc/dev/pmu.c
--- a/sys/arch/macppc/dev/pmu.c Tue Nov 09 20:34:55 2010 +0000
+++ b/sys/arch/macppc/dev/pmu.c Tue Nov 09 20:44:49 2010 +0000
@@ -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)
 {
diff -r c536c9dca9b9 -r fe7354505549 sys/arch/macppc/dev/pmuvar.h
--- a/sys/arch/macppc/dev/pmuvar.h      Tue Nov 09 20:34:55 2010 +0000
+++ b/sys/arch/macppc/dev/pmuvar.h      Tue Nov 09 20:44:49 2010 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index