summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-12-23 21:43:21 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-12-23 21:43:21 +0000
commitb688d56dab333e5961a9874a94173a7193a48a1e (patch)
tree233dc22e7629220b025899e3496d1b4907b8e688 /sys/dev
parentdaf4ccccc6fc5f4d84f3dbc5846d028bae4d91b7 (diff)
Use the generic PCI power management code instead of rolling our own.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/maestro.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/sys/dev/pci/maestro.c b/sys/dev/pci/maestro.c
index 8a9bd6acfb3..b50fe665ea1 100644
--- a/sys/dev/pci/maestro.c
+++ b/sys/dev/pci/maestro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maestro.c,v 1.31 2010/09/07 16:21:45 deraadt Exp $ */
+/* $OpenBSD: maestro.c,v 1.32 2011/12/23 21:43:20 kettenis Exp $ */
/* $FreeBSD: /c/ncvs/src/sys/dev/sound/pci/maestro.c,v 1.3 2000/11/21 12:22:11 julian Exp $ */
/*
* FreeBSD's ESS Agogo/Maestro driver
@@ -99,16 +99,6 @@
#define ACPI_PART_GAME_PORT 1
#define ACPI_PART_WP 0
-/* Power management */
-#define CONF_PM_PTR 0x34 /* BYTE R */
-#define PM_CID 0 /* BYTE R */
-#define PPMI_CID 1
-#define PM_CTRL 4 /* BYTE RW */
-#define PPMI_D0 0 /* Full power */
-#define PPMI_D1 1 /* Medium power */
-#define PPMI_D2 2 /* Low power */
-#define PPMI_D3 3 /* Turned off */
-
/* -----------------------------
* I/O ports
@@ -509,7 +499,6 @@ void maestro_initcodec(void *);
void maestro_set_speed(struct maestro_channel *, u_long *);
void maestro_init(struct maestro_softc *);
-void maestro_power(struct maestro_softc *, int);
void maestro_channel_start(struct maestro_channel *);
void maestro_channel_stop(struct maestro_channel *);
@@ -667,7 +656,7 @@ maestro_attach(parent, self, aux)
printf(": %s", intrstr);
/* Rangers, power up */
- maestro_power(sc, PPMI_D0);
+ pci_set_powerstate(pc, sc->pt, PCI_PMCSR_STATE_D0);
DELAY(100000);
/* Map i/o */
@@ -769,7 +758,7 @@ maestro_attach(parent, self, aux)
bad:
/* Power down. */
- maestro_power(sc, PPMI_D3);
+ pci_set_powerstate(pc, sc->pt, PCI_PMCSR_STATE_D3);
if (sc->ih)
pci_intr_disestablish(pc, sc->ih);
printf("%s: disabled\n", sc->dev.dv_xname);
@@ -1525,12 +1514,12 @@ maestro_activate(struct device *self, int act)
DELAY(20);
bus_space_write_4(sc->iot, sc->ioh, PORT_RINGBUS_CTRL, 0);
DELAY(1);
- maestro_power(sc, PPMI_D3);
+ pci_set_powerstate(sc->pc, sc->pt, PCI_PMCSR_STATE_D3);
break;
case DVACT_RESUME:
/* Power up device on resume. */
DPRINTF(("maestro: power resume\n"));
- maestro_power(sc, PPMI_D0);
+ pci_set_powerstate(sc->pc, sc->pt, PCI_PMCSR_STATE_D0);
DELAY(100000);
maestro_init(sc);
/* Restore codec settings */
@@ -1547,20 +1536,6 @@ maestro_activate(struct device *self, int act)
}
void
-maestro_power(sc, status)
- struct maestro_softc *sc;
- int status;
-{
- int data;
-
- /* Set the power state of the device. */
- data = pci_conf_read(sc->pc, sc->pt, CONF_PM_PTR);
- data = pci_conf_read(sc->pc, sc->pt, data);
- if (data == PPMI_CID)
- pci_conf_write(sc->pc, sc->pt, data + PM_CTRL, status);
-}
-
-void
maestro_channel_advance_dma(ch)
struct maestro_channel *ch;
{