From e544a2f3f980f000db3e6dbbc43307d0923bf354 Mon Sep 17 00:00:00 2001 From: glebius Date: Mon, 27 Jun 2005 07:43:57 +0000 Subject: Implement suspend/resume operation for snd_csa(4) PR: kern/82243 Submitted by: Serge Semenenko Approved by: re (scottl) MFC after: 1 month --- sys/dev/sound/pci/csa.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'sys/dev/sound/pci/csa.c') 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; -- cgit v1.1