Bug 25944

Summary: SB16 PCI card doesn't initialize properly
Product: Base System Reporter: Richard J. Kuhns <rjk>
Component: i386Assignee: cg
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Richard J. Kuhns 2001-03-20 15:40:06 UTC
	A brand-new PCI SoundBlaster 16 card identified as follows:

from dmesg:
pcm0: <AudioPCI ES1371> port 0xe000-0xe03f irq 5 at device 9.0 on pci0

$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm) Mar 18 2001 22:45:20
Installed devices:
pcm0: <AudioPCI ES1371> at io 0xe000 irq 5 (1p/1r channels duplex)

plays .au files (via cat s.au > /dev/audio) at what sounds to me like
twice the correct speed, while mp3s played via xmms play at what sounds
like 0.5 times the correct speed.  However, if I first boot Windoze, the
card seems to work perfectly until the next time I power cycle the
machine.

Fix: 

Turn on the machine, boot Windoze, do a "Restart" and boot
FreeBSD.  From then on the sound is fine through any number of reboots until
the next power cycle.
How-To-Repeat: 	Turn on the machine and type "cat s.au > /dev/audio".
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2001-03-24 05:25:35 UTC
Responsible Changed
From-To: freebsd-bugs->cg

Cameron is the soundman
Comment 2 gandalf 2001-03-24 17:06:38 UTC
try this patch:

Index: es137x.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pci/es137x.c,v
retrieving revision 1.13.2.5
diff -u -b -r1.13.2.5 es137x.c
--- es137x.c    2001/02/21 11:23:24     1.13.2.5
+++ es137x.c    2001/02/27 08:18:52
@@ -487,8 +487,9 @@
        es->sctrl = 0;
        /* initialize the chips */
        if (revid == 7 || revid >= 9 || (devid == ES1371_PCI_ID3 && revid ==
2)) {
-#define ES1371_BINTSUMM_OFF 0x07
-               bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF,
0x20);
+#define ES1371_BINTSUMM_OFF 0x04
+               bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF,
0x20000000);
+               DELAY(20000);
                if (debug > 0) printf("es_init rev == 7 || rev >= 9\n");
        } else { /* pre ac97 2.1 card */
                bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL,
es->ctrl);

    -cg
Comment 3 Richard J. Kuhns 2001-03-24 19:46:52 UTC
I tried, and this is what I got:

moran:/usr/src/sys/dev/sound/pci$ patch < /var/tmp/es.patch 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|try this patch:
|
|Index: es137x.c
|===================================================================
|RCS file: /home/ncvs/src/sys/dev/sound/pci/es137x.c,v
|retrieving revision 1.13.2.5
|diff -u -b -r1.13.2.5 es137x.c
|--- es137x.c    2001/02/21 11:23:24     1.13.2.5
|+++ es137x.c    2001/02/27 08:18:52
--------------------------
Patching file es137x.c using Plan A...
patch: **** malformed patch at line 14: 2)) {
moran:/usr/src/sys/dev/sound/pci$ 

-- 
Richard Kuhns			rjk@grauel.com
PO Box 6249			Tel: (765)477-6000 \
100 Sawmill Road				    x319
Lafayette, IN  47903		     (800)489-4891 /
Comment 4 Richard J. Kuhns 2001-03-24 20:06:44 UTC
Cameron Grant writes:
 > try this patch:
 > 
 > Index: es137x.c
 > ===================================================================
 > RCS file: /home/ncvs/src/sys/dev/sound/pci/es137x.c,v
 > retrieving revision 1.13.2.5
 > diff -u -b -r1.13.2.5 es137x.c
 > --- es137x.c    2001/02/21 11:23:24     1.13.2.5
 > +++ es137x.c    2001/02/27 08:18:52
 > @@ -487,8 +487,9 @@
 >         es->sctrl = 0;
 >         /* initialize the chips */
 >         if (revid == 7 || revid >= 9 || (devid == ES1371_PCI_ID3 && revid ==
 > 2)) {
 > -#define ES1371_BINTSUMM_OFF 0x07
 > -               bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF,
 > 0x20);
 > +#define ES1371_BINTSUMM_OFF 0x04
 > +               bus_space_write_4(es->st, es->sh, ES1371_BINTSUMM_OFF,
 > 0x20000000);
 > +               DELAY(20000);
 >                 if (debug > 0) printf("es_init rev == 7 || rev >= 9\n");
 >         } else { /* pre ac97 2.1 card */
 >                 bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL,
 > es->ctrl);
It worked!  I applied the patch manually since patch told me it was
malformed, but after powering off and rebooting my SB16 sounds just fine.

Thanks...
-- 
Richard Kuhns			rjk@grauel.com
PO Box 6249			Tel: (765)477-6000 \
100 Sawmill Road				    x319
Lafayette, IN  47903		     (800)489-4891 /
Comment 5 greid freebsd_committer freebsd_triage 2001-04-08 23:20:52 UTC
State Changed
From-To: open->closed

Submitter reports problem has been fixed