From nobody@FreeBSD.org  Mon Dec  6 15:06:07 2010
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 8106C106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Dec 2010 15:06:07 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 6EE4C8FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Dec 2010 15:06:07 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oB6F67Ma014494
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 6 Dec 2010 15:06:07 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id oB6F67XD014493;
	Mon, 6 Dec 2010 15:06:07 GMT
	(envelope-from nobody)
Message-Id: <201012061506.oB6F67XD014493@red.freebsd.org>
Date: Mon, 6 Dec 2010 15:06:07 GMT
From: Ted Haining <ted.haining@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: snd_hda headphone jack detection not working with AD1986A on ASUS M2NPV-VM
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         152864
>Category:       kern
>Synopsis:       [snd_hda] snd_hda headphone jack detection not working with AD1986A on ASUS M2NPV-VM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 06 15:10:08 UTC 2010
>Closed-Date:    Tue Dec 07 16:24:56 UTC 2010
>Last-Modified:  Tue Dec 07 16:24:56 UTC 2010
>Originator:     Ted Haining
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD workstation 9.0-CURRENT FreeBSD 9.0-CURRENT #1: Sun Dec  5 02:26:10 PST 2010     root@workstation:/usr/obj/usr/src/sys/WORKSTATION  amd64
>Description:
Kernel config WORKSTATION is simply GENERIC plus the following four lines:
326,330d327
< 
< # Add in some sound card support
< device                sound
< device                snd_hda

The problem: 

I have two audio outputs on the system in question.  The first is on the back, using the "green" plug using a connector mounted on the motherboard.  The second is using a "green" headphone connector on the front of the case.  The connector on the back works fine.  The connector on the front is silent.

A little debugging shows that the snd_hda driver thinks that this front 
connector is nid=26 (see below).  

Looking at the driver man page, I see that it says the following:

The sequence number 15 has a special meaning for output
associations.  Output pins with this number and device
type ``Headphones'' will duplicate (with automatic mute if
jack detection is supported) the first pin in that association.

Acting on the idea that the "automatic mute" might be the problem, I added the following to device.hints:

hint.hdac.1.cad0.nid26.config="as=1 seq=2 type=Line-out"

This worked around the problem; the headphone jack now works.

Here is a verbose dump of the hdac:

hdac1: <NVidia MCP51 High Definition Audio Controller> mem 0xfe024000-0xfe027fff irq 21 at device 16.1 on pci0
hdac1: HDA Driver Revision: 20100226_0142
hdac1: Caps: OSS 4, ISS 4, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256
hdac1: Probing codec #0...
hdac1: HDA Codec #0: Analog Devices AD1986A
hdac1:  HDA Codec ID: 0x11d41986
hdac1:        Vendor: 0x11d4
hdac1:        Device: 0x1986
hdac1:      Revision: 0x05
hdac1:      Stepping: 0x00
hdac1: PCI Subvendor: 0x81cb1043
hdac1:  Found audio FG nid=1 startnode=2 endnode=44 total=42
hdac1: 
hdac1: Processing audio FG cad=0 nid=1...
hdac1: GPIO: 0x00000100 NumGPIO=0 NumGPO=1 NumGPI=0 GPIWake=0 GPIUnsol=0
hdac1: GHOST: nid=2 j=0 entnum=4 index=0 res=0x00000601
hdac1: hdac_widget_connection_parse: nid=18 WARNING: zero cnid entnum=4 j=2 index=0 entries=8 found=2 res=0x21002211
hdac1: GHOST: nid=18 j=2 entnum=4 index=0 res=0x21002211
hdac1:  nid 26 0x02214021 as  2 seq  1    Headphones  Jack jack  1 loc  2 color   Green misc 0
hdac1: Patching pin config nid=26 0x02214021 -> 0x0221401f
hdac1:  nid 27 0x01014011 as  1 seq  1      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac1:  nid 28 0x01013012 as  1 seq  2      Line-out  Jack jack  1 loc  1 color    Blue misc 0
hdac1: Patching pin config nid=28 0x01013012 -> 0x01813081
hdac1:  nid 29 0x01019015 as  1 seq  5      Line-out  Jack jack  1 loc  1 color    Pink misc 0
hdac1: Patching pin config nid=29 0x01019015 -> 0x01019005
hdac1:  nid 30 0x501700f0 as 15 seq  0       Speaker  None jack  7 loc 16 color Unknown misc 0
hdac1:  nid 31 0x02a190f0 as 15 seq  0           Mic  Jack jack  1 loc  2 color    Pink misc 0
hdac1: Patching pin config nid=31 0x02a190f0 -> 0x02a19083
hdac1:  nid 32 0x018130f0 as 15 seq  0       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac1: Patching pin config nid=32 0x018130f0 -> 0x01813084
hdac1:  nid 33 0x509700f0 as 15 seq  0           AUX  None jack  7 loc 16 color Unknown misc 0
hdac1:  nid 34 0x993310f0 as 15 seq  0            CD Fixed jack  3 loc 25 color   Black misc 0
hdac1: Patching pin config nid=34 0x993310f0 -> 0x99331085
hdac1:  nid 35 0x50b700f0 as 15 seq  0     Telephony  None jack  7 loc 16 color Unknown misc 0
hdac1:  nid 36 0x90f700f0 as 15 seq  0         Other Fixed jack  7 loc 16 color Unknown misc 0
hdac1: Patching pin config nid=36 0x90f700f0 -> 0x90f70086
hdac1:  nid 37 0x014510f0 as 15 seq  0     SPDIF-out  Jack jack  5 loc  1 color   Black misc 0
hdac1: Patched pins configuration:
hdac1:  nid 26 0x0221401f as  1 seq 15    Headphones  Jack jack  1 loc  2 color   Green misc 0
hdac1:  nid 27 0x01014011 as  1 seq  1      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac1:  nid 28 0x01813081 as  8 seq  1       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac1:  nid 29 0x01019005 as  0 seq  5      Line-out  Jack jack  1 loc  1 color    Pink misc 0 [DISABLED]
hdac1:  nid 30 0x501700f0 as 15 seq  0       Speaker  None jack  7 loc 16 color Unknown misc 0 [DISABLED]
hdac1:  nid 31 0x02a19083 as  8 seq  3           Mic  Jack jack  1 loc  2 color    Pink misc 0
hdac1:  nid 32 0x01813084 as  8 seq  4       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac1:  nid 33 0x509700f0 as 15 seq  0           AUX  None jack  7 loc 16 color Unknown misc 0 [DISABLED]
hdac1:  nid 34 0x99331085 as  8 seq  5            CD Fixed jack  3 loc 25 color   Black misc 0
hdac1:  nid 35 0x50b700f0 as 15 seq  0     Telephony  None jack  7 loc 16 color Unknown misc 0 [DISABLED]
hdac1:  nid 36 0x90f70086 as  8 seq  6         Other Fixed jack  7 loc 16 color Unknown misc 0
hdac1:  nid 37 0x014510f0 as 15 seq  0     SPDIF-out  Jack jack  5 loc  1 color   Black misc 0
hdac1: 3 associations found:
hdac1: Association 0 (1) out:
hdac1:  Pin nid=27 seq=1
hdac1:  Pin nid=26 seq=15
hdac1: Association 1 (8) in:
hdac1:  Pin nid=28 seq=1
hdac1:  Pin nid=31 seq=3
hdac1:  Pin nid=32 seq=4
hdac1:  Pin nid=34 seq=5
hdac1:  Pin nid=36 seq=6
hdac1: Association 2 (15) out:
hdac1:  Pin nid=37 seq=0
hdac1: Tracing association 0 (1)
hdac1:  Pin 27 traced to DAC 3
hdac1:  Pin 26 traced to DAC 3 and hpredir 1
hdac1: Association 0 (1) trace succeeded
hdac1: Tracing association 1 (8)
hdac1:  Pin 28 traced to ADC 6
hdac1:  Pin 31 traced to ADC 6
hdac1:  Pin 32 traced to ADC 6
hdac1:  Pin 34 traced to ADC 6
hdac1:  Unable to trace pin 36 to ADC 6, undo traces
hdac1: Association 1 (8) trace failed
hdac1: Tracing association 2 (15)
hdac1:  Pin 37 traced to DAC 2
hdac1: Association 2 (15) trace succeeded
hdac1: Tracing input monitor
hdac1: Tracing other input monitors
hdac1: Tracing beeper
hdac1:  nid 25 traced to out
hdac1: Enabling headphone/speaker audio routing switching:
hdac1:  as=0 sense nid=26 [UNSOL]
hdac1: Pin sense: nid=26 res=0x0000f96d
hdac1: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref
>How-To-Repeat:
Run the 9.0 CURRENT amd64 version of the snd_hda driver with an AD1986A audio controller (hopefully not just on the ASUS M2NPV-VM motherboard). 
Attempt to produce audio through the line reported as Headphones by the controller BIOS. 
>Fix:
A workaround: change the Association sequence number to something other than
15 to disable automatic mute in device.hints.  For example:

hint.hdac.X.cad0.nid26.config="as=1 seq=2 type=Line-out"

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-multimedia 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Dec 6 17:51:57 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Andriy Gapon <avg@freebsd.org>
To: bug-followup@freebsd.org, ted.haining@yahoo.com
Cc:  
Subject: Re: kern/152864: [snd_hda] snd_hda headphone jack detection not working
 with AD1986A on ASUS M2NPV-VM
Date: Mon, 06 Dec 2010 20:35:04 +0200

 Dear bug reporter,
 
 please report this issue to your system's vendor who provided incorrect pin
 information in BIOS data.  Or just keep happily using the good workaround with
 which you have come up.
 
 I don't see anything FreeBSD does incorrectly in your case as we do not hardcode
 workarounds for every possible motherboard, BIOS version, etc that provide us with
 incorrect data.
 
 P.S. It's usually better to discuss issues on the appropriate mailing lists before
 filing a PR.
 
 -- 
 Andriy Gapon
State-Changed-From-To: open->closed 
State-Changed-By: avg 
State-Changed-When: Mon Dec 6 18:41:40 UTC 2010 
State-Changed-Why:  
I don't see FreeBSD doing anything wrong here, and also: 
<<< 554 delivery error: dd This user doesn't have a yahoo.com account (ted.haining@yahoo.com) [0] - mta115.mail.ac4.yahoo.com 

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