NetBSD Problem Report #12878

Received: (qmail 28696 invoked from network); 9 May 2001 10:09:42 -0000
Message-Id: <200105091010.f49AAcZ01257@horn.ics.muni.cz>
Date: Wed, 9 May 2001 12:10:38 +0200 (MEST)
From: salvet@ics.muni.cz
Reply-To: salvet@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org, rh@netbsd.org
Subject: swapped channels in AC97
X-Send-Pr-Version: 3.95

>Number:         12878
>Category:       kern
>Synopsis:       swapped channels in AC97
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kent
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 09 10:10:01 +0000 2001
>Closed-Date:    Fri Nov 08 05:26:07 +0000 2002
>Last-Modified:  Wed Dec 11 18:11:00 +0000 2002
>Originator:     Zdenek Salvet
>Release:        1.5.1_BETA
>Organization:
Masaryk University, Brno, Czech Republic
>Environment:
System: NetBSD horn.ics.muni.cz 1.5.1_BETA NetBSD 1.5.1_BETA (HORN_151A_SB128) #2: Wed May 9 09:22:30 MEST 2001 salvet@horn.ics.muni.cz:/amd/eru/scratch2/salvet/root15/usr/src/sys/arch/i386/compile/HORN_151A_SB128 i386


>Description:
When using stereo output with
eap0 at pci0 dev 16 function 0: Ensoniq CT5880 CT5880C (rev. 0x02)
eap0: interrupting at irq 9
eap0: SigmaTel STAC9721/23 codec; 18 bit DAC, 18 bit ADC, Rockwell 3D

left and right audio channels are swapped. According to AC97 specification,
left channel is controlled by MSB half of volume registers, our code
does the opposite.

After fix, use of AC97_HOST_SWAPPED_CHANNELS in pci/esm.c should
be revised/retested.

BTW, AC97_REG_RECORD_GAIN is inverted.

>How-To-Repeat:
>Fix:
--- sys/dev/ic/ac97.c.orig      Wed May  9 11:20:31 2001
+++ sys/dev/ic/ac97.c   Wed May  9 11:47:04 2001
@@ -216,7 +216,7 @@
        /* Record Gain */
        { AudioCrecord,      AudioNvolume,        NULL,    AUDIO_MIXER_VALUE,
          WRAP(ac97_volume_stereo),
-         AC97_REG_RECORD_GAIN, 0x8000, 4, 0, 1, 
+         AC97_REG_RECORD_GAIN, 0x8000, 4, 0, 1, 1,
        },
        /* Record Gain mic */
        { AudioCrecord,  AudioNmicrophone,        NULL,    AUDIO_MIXER_VALUE,
@@ -750,7 +750,7 @@

                newval = ((l & mask) << si->ofs);
                if (value->num_channels == 2) {
-                       newval |= ((r & mask) << (si->ofs + 8));
+                       newval = (newval << 8 ) | ((r & mask) << si->ofs );
                        mask |= (mask << 8);
                }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->kent 
Responsible-Changed-By: kent 
Responsible-Changed-When: Wed Nov 6 05:33:59 PST 2002 
Responsible-Changed-Why:  
I'm working on this. 
State-Changed-From-To: open->closed 
State-Changed-By: kent 
State-Changed-When: Thu Nov 7 21:21:41 PST 2002 
State-Changed-Why:  
The patch was applied.  Thank you. 
As for pci/esm.c, we can't retest all of the devices.  If 
someone has a problem about esm, another PR should be submitted. 

From: Havard Eidnes <he@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/12878 CVS commit: [netbsd-1-6] syssrc/sys/dev/ic
Date: Wed, 11 Dec 2002 20:10:08 +0200 (EET)

 Module Name:	syssrc
 Committed By:	he
 Date:		Wed Dec 11 18:10:07 UTC 2002

 Modified Files:
 	syssrc/sys/dev/ic [netbsd-1-6]: ac97.c

 Log Message:
 Pull up revision 1.37 (via patch, requested by kent in ticket #980):
   Fix LR reversal problem of mixer and record gain
   polarity problem.  Based on PR#12878 and PR#18901.


 To generate a diff of this commit:
 cvs rdiff -r1.24 -r1.24.10.1 syssrc/sys/dev/ic/ac97.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.