From takawata@FreeBSD.org  Tue Aug 20 00:25:05 2002
Return-Path: <takawata@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7202037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 2002 00:25:05 -0700 (PDT)
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DF67243E6E
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 2002 00:25:04 -0700 (PDT)
	(envelope-from takawata@FreeBSD.org)
Received: from freefall.freebsd.org (takawata@localhost [127.0.0.1])
	by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7K7P4JU021254
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 20 Aug 2002 00:25:04 -0700 (PDT)
	(envelope-from takawata@freefall.freebsd.org)
Received: (from takawata@localhost)
	by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7K7P4HU021253;
	Tue, 20 Aug 2002 00:25:04 -0700 (PDT)
Message-Id: <200208200725.g7K7P4HU021253@freefall.freebsd.org>
Date: Tue, 20 Aug 2002 00:25:04 -0700 (PDT)
From: Takanori Watanabe <takawata@FreeBSD.org>
Reply-To: Takanori Watanabe <takawata@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ESS solo cannot be used after suspend
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41809
>Category:       kern
>Synopsis:       ESS solo cannot be used after suspend
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    sound
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 20 00:30:02 PDT 2002
>Closed-Date:    Sat Aug 24 19:03:26 PDT 2002
>Last-Modified:  Sat Aug 24 19:03:26 PDT 2002
>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:
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Sat Aug 24 14:03:31 PDT 2002 
Responsible-Changed-Why:  
To maintainers. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41809 
State-Changed-From-To: open->closed 
State-Changed-By: orion 
State-Changed-When: Sat Aug 24 19:02:35 PDT 2002 
State-Changed-Why:  
Applied to -CURRENT today.  Will MFC in 3 or 4 days.  Thanks!  


http://www.freebsd.org/cgi/query-pr.cgi?pr=41809 
>Unformatted:
