# Sound not switching 'line-out' (hdaa0) <-> 'headphone' (hdaa1)



## pbp_jackd (Jan 10, 2021)

Problem is, if I connect headphones to the front of my PC the audio still comes from the Monitor speakers, which are set as my default.

The monitor sounds uses pcm4 which is connected via display port cable to my monitor.
The headset is standard 1/8 inch connector connected to pcm7.

I can manually switch the default audio output to pcm7 and sound would come through the headphones.
However, the desired result is to switch between both automatically.
I verified that the sensing is working for the headphones.

Just guessing, could it be creating associations between hdaa0 (monitor) and hdaa1 (headphones) is the issue ?

I did configure the headphone (nid27) to be in the same associaten (15) as the monitor(nid11) and set the sequence number to 15 in /boot/device.hints:
`hint.hdaa.1.nid27.config="as=15 seq=15 misc=0 device=Headphones"`

The whole setup looks like so:
`➜  ~ cat /dev/sndstat
Installed devices:
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <ATI R6xx (HDMI)> (play)
pcm2: <ATI R6xx (HDMI)> (play)
pcm3: <ATI R6xx (HDMI)> (play)
pcm4: <ATI R6xx (HDMI)> (play) default
pcm5: <ATI R6xx (HDMI)> (play)
pcm6: <Realtek ALC1220 (Rear Analog 5.1/2.0)> (play/rec)
pcm7: <Realtek ALC1220 (Front Analog)> (play/rec) 
pcm8: <Realtek ALC1220 (Rear Digital)> (play)
pcm9: <USB audio> (rec)
No devices installed from userspace.`

Nid config:
`hdac0: <ATI (0xab38) HDA Controller> mem 0xfcda0000-0xfcda3fff at device 0.1 on pci8
hdac0: PCI card vendor: 0x1002, device: 0xab38
hdac0: HDA Driver Revision: 20120126_0002
hdac0: Config options: on=0x00000000 off=0x00000000
hdac0: attempting to allocate 1 MSI vectors (1 supported)
hdac0: using IRQ 78 for MSI
hdac0: Caps: OSS 6, ISS 0, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256
hdac1: <AMD X570 HDA Controller> mem 0xfcc00000-0xfcc07fff at device 0.4 on pci10
hdac1: PCI card vendor: 0x1043, device: 0x87d3
hdac1: HDA Driver Revision: 20120126_0002
hdac1: Config options: on=0x00000000 off=0x00000000
hdac1: attempting to allocate 1 MSI vectors (1 supported)
hdac1: using IRQ 80 for MSI
hdac1: Caps: OSS 4, ISS 4, BSS 0, NSDO 1, 64bit, CORB 256, RIRB 256
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
hdaa0: Subsystem ID: 0x00aa0100
hdaa0: NumGPIO=0 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0
hdaa0: Original pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0:  3 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  5 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  7 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  9 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 11 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 13 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 15 585600f0 15 0  Digital-out   None  Digital 0x18       Unknown 0
hdaa0: Patched pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0:  3 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  5 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  7 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0:  9 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 11 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 13 185600f0 15 0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa0: 15 585600f0 15 0  Digital-out   None  Digital 0x18       Unknown 0 DISA
hdaa0: 6 associations found:
hdaa0: Association 0 (15) out:
hdaa0:  Pin nid=3 seq=0
hdaa0: Association 1 (15) out:
hdaa0:  Pin nid=5 seq=0
hdaa0: Association 2 (15) out:
hdaa0:  Pin nid=7 seq=0
hdaa0: Association 3 (15) out:
hdaa0:  Pin nid=9 seq=0
hdaa0: Association 4 (15) out:
hdaa0:  Pin nid=11 seq=0
hdaa0: Association 5 (15) out:
hdaa0:  Pin nid=13 seq=0
hdaa0: Tracing association 0 (15)
hdaa0:  Pin 3 traced to DAC 2
hdaa0: Association 0 (15) trace succeeded
hdaa0: Tracing association 1 (15)
hdaa0:  Pin 5 traced to DAC 4
hdaa0: Association 1 (15) trace succeeded
hdaa0: Tracing association 2 (15)
hdaa0:  Pin 7 traced to DAC 6
hdaa0: Association 2 (15) trace succeeded
hdaa0: Tracing association 3 (15)
hdaa0:  Pin 9 traced to DAC 8
hdaa0: Association 3 (15) trace succeeded
hdaa0: Tracing association 4 (15)
hdaa0:  Pin 11 traced to DAC 10
hdaa0: Association 4 (15) trace succeeded
hdaa0: Tracing association 5 (15)
hdaa0:  Pin 13 traced to DAC 12
hdaa0: Association 5 (15) trace succeeded
hdaa0: Looking for additional DAC for association 0 (15)
hdaa0: Looking for additional DAC for association 1 (15)
hdaa0: Looking for additional DAC for association 2 (15)
hdaa0: Looking for additional DAC for association 3 (15)
hdaa0: Looking for additional DAC for association 4 (15)
hdaa0: Looking for additional DAC for association 5 (15)
hdaa0: Tracing input monitor
hdaa0: Tracing other input monitors
hdaa0: Tracing beeper
hdaa0: Pin sense: nid=3 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: Pin sense: nid=5 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: Pin sense: nid=7 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: Pin sense: nid=9 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: Pin sense: nid=11 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: Pin sense: nid=13 sense=0x7fffffff (disconnected, ELD valid)
hdaa0: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
pcm1: <ATI R6xx (HDMI)> at nid 5 on hdaa0
pcm2: <ATI R6xx (HDMI)> at nid 7 on hdaa0
pcm3: <ATI R6xx (HDMI)> at nid 9 on hdaa0
pcm4: <ATI R6xx (HDMI)> at nid 11 on hdaa0
pcm5: <ATI R6xx (HDMI)> at nid 13 on hdaa0
hdacc1: <Realtek ALC1220 HDA CODEC> at cad 0 on hdac1
hdaa1: <Realtek ALC1220 Audio Function Group> at nid 1 on hdacc1
hdaa1: Subsystem ID: 0x104387d3
hdaa1: NumGPIO=8 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa1:  GPIO0: disabled
hdaa1:  GPIO1: disabled
hdaa1:  GPIO2: disabled
hdaa1:  GPIO3: disabled
hdaa1:  GPIO4: disabled
hdaa1:  GPIO5: disabled
hdaa1:  GPIO6: disabled
hdaa1:  GPIO7: disabled
hdaa1: Original pins configuration:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1: 18 40170040 4  0  Speaker       None  Analog  0x00       Unknown 0
hdaa1: 20 01014010 1  0  Line-out      Jack  1/8     Rear       Green   0
hdaa1: 21 01011012 1  2  Line-out      Jack  1/8     Rear       Black   0
hdaa1: 22 01016011 1  1  Line-out      Jack  1/8     Rear       Orange  0
hdaa1: 23 01a18030 3  0  Mic           Jack  1/8     Rear       Purple  0
hdaa1: 24 01a19031 3  1  Mic           Jack  1/8     Rear       Pink    0
hdaa1: 25 02a19040 4  0  Mic           Jack  1/8     Front      Pink    0
hdaa1: 26 0181303f 3  15 Line-in       Jack  1/8     Rear       Blue    0
hdaa1: 27 02214020 2  0  Headphones    Jack  1/8     Front      Green   0
hdaa1: 29 4047e629 2  9  SPDIF-out     None  Analog  0x00       White   6
hdaa1: 30 01456150 5  0  SPDIF-out     Jack  Optical Rear       Orange  1
hdaa1: Patching widget caps nid=29 0x00400400 -> 0x00700400
hdaa1: Patching pin config nid=27 0x02214020 -> 0x022140ff
hdaa1: Patched pins configuration:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1: 18 40170040 4  0  Speaker       None  Analog  0x00       Unknown 0 DISA
hdaa1: 20 01014010 1  0  Line-out      Jack  1/8     Rear       Green   0
hdaa1: 21 01011012 1  2  Line-out      Jack  1/8     Rear       Black   0
hdaa1: 22 01016011 1  1  Line-out      Jack  1/8     Rear       Orange  0
hdaa1: 23 01a18030 3  0  Mic           Jack  1/8     Rear       Purple  0
hdaa1: 24 01a19031 3  1  Mic           Jack  1/8     Rear       Pink    0
hdaa1: 25 02a19040 4  0  Mic           Jack  1/8     Front      Pink    0
hdaa1: 26 0181303f 3  15 Line-in       Jack  1/8     Rear       Blue    0
hdaa1: 27 022140ff 15 15 Headphones    Jack  1/8     Front      Green   0
hdaa1: 30 01456150 5  0  SPDIF-out     Jack  Optical Rear       Orange  1
hdaa1: 5 associations found:
hdaa1: Association 0 (1) out:
hdaa1:  Pin nid=20 seq=0
hdaa1:  Pin nid=22 seq=1
hdaa1:  Pin nid=21 seq=2
hdaa1: Association 1 (3) in:
hdaa1:  Pin nid=23 seq=0
hdaa1:  Pin nid=24 seq=1
hdaa1:  Pin nid=26 seq=15
hdaa1: Association 2 (4) in:
hdaa1:  Pin nid=25 seq=0
hdaa1: Association 3 (5) out:
hdaa1:  Pin nid=30 seq=0
hdaa1: Association 4 (15) out:
hdaa1:  Pin nid=27 seq=15
hdaa1: Tracing association 0 (1)
hdaa1:  Pin 20 traced to DAC 2
hdaa1:  Pin 22 traced to DAC 4
hdaa1:  Pin 21 traced to DAC 3
hdaa1: Association 0 (1) trace succeeded
hdaa1: Tracing association 1 (3)
hdaa1:  Pin 23 traced to ADC 8
hdaa1:  Pin 24 traced to ADC 8
hdaa1:  Pin 26 traced to ADC 8
hdaa1: Association 1 (3) trace succeeded
hdaa1: Tracing association 2 (4)
hdaa1:  Pin 25 traced to ADC 9
hdaa1: Association 2 (4) trace succeeded
hdaa1: Tracing association 3 (5)
hdaa1:  Pin 30 traced to DAC 6
hdaa1: Association 3 (5) trace succeeded
hdaa1: Tracing association 4 (15)
hdaa1:  Pin 27 traced to DAC 5
hdaa1: Association 4 (15) trace succeeded
hdaa1: Looking for additional DAC for association 0 (1)
hdaa1: Looking for additional ADC for association 1 (3)
hdaa1: Looking for additional ADC for association 2 (4)
hdaa1: Looking for additional DAC for association 3 (5)
hdaa1: Looking for additional DAC for association 4 (15)
hdaa1: Tracing input monitor
hdaa1:  Tracing nid 11 to out
hdaa1:  nid 11 is input monitor
hdaa1:  Tracing nid 34 to out
hdaa1:  Tracing nid 35 to out
hdaa1: Tracing other input monitors
hdaa1:  Tracing nid 23 to out
hdaa1:  Tracing nid 24 to out
hdaa1:  Tracing nid 25 to out
hdaa1:  Tracing nid 26 to out
hdaa1: Tracing beeper
hdaa1: Pin sense: nid=27 sense=0x80000000 (connected)
hdaa1: FG config/quirks: forcestereo ivref50 ivref80 ivref100 ivref
pcm6: <Realtek ALC1220 (Rear Analog 5.1/2.0)> at nid 20,22,21 and 23,24,26 on hdaa1
pcm7: <Realtek ALC1220 (Front Analog)> at nid 27 and 25 on hdaa1
pcm8: <Realtek ALC1220 (Rear Digital)> at nid 30 on hdaa1
hdaa0: Pin sense: nid=11 sense=0xffffffff (connected)
hdaa0: Pin sense: nid=11 sense=0xffffffff (connected, ELD valid)
hdaa0: Pin sense: nid=9 sense=0xffffffff (connected)
hdaa0: Pin sense: nid=9 sense=0xffffffff (connected, ELD valid)
hdaa0: Pin sense: nid=9 sense=0xffffffff (connected, ELD valid)
hdaa0: Pin sense: nid=9 sense=0xffffffff (connected, ELD valid)
hdaa1: Pin sense: nid=27 sense=0x00000000 (disconnected)
hdaa1: Pin sense: nid=27 sense=0x80000000 (connected)`


----------



## bsduck (Jan 19, 2021)

Why did you put `misc=0` in your configuration?

According to snd_hda():


> Misc bits. Can be specified as a number from 0 to 15.
> Bit 0 has a special meaning. When set it means that jack detection is not implemented in hardware.


----------



## pbp_jackd (Jan 21, 2021)

bsduck said:


> Why did you put `misc=0` in your configuration?
> 
> According to snd_hda():


Just to be safe. It defaults to 0 in my case anyways and as mentioned, sensing works. So the questions still is why the audio is not routed to the headphone when it has been detected.


----------



## shkhln (Jan 21, 2021)

Those associations and sequences are implemented in the chip hardware/firmware, not the driver. Each HDA chip has it's _own_ associations and sequences.


----------



## pbp_jackd (Jan 21, 2021)

shkhln said:


> Those associations and sequences are implemented in the chip hardware/firmware, not the driver. Each HDA chip has it's _own_ associations and sequences.


To put it with my words. The issue is that one is on hdaa0 the other on hdaa1 and you can't combines those somehow ?


----------

