Subject: kern/3360: /dev/mixer makes godawful noise with ad1848
To: None <gnats-bugs@gnats.netbsd.org>
From: jason <jason@porta23.async.csuohio.edu>
List: netbsd-bugs
Date: 03/19/1997 12:19:01
>Number:         3360
>Category:       kern
>Synopsis:       /dev/mixer makes godawful noise with ad1848
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 09:35:00 1997
>Last-Modified:
>Originator:     jason baker
>Organization:
	
>Release:        1.2
>Environment:
	
System: NetBSD porta23.async.csuohio.edu 1.2 NetBSD 1.2 (HASSAN) #5: Sun Feb 23 16:36:07 EST 1997 jason@home.async.csuohio.edu:/usr/src/sys/arch/i386/compile/HASSAN i386


>Description:
	Each time the mixer is adjusted, the ad1848 resets its clock
and data register, cause 128 samples of silence and a loud click.
>How-To-Repeat:
	change mixer settings
>Fix:
*** ad1848var.h	1997/02/10 13:11:52	2.2
--- ad1848var.h	1997/02/23 21:29:08	2.3
***************
*** 79,84 ****
--- 79,87 ----
  
  	/* ad1848 */
  	u_char	MCE_bit;
+ 	u_char  need_commit;		/* do we need to set mce bit */
+ 					/* and adjust */
+ 					/* clock_data_format? */
  	char	mic_gain_on;		/* CS4231 only */
  	char	mono_mute, aux1_mute, aux2_mute, line_mute, dac_mute;
  #define mon_mute dac_mute /* see ad1848_mute_dac and cs4231_mute_mon */
*** ad1848.c	1997/02/17 16:02:56	2.3
--- ad1848.c	1997/03/19 17:12:15	2.5
***************
*** 1123,1128 ****
--- 1123,1129 ----
  	return(EINVAL);
  
      sc->channels = chans;
+     sc->need_commit = 1;
  
      return(0);
  }
***************
*** 1297,1303 ****
      int timeout;
      u_char fs;
      int s = splaudio();
!     
      ad1848_mute_monitor(sc, 1);
      
      ad_set_MCE(sc, 1);		/* Enables changes to the format select reg */
--- 1298,1310 ----
      int timeout;
      u_char fs;
      int s = splaudio();
! 
!     if (!sc->need_commit)
!       {
! 	splx (s);
! 	return 0;
!       }
! 
      ad1848_mute_monitor(sc, 1);
      
      ad_set_MCE(sc, 1);		/* Enables changes to the format select reg */
***************
*** 1353,1358 ****
--- 1360,1366 ----
      ad1848_mute_monitor(sc, 0);
  
      sc->sc_lastcc = -1;
+     sc->need_commit = 0;
  
      splx(s);
      
***************
*** 1426,1431 ****
--- 1434,1440 ----
  
      int i, n, selected = -1;
  
+     sc->need_commit = 1;
      n = sizeof(speed_table) / sizeof(speed_struct);
  
      if (arg < speed_table[0].speed)
***************
*** 1472,1477 ****
--- 1481,1488 ----
      };
  
      DPRINTF(("ad1848_set_format: fmt=%d prec=%d\n", fmt, prec));
+ 
+     sc->need_commit = 1;
      
      /* If not linear; force prec to 8bits */
      if (fmt != AUDIO_ENCODING_PCM16 && prec == 16)

>Audit-Trail:
>Unformatted: