From nobody@FreeBSD.org  Tue May 30 19:15:57 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9E5DE16AC5C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 May 2006 19:15:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3D64743D53
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 May 2006 19:15:57 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k4UJFv3P069124
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 May 2006 19:15:57 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k4UJFvn9069123;
	Tue, 30 May 2006 19:15:57 GMT
	(envelope-from nobody)
Message-Id: <200605301915.k4UJFvn9069123@www.freebsd.org>
Date: Tue, 30 May 2006 19:15:57 GMT
From: Joseph Terner <jtsn@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [sound] ES1370 mixer volumes incorrectly calculated (patch included)
X-Send-Pr-Version: www-2.3

>Number:         98167
>Category:       kern
>Synopsis:       [sound] [es137x] [patch] ES1370 mixer volumes incorrectly calculated
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 30 19:20:29 GMT 2006
>Closed-Date:    Thu Apr 01 11:32:23 UTC 2010
>Last-Modified:  Thu Apr  1 11:40:05 UTC 2010
>Originator:     Joseph Terner
>Release:        FreeBSD 5.4-RELEASE
>Organization:
>Environment:
n/a
>Description:
The mixer on the ES1370 sound chip provides 5 significant bits for all channels except output gain. The current code in sys/dev/sound/pci/es137x.c uses only 4 of them. Therefore the lower half of the volume range is unavailable (0 represents maximum volume).
>How-To-Repeat:
Try to set low volumes using mixer(1) on an ES1370 sound card. With an unpatched driver there is an audible gap between mute and the lowest possible volume.
>Fix:
Patch for es137x.c,v 1.59 from 7-CURRENT:

--- sys/dev/sound/pci/es137x.c.orig     Tue May 30 20:50:27 2006
+++ sys/dev/sound/pci/es137x.c  Tue May 30 20:49:43 2006
@@ -311,7 +311,7 @@
        if (mixtable[dev].left == 0xf) {
                rl = (l < 2)? 0x80 : 7 - (l - 2) / 14;
        } else {
-               rl = (l < 10)? 0x80 : 15 - (l - 10) / 6;
+               rl = (l < 7)? 0x80 : 31 - (l - 7) / 3;
        }
        es = mix_getdevinfo(m);
        ES_LOCK(es);
@@ -322,7 +322,7 @@
                set_dac1 = 0;
        }
        if (mixtable[dev].stereo) {
-               rr = (r < 10)? 0x80 : 15 - (r - 10) / 6;
+               rr = (r < 7)? 0x80 : 31 - (r - 7) / 3;
                es1370_wrcodec(es, mixtable[dev].right, rr);
                if (set_dac1 && mixtable[SOUND_MIXER_SYNTH].stereo)
                        es1370_wrcodec(es, mixtable[SOUND_MIXER_SYNTH].right, rr
);

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-multimedia 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jun 3 19:02:11 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98167 
Responsible-Changed-From-To: freebsd-multimedia->kib 
Responsible-Changed-By: kib 
Responsible-Changed-When: Mon Oct 9 12:36:23 UTC 2006 
Responsible-Changed-Why:  
I have this card and will check the patch. Question to the originator: do you 
have a datasheet for the es1370 ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98167 
Responsible-Changed-From-To: kib->freebsd-multimedia 
Responsible-Changed-By: kib 
Responsible-Changed-When: Thu Oct 19 08:36:51 UTC 2006 
Responsible-Changed-Why:  
My card appears to be based on the CT5880, and, as such, it utilizes 
AC97 mixer on the codec. 

The patch seems to be sane and it corresponds to what I read from (combined) 
es1370 and es1371 DSes. But, I will not commit it blindly without confirmation 
from at least on more es1370 owner. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98167 
State-Changed-From-To: open->closed 
State-Changed-By: joel 
State-Changed-When: Thu Apr 1 11:31:42 UTC 2010 
State-Changed-Why:  
Patch committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98167 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/98167: commit references a PR
Date: Thu,  1 Apr 2010 11:31:01 +0000 (UTC)

 Author: joel (doc committer)
 Date: Thu Apr  1 11:30:46 2010
 New Revision: 206033
 URL: http://svn.freebsd.org/changeset/base/206033
 
 Log:
   Fix the gap between mute and lowest possible volume. The es1370 mixer
   volumes were incorrectly calculated.
   
   I've tested this with one of my es1370 cards and I can confirm that it
   works.
   
   PR:		98167
   Submitted by:	Joseph Terner <jtsn@gmx.de>
   Approved by:	kib
 
 Modified:
   head/sys/dev/sound/pci/es137x.c
 
 Modified: head/sys/dev/sound/pci/es137x.c
 ==============================================================================
 --- head/sys/dev/sound/pci/es137x.c	Thu Apr  1 10:41:01 2010	(r206032)
 +++ head/sys/dev/sound/pci/es137x.c	Thu Apr  1 11:30:46 2010	(r206033)
 @@ -355,7 +355,7 @@ es1370_mixset(struct snd_mixer *m, unsig
  	if (mixtable[dev].left == 0xf)
  		rl = (l < 2) ? 0x80 : 7 - (l - 2) / 14;
  	else
 -		rl = (l < 10) ? 0x80 : 15 - (l - 10) / 6;
 +		rl = (l < 7) ? 0x80 : 31 - (l - 7) / 3;
  	es = mix_getdevinfo(m);
  	ES_LOCK(es);
  	if (dev == SOUND_MIXER_PCM && (ES_SINGLE_PCM_MIX(es->escfg)) &&
 @@ -364,7 +364,7 @@ es1370_mixset(struct snd_mixer *m, unsig
  	else
  		set_dac1 = 0;
  	if (mixtable[dev].stereo) {
 -		rr = (r < 10) ? 0x80 : 15 - (r - 10) / 6;
 +		rr = (r < 7) ? 0x80 : 31 - (r - 7) / 3;
  		es1370_wrcodec(es, mixtable[dev].right, rr);
  		if (set_dac1 && mixtable[SOUND_MIXER_SYNTH].stereo)
  			es1370_wrcodec(es,
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
