Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2002 00:25:04 -0700 (PDT)
From:      Takanori Watanabe <takawata@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/41809: ESS solo cannot be used after suspend
Message-ID:  <200208200725.g7K7P4HU021253@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         41809
>Category:       kern
>Synopsis:       ESS solo cannot be used after suspend
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 20 00:30:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Takanori Watanabe
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
freebsd.org
>Environment:
System: FreeBSD dnk.axe-inc.co.jp 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sat Jul 27 14:58:32 JST 2002
>Description:
 ESS solo cannot be used after resume due to lack of suspend/resume code.
>How-To-Repeat:
 Go sleeping by acpiconf -s 3 or apm -z then  resume.
>Fix:
 Note that the process opening the device still get wrong after resume.
The ess_suspend routine may used to solve the problem, I think.
Index: solo.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pci/solo.c,v
retrieving revision 1.23
diff -u -r1.23 solo.c
--- solo.c	8 Oct 2001 05:56:56 -0000	1.23
+++ solo.c	20 Aug 2002 07:21:30 -0000
@@ -896,7 +896,41 @@
 #define PCI_LEGACYCONTROL       0x40
 #define PCI_CONFIG              0x50
 #define 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, PCI_LEGACYCONTROL, 0x805f, 2);
+	pci_write_config(dev, PCI_DDMACONTROL, ddma, 2);
+	pci_write_config(dev, 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)
 {
@@ -996,8 +1030,8 @@
 	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 }
 };
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208200725.g7K7P4HU021253>