Subject: Re: kern/34071: azalia device driver doesn't support pin sensing
To: None <gnats-bugs@NetBSD.org>
From: Simon Burge <simonb@NetBSD.org>
List: netbsd-bugs
Date: 02/18/2007 23:48:21
"TAMURA Kent" wrote:

> From: "TAMURA Kent" <kent@NetBSD.org>
> To: "Berndt Josef Wulf" <wulf@ping.net.au>
> Cc: gnats-bugs@netbsd.org
> Subject: Re: kern/34071: azalia device driver doesn't support pin sensing
> Date: Mon, 5 Feb 2007 23:35:51 +0900
> 
>  Could you test the following patch and tell me the name of
>  the machine or mainboard?

I've got a Dell 640m that has the same audio chipset as Berndt's
Dell 9400.  I have the same problem - speaker output both with
and without the headphones plugged in.

With your patch applied, I see the following demsg output:

azalia0 at pci0 dev 27 function 0: Generic High Definition Audio Controller
azalia0: interrupting at ioapic0 pin 21 (irq 10)
azalia0: host: Intel 82801GB/GR High Definition Audio Controller (rev. 1)
azalia0: host: High Definition Audio rev. 1.0
azalia0: host: 4 output, 4 input, and 0 bidi streams
azalia_attach: resetting
azalia_attach: reset counter = 4999
azalia_attach: reset counter = 4985
azalia0: found a codec at #0
azalia0: found a codec at #1
...
azalia_init_corb: CORB allocation succeeded.
azalia_init_corb: CORBWP=0; size=256
azalia_init_rirb: RIRB allocation succeeded.
azalia_init_rirb: RIRBRP=0, size=256
azalia0: information of codec[0] follows:
azalia_codec_init_vtbl: vid=83847690 subid=01d81028
azalia0: codec[0]: Sigmatel STAC9220 (rev. 34.1)
azalia0: codec[0]: High Definition Audio rev. 1.0
azalia_codec_init: nidstart=1 #functions=1
azalia_codec_init: FTYPE result = 0x00000101
azalia_codec_init: There are 19 widgets in the audio function.
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        inamp: mute=0 size=0 steps=0 offset=0
        outamp: mute=1 size=5 steps=31 offset=31
azalia0: dac02 wcap=d0401<POWER,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
azalia0: adc03 wcap=1d0541<POWER,CONNLIST,PROC,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        connections=0xa; selected=0xa
azalia0: adc04 wcap=140311<DIGITAL,CONNLIST,FORMATOV,STEREO>
        encodings=5<AC3,PCM>
        PCM formats=e0160<24bit,20bit,16bit,96kHz,48kHz,44.1kHz>
        connections=0x8; selected=0x8
azalia0: dac05 wcap=40211<DIGITAL,FORMATOV,STEREO>
        encodings=5<AC3,PCM>
        PCM formats=e01e0<24bit,20bit,16bit,96kHz,88.2kHz,48kHz,44.1kHz>
azalia0: widget06 wcap=f30201<DIGITAL,STEREO>
azalia0: sel07 wcap=300901<LRSWAP,CONNLIST,STEREO>
        connections=0x2,0x8,0xa; selected=0x2
azalia0: unknown08 wcap=430681<POWER,DIGITAL,UNSOL,STEREO>
        pin config; device=other color=unknown assoc=15 seq=0 cap=10024<EAPD,INPUT,PRESENCE>
azalia0: unknown09 wcap=400301<DIGITAL,CONNLIST,STEREO>
        pin config; device=other color=unknown assoc=15 seq=1 cap=10<OUTPUT>
        connections=0x5,0xa; selected=0x5
azalia0: sel0a wcap=30090d<LRSWAP,CONNLIST,AMPOV,OUTAMP,STEREO>
        connections=0xc; selected=0xc
        outamp: mute=1 size=5 steps=15 offset=0
azalia0: sel0b wcap=300105<CONNLIST,OUTAMP,STEREO>
        connections=0x7; selected=0x7
        outamp: mute=1 size=5 steps=31 offset=31
azalia0: sel0c wcap=30010d<CONNLIST,AMPOV,OUTAMP,STEREO>
        connections=0x10,0xf,0xe,0xd,0x12; selected=0x10
        outamp: mute=0 size=39 steps=4 offset=0
azalia0: black0d wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=headphones color=black assoc=1 seq=15 cap=3f<INPUT,OUTPUT,HEADPHONE,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0xb; selected=0xb
azalia0: unknown0e wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=speaker color=unknown assoc=1 seq=0 cap=3f<INPUT,OUTPUT,HEADPHONE,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0xb; selected=0xb
azalia0: unknown0f wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=other color=unknown assoc=15 seq=2 cap=37<INPUT,OUTPUT,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0xb; selected=0xb
azalia0: black10 wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=mic color=black assoc=2 seq=0 cap=1737<INPUT,OUTPUT,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0xb; selected=0xb
azalia0: unknown11 wcap=400104<CONNLIST,OUTAMP>
        pin config; device=other color=unknown assoc=15 seq=3 cap=10<OUTPUT>
        connections=0x13; selected=0x13
        outamp: mute=1 size=5 steps=31 offset=31
azalia0: unknown12 wcap=400001<STEREO>
        pin config; device=other color=unknown assoc=15 seq=4 cap=20<INPUT>
azalia0: mix13 wcap=200100<CONNLIST>
        connections=0x7; selected=0x7
azalia0: beep14 wcap=70000c<AMPOV,OUTAMP>
        outamp: mute=1 size=23 steps=3 offset=3
generic_codec_find_dac: DAC: nid=0x2 index=2
generic_codec_find_dac: DAC path: nid=0x7 index=7
generic_codec_find_dac: DAC path: nid=0xb index=11
generic_codec_find_dac: DAC path: nid=0xe index=14
generic_codec_add_dacgroup: assoc=1 seq=0 ==> g=0 n=0
generic_codec_find_dac: DAC: nid=0x2 index=2
generic_codec_find_dac: DAC path: nid=0x7 index=7
generic_codec_find_dac: DAC path: nid=0xb index=11
generic_codec_find_dac: DAC path: nid=0x10 index=16
generic_codec_add_dacgroup: assoc=2 seq=0 ==> g=1 n=0
generic_codec_init_dacgroup: find non-connected DACs
azalia_codec_init: dacgroup[0]: 02
azalia_codec_init: dacgroup[1]: 05
azalia0: playback: max channels=2, encodings=1<PCM>
azalia0: playback: PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
azalia0: recording: max channels=2, encodings=1<PCM>
azalia0: recording: PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
generic_mixer_default: unmute
generic_mixer_default: process bidirectional pins
generic_mixer_default: set volume
azalia0: information of codec[1] follows:
azalia_codec_init_vtbl: vid=14f12bfa subid=01d81028
azalia0: codec[1]: 0x14f1/0x2bfa (rev. 0.0)
azalia0: codec[1]: High Definition Audio rev. 0.9
azalia_codec_init: nidstart=2 #functions=1
azalia_codec_init: FTYPE result = 0x00000102
azalia0: codec[1]: No support for modem function groups
azalia0: codec[1] has no audio function groups
azalia0: using the #0 codec
audio0 at azalia0: full duplex, independent
azalia_round_blocksize: resultant block size = 9600
azalia_round_blocksize: resultant block size = 9600

I've changed STAC9220_XXX_ID in your patch to 0x01d81028 to match
my dmesg info for azalia_codec_init_vtbl, and when I plug in/unplug
headphones I see the events (with STAC9220_NID_HP = 0x0d).  With
headphones plugged in, speakers turn off, but headphones remain silent.

Here I'm plugging in and unplugging headphones while a short sound is
playing:

azalia_open: flags=0x2
azalia_round_blocksize: resultant block size = 9600
azalia_round_blocksize: resultant block size = 9600
azalia_round_blocksize: resultant block size = 9600
azalia_round_blocksize: resultant block size = 8704
azalia_trigger_output: this=0xc20f5000 start=0xcbf78000 end=0xcbf86e00 blk=8704 {enc=6 2ch 16/16bit 44100Hz}
azalia_codec_connect_stream: fmt=0x4011 number=1
azalia_codec_connect_stream: leave with 0
azalia_rirb_kick_unsol_events: codec#=0 tag=0
stac9220_unsol_event: headphone has been pulled out.
azalia_rirb_kick_unsol_events: codec#=0 tag=0
stac9220_unsol_event: headphone has been inserted.
azalia_rirb_kick_unsol_events: codec#=0 tag=0
stac9220_unsol_event: headphone has been pulled out.
azalia_rirb_kick_unsol_events: codec#=0 tag=0
stac9220_unsol_event: headphone has been inserted.
azalia_halt_output
azalia_close

When I first tried this, outputs.master.mute was on.  Changing this has
no effect.  Neither does changing outputs.headphones.boost.  mixerctl -a
output is:

outputs.source=dac
outputs.spdif.source=dac
outputs.selector.mute=off
outputs.selector=255,255
outputs.master.mute=off
outputs.master=98,98
inputs.selector.source=mic1
outputs.headphones.boost=off
outputs.speaker.boost=off
outputs.mono.mute=off
outputs.mono=0
outputs.beep.mute=off
outputs.beep=85
playback.mode=analog
record.mode=analog

Any suggestions?

Cheers,
Simon.