Subject: misc/4902: Sound card Aztech Sound Galaxy Pro 16 II does not work
To: None <gnats-bugs@gnats.netbsd.org>
From: Clifford Wright <cliff@snipe444.org>
List: netbsd-bugs
Date: 01/27/1998 21:23:42
>Number:         4902
>Category:       misc
>Synopsis:       The ad1848 driver will fail with some Atech sound cards
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 27 21:35:00 1998
>Last-Modified:
>Originator:     Clifford Wright
>Organization:
	
>Release:        NetBSD 1.3
>Environment:
	
System: NetBSD vixen 1.3 NetBSD 1.3 (VIXEN) #2: Tue Jan 27 20:10:43 PST 1998 cliff@vixen:/usr/src/sys/arch/i386/compile/VIXEN i386


>Description:
	
	The Aztech Sound Galaxy Pro 16 II sound card will not work with
	the ad1848(isa) driver when used in the windows sound system mode.
	Their are several registers that when changed will cause the device
	to stop responding to I/O for a short period. When the driver loads
	a list of default register values into the device at initializtion
	time, this condition is not tested for. Also a default value was
	left out of the list. The included patch adds this missing value,
	and checks for device ready after every register load in the
	initialization section.
>How-To-Repeat:
	
	This problem can be seen When using any of the ad1848 drivers thru
	NetBSD version 1.3, and the Aztech card. A careful examination of
	the AD1845 technical specifictations(which covers all chips the
	ad1848 driver is used for) suggests this problem.
>Fix:
	

--- ad1848.c.orig	Sun Oct 19 07:07:01 1997
+++ ad1848.c	Tue Jan 27 20:40:18 1998
@@ -141,6 +141,7 @@
     MONO_INPUT_MUTE|ATTEN_6,		/* mute mic by default */
     0,			/* unused */
     0,			/* record format */
+    0,			/* Crystal Clock Select */
     0,			/* upper record count */
     0			/* lower record count */
 };
@@ -495,6 +496,7 @@
     struct ad1848_softc *sc;
 {
     int i;
+    int timeout;
     struct ad1848_volume vol_mid = {220, 220};
     struct ad1848_volume vol_0   = {0, 0};
     struct audio_params pparams, rparams;
@@ -521,14 +523,25 @@
     }
 
     /* Initialize the ad1848... */
-    for (i = 0; i < 16; i++)
+    for (i = 0; i < 16; i++) {
 	ad_write(sc, i, ad1848_init_values[i]);
+	/* make sure device is ready */
+	timeout = 1000;
+	while (timeout > 0 && ad_read(sc, AD1848_IADDR) & SP_IN_INIT)
+	    timeout--;
+    }
     /* ...and additional CS4231 stuff too */
     if (sc->mode == 2) {
 	    ad_write(sc, SP_INTERFACE_CONFIG, 0); /* disable SINGLE_DMA */
 	    for (i = 0x10; i <= 0x1f; i++)
-		    if (ad1848_init_values[i] != 0)
+		    if (ad1848_init_values[i] != 0) {
 			    ad_write(sc, i, ad1848_init_values[i]);
+			    /* make sure device is ready */
+			    timeout = 1000;
+			    while (timeout > 0 &&
+			      ad_read(sc, AD1848_IADDR) & SP_IN_INIT)
+	    			timeout--;
+		    }
     }
     ad1848_reset(sc);
 
>Audit-Trail:
>Unformatted: