From nobody@FreeBSD.org  Tue Dec 11 09:16:48 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95B5E16A418
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Dec 2007 09:16:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E5E813C45A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Dec 2007 09:16:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lBB9Gj2I028347
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Dec 2007 09:16:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lBB9GjOv028346;
	Tue, 11 Dec 2007 09:16:45 GMT
	(envelope-from nobody)
Message-Id: <200712110916.lBB9GjOv028346@www.freebsd.org>
Date: Tue, 11 Dec 2007 09:16:45 GMT
From: Anton Babushkin <uyamba@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: snd_ich: recording broken
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         118546
>Category:       kern
>Synopsis:       snd_ich: recording broken
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 11 09:20:03 UTC 2007
>Closed-Date:    Sat Dec 15 04:28:22 UTC 2007
>Last-Modified:  Sat Dec 15 04:28:22 UTC 2007
>Originator:     Anton Babushkin
>Release:        7.0-BETA4
>Organization:
>Environment:
FreeBSD current.gznet.ru 7.0-BETA4 FreeBSD 7.0-BETA4 #1: Mon Dec 10 21:14:47 MSK 2007     ton@current.gznet.ru:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Sound recording doesn't work on snd_ich. Applications don't show any errors when recording but really don't get any data. On 6.1 it works.

% cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2007061600/i386)
Installed devices:
pcm0: <Intel ICH3 (82801CA)> at io 0xd800, 0xdc80 irq 9 bufsz 16384 kld snd_ich [MPSAFE] (1p:1v/2r:1v channels duplex default)


>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-multimedia 
Responsible-Changed-By: ariff 
Responsible-Changed-When: Tue Dec 11 10:29:36 UTC 2007 
Responsible-Changed-Why:  
Fix category, assign to multimedia@. 

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

From: Ariff Abdullah <ariff@FreeBSD.org>
To: bug-followup@FreeBSD.org, uyamba@gmail.com
Cc:  
Subject: Re: kern/118546: snd_ich: recording broken
Date: Tue, 11 Dec 2007 18:44:42 +0800

 This is a multi-part message in MIME format.
 
 --Multipart=_Tue__11_Dec_2007_18_44_42_+0800_5xfqKp2NlJR+0LXn
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 > pcm0: <Intel ICH3 (82801CA)> at io 0xd800, 0xdc80 irq 9 bufsz 16384
 > kld snd_ich [MPSAFE] (1p:1v/2r:1v channels duplex default)
                               ^^
 I have doubt for this 2nd record channel for a long time..
 
 
 1) Try disabling vchan for record channel (vrec) through
    sysctl dev.pcm.0.rec.vchans=0. This basically restore 6.x
    behaviour.
 
 2) If #1 works, try the attached patch even with vrec enabled.
 
 
 --
 Ariff Abdullah
 FreeBSD
 
 ... Recording in stereo is obviously too advanced
     and confusing for us idiot ***** users :P ........
 
 --Multipart=_Tue__11_Dec_2007_18_44_42_+0800_5xfqKp2NlJR+0LXn
 Content-Type: text/x-diff;
  name="ich.c.diff"
 Content-Disposition: attachment;
  filename="ich.c.diff"
 Content-Transfer-Encoding: 7bit
 
 Index: src/sys/dev/sound/pci/ich.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/dev/sound/pci/ich.c,v
 retrieving revision 1.78
 diff -u -r1.78 ich.c
 --- src/sys/dev/sound/pci/ich.c	11 Jul 2007 14:27:45 -0000	1.78
 +++ src/sys/dev/sound/pci/ich.c	11 Dec 2007 09:52:27 -0000
 @@ -91,6 +91,7 @@
  #define ICH_FIXED_RATE		(1 << 3)
  #define ICH_DMA_NOCACHE		(1 << 4)
  #define ICH_HIGH_LATENCY	(1 << 5)
 +#define ICH_MCH_ENABLED		(1 << 6)
  
  static const struct ich_type {
          uint16_t	vendor;
 @@ -980,6 +981,10 @@
  	    device_get_unit(dev), "fixedrate", &i) == 0 && i != 0)
  		sc->flags |= ICH_FIXED_RATE;
  
 +	if (resource_int_value(device_get_name(dev),
 +	    device_get_unit(dev), "mch_enabled", &i) == 0 && i != 0)
 +		sc->flags |= ICH_MCH_ENABLED;
 +
  	sc->irqid = 0;
  	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid,
  	    RF_ACTIVE | RF_SHAREABLE);
 @@ -1026,7 +1031,11 @@
  	extcaps = ac97_getextcaps(sc->codec);
  	sc->hasvra = extcaps & AC97_EXTCAP_VRA;
  	sc->hasvrm = extcaps & AC97_EXTCAP_VRM;
 -	sc->hasmic = ac97_getcaps(sc->codec) & AC97_CAP_MICCHANNEL;
 +	if ((sc->flags & ICH_MCH_ENABLED) &&
 +	    (ac97_getcaps(sc->codec) & AC97_CAP_MICCHANNEL))
 +		sc->hasmic = 1;
 +	else
 +		sc->flags &= ~ICH_MCH_ENABLED;
  	ac97_setextmode(sc->codec, sc->hasvra | sc->hasvrm);
  
  	sc->dtbl_size = sizeof(struct ich_desc) * ICH_DTBL_LENGTH *
 
 --Multipart=_Tue__11_Dec_2007_18_44_42_+0800_5xfqKp2NlJR+0LXn--

