summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pci/csa.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-06-27 07:43:57 +0000
committerglebius <glebius@FreeBSD.org>2005-06-27 07:43:57 +0000
commite544a2f3f980f000db3e6dbbc43307d0923bf354 (patch)
treed8dda7ebfff65b837a2f61fa32f8a2e4be6ade8d /sys/dev/sound/pci/csa.c
parent9c25e36cc6415532f6804a2e1f07ba5ba05b52b5 (diff)
downloadFreeBSD-src-e544a2f3f980f000db3e6dbbc43307d0923bf354.zip
FreeBSD-src-e544a2f3f980f000db3e6dbbc43307d0923bf354.tar.gz
Implement suspend/resume operation for snd_csa(4)
PR: kern/82243 Submitted by: Serge Semenenko Approved by: re (scottl) MFC after: 1 month
Diffstat (limited to 'sys/dev/sound/pci/csa.c')
-rw-r--r--sys/dev/sound/pci/csa.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c
index 889ebf4..3142753 100644
--- a/sys/dev/sound/pci/csa.c
+++ b/sys/dev/sound/pci/csa.c
@@ -87,7 +87,6 @@ static int csa_teardown_intr(device_t bus, device_t child,
struct resource *irq, void *cookie);
static driver_intr_t csa_intr;
static int csa_initialize(sc_p scp);
-static void csa_resetdsp(csa_res *resp);
static int csa_downloadimage(csa_res *resp);
static devclass_t csa_devclass;
@@ -366,15 +365,24 @@ csa_detach(device_t dev)
static int
csa_resume(device_t dev)
{
-#if 0
- /*
- * XXX: this cannot possibly work
- * needs to be properly implemented
- */
- csa_detach(dev);
- csa_attach(dev);
-#endif
- return 0;
+ csa_res *resp;
+ sc_p scp;
+
+ scp = device_get_softc(dev);
+ resp = &scp->res;
+
+ /* Initialize the chip. */
+ if (csa_initialize(scp))
+ return (ENXIO);
+
+ /* Reset the Processor. */
+ csa_resetdsp(resp);
+
+ /* Download the Processor Image to the processor. */
+ if (csa_downloadimage(resp))
+ return (ENXIO);
+
+ return (bus_generic_resume(dev));
}
static struct resource *
@@ -794,7 +802,7 @@ csa_clearserialfifos(csa_res *resp)
csa_writeio(resp, BA0_CLKCR1, clkcr1);
}
-static void
+void
csa_resetdsp(csa_res *resp)
{
int i;
OpenPOWER on IntegriCloud