diff options
author | orion <orion@FreeBSD.org> | 2002-08-25 02:00:49 +0000 |
---|---|---|
committer | orion <orion@FreeBSD.org> | 2002-08-25 02:00:49 +0000 |
commit | 5a92e9c8ce2fda348c4aceb54f91f0d24e2326cc (patch) | |
tree | 0c856df5b5191faac293df501e3cd36dc0d78c40 | |
parent | e0d23f387eb3345f3557c9050597dbf3ca1859f9 (diff) | |
download | FreeBSD-src-5a92e9c8ce2fda348c4aceb54f91f0d24e2326cc.zip FreeBSD-src-5a92e9c8ce2fda348c4aceb54f91f0d24e2326cc.tar.gz |
Add suspend and resume support.
Contributed by: Takanori Watanabe <takawata@FreeBSD.org>
PR: kern/41809
-rw-r--r-- | sys/dev/sound/pci/solo.c | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index 9578569..7c5e56e0 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -893,9 +893,46 @@ ess_probe(device_t dev) return s? 0 : ENXIO; } -#define PCI_LEGACYCONTROL 0x40 -#define PCI_CONFIG 0x50 -#define PCI_DDMACONTROL 0x60 +#define ESS_PCI_LEGACYCONTROL 0x40 +#define ESS_PCI_CONFIG 0x50 +#define ESS_PCI_DDMACONTROL 0x60 + +static int +ess_suspend(device_t dev) +{ + return 0; +} + +static int +ess_resume(device_t dev) +{ + uint16_t ddma; + uint32_t data; + struct ess_info *sc = pcm_getdevinfo(dev); + + data = pci_read_config(dev, PCIR_COMMAND, 2); + data |= PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN; + pci_write_config(dev, PCIR_COMMAND, data, 2); + data = pci_read_config(dev, PCIR_COMMAND, 2); + + ddma = rman_get_start(sc->vc) | 1; + pci_write_config(dev, ESS_PCI_LEGACYCONTROL, 0x805f, 2); + pci_write_config(dev, ESS_PCI_DDMACONTROL, ddma, 2); + pci_write_config(dev, ESS_PCI_CONFIG, 0, 2); + + if (ess_reset_dsp(sc)) + goto no; + if (mixer_reinit(dev)) + goto no; + if (sc->newspeed) + ess_setmixer(sc, 0x71, 0x2a); + + port_wr(sc->io, 0x7, 0xb0, 1); /* enable irqs */ + + return 0; + no: + return EIO; +} static int ess_attach(device_t dev) @@ -920,9 +957,9 @@ ess_attach(device_t dev) sc->bufsz = pcm_getbuffersize(dev, 4096, SOLO_DEFAULT_BUFSZ, 65536); ddma = rman_get_start(sc->vc) | 1; - pci_write_config(dev, PCI_LEGACYCONTROL, 0x805f, 2); - pci_write_config(dev, PCI_DDMACONTROL, ddma, 2); - pci_write_config(dev, PCI_CONFIG, 0, 2); + pci_write_config(dev, ESS_PCI_LEGACYCONTROL, 0x805f, 2); + pci_write_config(dev, ESS_PCI_DDMACONTROL, ddma, 2); + pci_write_config(dev, ESS_PCI_CONFIG, 0, 2); if (ess_reset_dsp(sc)) goto no; @@ -996,8 +1033,8 @@ static device_method_t ess_methods[] = { DEVMETHOD(device_probe, ess_probe), DEVMETHOD(device_attach, ess_attach), DEVMETHOD(device_detach, ess_detach), - DEVMETHOD(device_resume, bus_generic_resume), - DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, ess_resume), + DEVMETHOD(device_suspend, ess_suspend), { 0, 0 } }; |