Subject: kern/35960: azalia(4) does not support pin sensing, boost, gain adjustment, nor has mixer table on stac9221 A1 subid 0606
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <blair.sadewitz@gmail.com>
List: netbsd-bugs
Date: 03/09/2007 13:50:00
>Number:         35960
>Category:       kern
>Synopsis:       azalia(4) does not support pin sensing, boost, gain adjustment, nor has mixer table on stac9221 A1 subid 0606
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 09 13:50:00 +0000 2007
>Originator:     Blair Sadewitz
>Release:        4.99.13
>Organization:
>Environment:
NetBSD dexamyl 4.99.13 NetBSD 4.99.13 (DEXAMYL) #0: Fri Mar  9 02:01:15 EST 2007  blair@dexamyl:/usr/src/sys/arch/amd64/compile/DEXAMYL amd64

>Description:
I do not have the equipment to test recording, but I do know that the only thing I can do is play audio through inputs.dac02 (and the default volume is very soft).  I'd like to be able to adjust gain, have headphone pin sensing (not a priority).  It would also be great to have meaningful names so I know what to adjust with the mixer, and so that mixer applications will work.

The FreeBSD driver seems to have a parser which any interested party may wish to look at, as well as a "PCMSOFTVOL" quirk.

Also, is the PCI latency timer set right?
>How-To-Repeat:
$ mixerctl -d /dev/mixer1 -av 
inputs.dac02.mute=off  [ off on ]
inputs.dac02=126,126  delta=2
inputs.dac02.lrswap=off  [ off on ]
inputs.dac03.mute=off  [ off on ]
inputs.dac03=126,126  delta=2
inputs.dac03.lrswap=off  [ off on ]
inputs.dac04.mute=off  [ off on ]
inputs.dac04=126,126  delta=2
inputs.dac04.lrswap=off  [ off on ]
inputs.dac05.mute=off  [ off on ]
inputs.dac05=126,126  delta=2
inputs.dac05.lrswap=off  [ off on ]
outputs.green0a.dir=output  [ input output ]
outputs.green0a.boost=on  [ off on ]
outputs.pink0b.dir=output  [ input output ]
outputs.blue0c.dir=output  [ input output ]
outputs.green0d.dir=output  [ input output ]
outputs.green0d.boost=off  [ off on ]
outputs.unknown0f.dir=output  [ input output ]
outputs.unknown10.sourc=dac08  [ dac08 sel17 widget19 ]
outputs.unknown11.eapd=off  [ off on ]
inputs.sel12.source=unknown0e  [ unknown0e unknown15 unknown0f pink0b blue0c green0d green0a ]
outputs.sel12=63,63  delta=63
inputs.sel13.source=unknown15  [ unknown0e unknown15 unknown0f pink0b blue0c green0d green0a ]
outputs.sel13=63,63  delta=63
inputs.beep14=85  delta=85
outputs.volume16=255  delta=2
inputs.sel17.sel12.mut=off  [ off on ]
inputs.sel17.sel12=109,109  delta=18
inputs.sel17.lrswap=off  [ off on ]
inputs.sel18.sel13.mut=off  [ off on ]
inputs.sel18.sel13=109,109  delta=18
inputs.sel18.lrswap=off  [ off on ]
playback.mode=02030405  [ 02030405 08 1a ]
record.mode=0607  [ 0607 09 ]

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[2] follows:
azalia_codec_init_vtbl: vid=83847680 subid=06068086
azalia0: codec[2]: Sigmatel STAC9221 (rev. 54.1)
azalia0: codec[2]: High Definition Audio rev. 1.0
azalia_codec_init: nidstart=1 #functions=1
azalia_codec_init: FTYPE result = 0x00000101
azalia_codec_init: There are 26 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=1 size=5 steps=14 offset=0
        outamp: mute=1 size=2 steps=127 offset=127
azalia0: dac02 wcap=d0c05<LRSWAP,POWER,OUTAMP,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        outamp: mute=1 size=2 steps=127 offset=127
azalia0: dac03 wcap=d0c05<LRSWAP,POWER,OUTAMP,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        outamp: mute=1 size=2 steps=127 offset=127
azalia0: dac04 wcap=d0c05<LRSWAP,POWER,OUTAMP,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        outamp: mute=1 size=2 steps=127 offset=127
azalia0: dac05 wcap=d0c05<LRSWAP,POWER,OUTAMP,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
        outamp: mute=1 size=2 steps=127 offset=127
azalia0: adc06 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=0x17; selected=0x17
azalia0: adc07 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=0x18; selected=0x18
azalia0: dac08 wcap=40211<DIGITAL,FORMATOV,STEREO>
        encodings=5<AC3,PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
azalia0: adc09 wcap=140311<DIGITAL,CONNLIST,FORMATOV,STEREO>
        encodings=5<AC3,PCM>
        PCM formats=e0160<24bit,20bit,16bit,96kHz,48kHz,44.1kHz>
        connections=0x11; selected=0x11
azalia0: green0a wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=headphones color=green assoc=1 seq=15 cap=173f<INPUT,OUTPUT,HEADPHONE,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0x2; selected=0x2
azalia0: pink0b wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=mic color=pink assoc=2 seq=0 cap=1737<INPUT,OUTPUT,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0x4; selected=0x4
azalia0: blue0c wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=line-in color=blue assoc=2 seq=14 cap=1737<INPUT,OUTPUT,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0x3; selected=0x3
azalia0: green0d wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=speaker color=green assoc=1 seq=0 cap=173f<INPUT,OUTPUT,HEADPHONE,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0x2; selected=0x2
azalia0: unknown0e wcap=400081<UNSOL,STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=10 cap=24<INPUT,PRESENCE>
azalia0: unknown0f wcap=400181<CONNLIST,UNSOL,STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=15 cap=37<INPUT,OUTPUT,PRESENCE,TRIGGER,IMPEDANCE>
        connections=0x5; selected=0x5
azalia0: unknown10 wcap=400301<DIGITAL,CONNLIST,STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=14 cap=10<OUTPUT>
        connections=0x8,0x17,0x19; selected=0x8
azalia0: unknown11 wcap=430681<POWER,DIGITAL,UNSOL,STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=13 cap=10024<EAPD,INPUT,PRESENCE>
azalia0: sel12 wcap=30010d<CONNLIST,AMPOV,OUTAMP,STEREO>
        connections=0xe,0x15,0xf,0xb,0xc,0xd,0xa; selected=0xe
        outamp: mute=0 size=39 steps=4 offset=0
azalia0: sel13 wcap=30010d<CONNLIST,AMPOV,OUTAMP,STEREO>
        connections=0xe,0x15,0xf,0xb,0xc,0xd,0xa; selected=0x15
        outamp: mute=0 size=39 steps=4 offset=0
azalia0: beep14 wcap=70000c<AMPOV,OUTAMP>
        outamp: mute=0 size=23 steps=3 offset=3
azalia0: unknown15 wcap=400001<STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=12 cap=20<INPUT>
azalia0: volume16 wcap=600000
        delta=1 steps=127
azalia0: sel17 wcap=300903<LRSWAP,CONNLIST,INAMP,STEREO>
        connections=0x12; selected=0x12
        inamp: mute=1 size=5 steps=14 offset=0
azalia0: sel18 wcap=300903<LRSWAP,CONNLIST,INAMP,STEREO>
        connections=0x13; selected=0x13
        inamp: mute=1 size=5 steps=14 offset=0
azalia0: widget19 wcap=f30201<DIGITAL,STEREO>
azalia0: dac1a wcap=30201<DIGITAL,STEREO>
        encodings=1<PCM>
        PCM formats=e07e0<24bit,20bit,16bit,192kHz,176.4kHz,96kHz,88.2kHz,48kHz,44.1kHz>
azalia0: unknown1b wcap=400301<DIGITAL,CONNLIST,STEREO>
        pin config; device=line-out color=unknown assoc=15 seq=11 cap=10<OUTPUT>
        connections=0x1a; selected=0x1a
-------- Graphviz DOT starts
digraph "Sigmatel STAC9221 (rev. 54.1)" {
 dac02 [shape=box,style=filled,fillcolor="#88ff88"];
 dac03 [shape=box,style=filled,fillcolor="#88ff88"];
 dac04 [shape=box,style=filled,fillcolor="#88ff88"];
 dac05 [shape=box,style=filled,fillcolor="#88ff88"];
sel17 -> adc06 [sametail=sel17];
 adc07 [shape=box,style=filled,fillcolor="#ff8888"];
 sel18 -> adc07 [sametail=sel18];
 dac08 [shape=box,style=filled,fillcolor="#88ff88"];
 adc09 [shape=box,style=filled,fillcolor="#ff8888"];
 unknown11 -> adc09 [sametail=unknown11];
 green0a [label="green0a\ndevice=headphones",style=filled,shape=doublecircle,fillcolor="#ffff88"];
 dac02 -> green0a [sametail=dac02];
 pink0b [label="pink0b\ndevice=mic",style=filled,shape=doublecircle,fillcolor="#ffff88"];
 dac04 -> pink0b [sametail=dac04];
 blue0c [label="blue0c\ndevice=line-in",style=filled,shape=doublecircle,fillcolor="#ffff88"];
 dac03 -> blue0c [sametail=dac03];
 green0d [label="green0d\ndevice=speaker",style=filled,shape=doublecircle,fillcolor="#ffff88"];
 dac02 -> green0d [sametail=dac02];
 unknown0e [label="unknown0e\ndevice=line-out",style=filled,shape=circle,fillcolor="#ff8888"];
 unknown0f [label="unknown0f\ndevice=line-out",style=filled,shape=doublecircle,fillcolor="#ffff88"];
 dac05 -> unknown0f [sametail=dac05];
 unknown10 [label="unknown10\ndevice=line-out",style=filled,shape=circle,fillcolor="#88ff88"];
 dac08 -> unknown10 [sametail=dac08];
 sel17 -> unknown10 [sametail=sel17];
 widget19 -> unknown10 [sametail=widget19];
 unknown11 [label="unknown11\ndevice=line-out",style=filled,shape=circle,fillcolor="#ff8888"];
 sel12 [shape=invtrapezium];
 unknown0e -> sel12 [sametail=unknown0e];
 unknown15 -> sel12 [sametail=unknown15];
 unknown0f -> sel12 [sametail=unknown0f];
 pink0b -> sel12 [sametail=pink0b];
 blue0c -> sel12 [sametail=blue0c];
 green0d -> sel12 [sametail=green0d];
 green0a -> sel12 [sametail=green0a];
 sel13 [shape=invtrapezium];
 unknown0e -> sel13 [sametail=unknown0e];
 unknown15 -> sel13 [sametail=unknown15];
 unknown0f -> sel13 [sametail=unknown0f];
 pink0b -> sel13 [sametail=pink0b];
 blue0c -> sel13 [sametail=blue0c];
 green0d -> sel13 [sametail=green0d];
 green0a -> sel13 [sametail=green0a];
 unknown15 [label="unknown15\ndevice=line-out",style=filled,shape=circle,fillcolor="#ff8888"];
 sel17 [shape=invtrapezium];
 sel12 -> sel17 [sametail=sel12];
 sel18 [shape=invtrapezium];
 sel13 -> sel18 [sametail=sel13];
 dac1a [shape=box,style=filled,fillcolor="#88ff88"];
 unknown1b [label="unknown1b\ndevice=line-out",style=filled,shape=circle,fillcolor="#88ff88"];
 dac1a -> unknown1b [sametail=dac1a];
 {rank=min; dac02; dac03; dac04; dac05; adc06; adc07; dac08; adc09; dac1a;}
 {rank=max; green0a; pink0b; blue0c; green0d; unknown0e; unknown0f; unknown10; unknown11; unknown15; unknown1b;}
}
-------- Graphviz DOT ends

$ sudo pcictl /dev/pci0 dump -d27
PCI configuration registers:
  Common header:
    0x00: 0x27d88086 0x00100006 0x04030001 0x00000010

    Vendor Name: Intel (0x8086)
    Device Name: 82801GB/GR High Definition Audio Controller (0x27d8)
    Command register: 0x0006
      I/O space accesses: off
      Memory space accesses: on
      Bus mastering: on
      Special cycles: off
      MWI transactions: off
      Palette snooping: off
      Parity error checking: off
      Address/data stepping: off
      System error (SERR): off
      Fast back-to-back transactions: off
      Interrupt disable: off
    Status register: 0x0010
      Capability List support: on
      66 MHz capable: off
      User Definable Features (UDF) support: off
      Fast back-to-back capable: off
      Data parity error detected: off
      DEVSEL timing: fast (0x0)
      Slave signaled Target Abort: off
      Master received Target Abort: off
      Master received Master Abort: off
      Asserted System Error (SERR): off
      Parity error detected: off
    Class Name: multimedia (0x04)
    Subclass ID: 0x03
    Interface: 0x00
    Revision ID: 0x01
    BIST: 0x00
    Header Type: 0x00 (0x00)
    Latency Timer: 0x00
    Cache Line Size: 0x10

  Type 0 ("normal" device) header:
    0x10: 0x48300004 0x00000000 0x00000000 0x00000000
    0x20: 0x00000000 0x00000000 0x00000000 0x06068086
    0x30: 0x00000000 0x00000050 0x00000000 0x00000109

    Base address register at 0x10
      type: 64-bit nonprefetchable memory
      base: 0x0000000048300000, not sized
    Base address register at 0x18
      not implemented(?)
    Base address register at 0x1c
      not implemented(?)
    Base address register at 0x20
      not implemented(?)
    Base address register at 0x24
      not implemented(?)
    Cardbus CIS Pointer: 0x00000000
    Subsystem vendor ID: 0x8086
    Subsystem ID: 0x0606
    Expansion ROM Base Address: 0x00000000
    Capability list pointer: 0x50
    Reserved @ 0x38: 0x00000000
    Maximum Latency: 0x00
    Minimum Grant: 0x00
    Interrupt pin: 0x01 (pin A)
    Interrupt line: 0x09

  Capability register at 0x50
    type: 0x01 (Power Management, rev. 1.0)
  Capability register at 0x60
    type: 0x05 (MSI)
  Capability register at 0x70
    type: 0x10 (PCI Express)

  Device-dependent header:
    0x40: 0x03000001 0x00000007 0x00000000 0x00000000
    0x50: 0xc8426001 0x00000000 0x00000000 0x00000000
    0x60: 0x00807005 0x00000000 0x00000000 0x00000000
    0x70: 0x00910010 0x00000000 0x00100800 0x00000000
    0x80: 0x00000000 0x00000000 0x00000000 0x00000000
    0x90: 0x00000000 0x00000000 0x00000000 0x00000000
    0xa0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xb0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xc0: 0x01000000 0x00000000 0x00000000 0x00000000
    0xd0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xe0: 0x00000000 0x00000000 0x00000000 0x00000000
    0xf0: 0x00000000 0x00000000 0x00010f86 0x00000000

>Fix:
Set PCI latency timer to appropriate value if necessary, add mixer table if possible, verify dac/adc groups, enumerate nids, etc.  I tried to play around with it but I am not familiar enough to achieve anything. :(