From: Anton <uyamba@gmail.com>
To: Ariff Abdullah <ariff@FreeBSD.org>, bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118546: snd_ich: recording broken
Date: Wed, 12 Dec 2007 20:49:41 +0300

 On Tue, 11 Dec 2007 22:25:06 +0800
 Ariff Abdullah <ariff@FreeBSD.org> wrote:
 
 > On Tue, 11 Dec 2007 13:51:51 +0300
 > Anton <uyamba@gmail.com> wrote:
 > > On Tue, 11 Dec 2007 18:44:42 +0800
 > > Ariff Abdullah <ariff@FreeBSD.org> wrote:
 > > 
 > > > > pcm0: <Intel ICH3 (82801CA)> at io 0xd800, 0xdc80 irq 9 bufsz
 > > > > 16384 kld snd_ich [MPSAFE] (1p:1v/2r:1v channels duplex default)
 > > >                               ^^
 > > > I have doubt for this 2nd record channel for a long time..
 > > > 
 > > > 
 > > > 1) Try disabling vchan for record channel (vrec) through
 > > >    sysctl dev.pcm.0.rec.vchans=0. This basically restore 6.x
 > > >    behaviour.
 > > > 
 > > > 2) If #1 works, try the attached patch even with vrec enabled.
 > > 
 > > Thank you very much! #1 works! :)
 > > Now I will try patch...
 > > 
 > 
 > Here is a much simpler patch (attached). Please try that.
 > 
 > 
 > Next time when you're replying, make sure to include
 > bug-followup@FreeBSD.org as recipient so that the PR are properly
 > updated and all debugging activities get recorded :)
 
 Patch works! Thanks! :)
 
 -- 
 Best regards, Anton

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118546: commit references a PR
Date: Wed, 12 Dec 2007 18:21:13 +0000 (UTC)

 ariff       2007-12-12 18:21:05 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/dev/sound/pci    ich.c 
   Log:
   Disable AC97 microphone channel. Due to the channel allocation priority
   that favours true hardware channel, the first instance of recording
   request will grab this channel (the first channel is being used as
   vchan master). In many cases, it is not really work as intended and give
   false impression of broken recording.
   
   PR:             kern/118546
   MFC after:      3 days
   
   Revision  Changes    Path
   1.79      +6 -1      src/sys/dev/sound/pci/ich.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: ariff 
State-Changed-When: Wed Dec 12 18:37:09 UTC 2007 
State-Changed-Why:  
Committed, MFC in few days. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118546: commit references a PR
Date: Sat, 15 Dec 2007 04:07:03 +0000 (UTC)

 ariff       2007-12-15 04:06:53 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     sys/dev/sound/pci    ich.c 
   Log:
   MFC:
   
   Disable AC97 microphone channel. Due to the channel allocation priority
   that favours true hardware channel, the first instance of recording
   request will grab this channel (the first channel is being used as
   vchan master). In many cases, it is not really work as intended and give
   false impression of broken recording.
   
   PR:             kern/118546
   Approved by:    re (kensmith)
   
   Revision  Changes    Path
   1.78.2.1  +6 -1      src/sys/dev/sound/pci/ich.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: ariff 
State-Changed-When: Sat Dec 15 04:27:55 UTC 2007 
State-Changed-Why:  
Fix committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118546 
>Unformatted:
