Solved Getting sound to automatically switch to laptop headphone jack? (X1 Carbon 6th Gen ThinkPad Realtek ALC285)

i-bsd

Member

Thanks: 7
Messages: 57

#1
I haven't been able to find a clear guide on this.

Currently, when I plug in headphones, the speakers cut out. So it's obviously detecting it but no sound in headphones. Can't see any way to raise the volume on the headphones.
 

shepper

Aspiring Daemon

Thanks: 254
Messages: 752

#2
Sound in FreeBSD is complex.
See https://forums.freebsd.org/threads/no-audio-on-my-system.57473/post-327863
pcm(4) and mixer(8)

One other possibility is that newer laptops (is that what your using?) have combined the headphone and mic into a single 4 pin jack. Older 3 pin headphones will mute but not align the contacts for sound.

If you have further questions it would help to know your hardware. Hopefully, someone has worked this out. If not, then a listing of the sound pins will be needed.
 

michael_hackson

Active Member

Thanks: 82
Messages: 147

#4
I managed to get my sound working thanks to contributions made by shepper in multiple threads. Have you doublechecked that the headphones and speakers are in the same association? I guess they could be because the sound gets muted but you can always go with dmesg | grep hda to find out.

Example from my laptop:
Code:
hdaa0: Patched pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 22 0221101f 1  15 Headphones    Jack  1/8     Front      Black   0
hdaa0: 23 02a19020 2  0  Mic           Jack  1/8     Front      Pink    0
hdaa0: 24 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 25 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 26 92170110 1  0  Speaker       Fixed Analog  0x12       Unknown 1
hdaa0: 27 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 28 224511f0 15 0  SPDIF-out     Jack  Optical Ext-Front  Black   1
hdaa0: 29 95a7112e 2  14 Mic           Fixed Analog  0x15       Black   1
And "as" you can see they have the same association with "as" (1).
If they are not in the same association then you fix it by adding the correct line to /boot/device.hints
where you put information about sound driver, nid, as, seq, device: as found in snd_hda(4).

Line in my /boot/device.hints is hint.hdaa.0.nid22.config="as=1 seq=15". This sets the headphones to be associated with the speakers on my laptop.
^^^
Make sure to put correct hinting corresponding to your devices and system. Hope this is the case and you became somewhat helped by this.
 
OP
OP
i-bsd

i-bsd

Member

Thanks: 7
Messages: 57

#5
I managed to get my sound working thanks to contributions made by shepper in multiple threads. Have you doublechecked that the headphones and speakers are in the same association? I guess they could be because the sound gets muted but you can always go with dmesg | grep hda to find out.

Example from my laptop:
Code:
hdaa0: Patched pins configuration:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 22 0221101f 1  15 Headphones    Jack  1/8     Front      Black   0
hdaa0: 23 02a19020 2  0  Mic           Jack  1/8     Front      Pink    0
hdaa0: 24 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 25 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 26 92170110 1  0  Speaker       Fixed Analog  0x12       Unknown 1
hdaa0: 27 400001f0 15 0  Line-out      None  Unknown 0x00       Unknown 1 DISA
hdaa0: 28 224511f0 15 0  SPDIF-out     Jack  Optical Ext-Front  Black   1
hdaa0: 29 95a7112e 2  14 Mic           Fixed Analog  0x15       Black   1
And "as" you can see they have the same association with "as" (1).
If they are not in the same association then you fix it by adding the correct line to /boot/device.hints
where you put information about sound driver, nid, as, seq, device: as found in snd_hda(4).

Line in my /boot/device.hints is hint.hdaa.0.nid22.config="as=1 seq=15". This sets the headphones to be associated with the speakers on my laptop.
^^^
Make sure to put correct hinting corresponding to your devices and system. Hope this is the case and you became somewhat helped by this.
This is my verbose boot output:

Code:
hdaa0: Patching widget caps nid=29 0x00400400 -> 0x00700400
hdaa0: Patched pins configuration:
hdaa0: nid 0x as seq device conn jack loc color misc
hdaa0: 18 90a60130 3 0 Mic Fixed Digital Internal Unknown 1
hdaa0: 19 40000000 0 0 Line-out None Unknown 0x00 Unknown 0 DISA
hdaa0: 20 90170110 1 0 Speaker Fixed Analog Internal Unknown 1
hdaa0: 22 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 23 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 24 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 25 04a11040 4 0 Mic Jack 1/8 Right Black 0
hdaa0: 26 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 27 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 30 411111f0 15 0 Speaker None 1/8 Rear Black 1 DISA
hdaa0: 33 04211020 2 0 Headphones Jack 1/8 Right Black 0
hdaa0: 4 associations found:
It looks like "as" is 1 for Internal Speaker and 2 for Headphones Jack. Is that correct?
 

shepper

Aspiring Daemon

Thanks: 254
Messages: 752

#6
Code:
hdaa0: 20 90170110 1 0 Speaker Fixed Analog Internal Unknown 1
This should be your internal speaker that is wired to nid 20. The default association is AS=1.

Code:
hdaa0: 33 04211020 2 0 Headphones Jack 1/8 Right Black 0
This should be a 1/8 inch jack on the Right side of your laptop that is wired to nid 33. For nid33 the default association is AS=2

If you reassign nid33 to be in the same association as nid20 (AS=1) and give it a sequence of 15 (seq=15), when headphones are plugged into the jack, the lower output nid (nid20) should mute. There are a number of examples of the actual syntax that can be found by searching the forum or you can modify michael_hackson's example by changing nid22 to nid20 nid33.
 
Last edited:
OP
OP
i-bsd

i-bsd

Member

Thanks: 7
Messages: 57

#7
Code:
hdaa0: 20 90170110 1 0 Speaker Fixed Analog Internal Unknown 1
This should be your internal speaker that is wired to nid 20. The AS=1.

Code:
hdaa0: 33 04211020 2 0 Headphones Jack 1/8 Right Black 0
This should be a 1/8 inch jack on the Right side of your laptop that is wired to nid 33.

If you assign nid 33 to be in the same association as nid20 (AS=1) and give it a sequence of 15 (seq=15), when headphones are plugged into the jack, the lower output nid (20) should mute. There are a number of examples of the actual syntax that can be found by searching the forum or you can modify michael_hackson example by changing nid22 to nid20.
This worked. Just had to give Headphones Jack the same "as" (1) as the Internal Speaker.

Thanks.
 

shepper

Aspiring Daemon

Thanks: 254
Messages: 752

#8
i-bsd
You can help future users by posting the make/model of laptop. Future users who search the web and this forum using "make/model + FreeBSD + sound" should find your fix.
 

ultrageranium

New Member


Messages: 1

#10
Can someone explain why the following in /boot/device.hints works:
Code:
hint.hdaa.0.nid33.config="as=1 seq=15"
But sysctl dev.hdaa.0.nid33_config="as=1 seq=15 does not?
 

Lanakus

Active Member

Thanks: 69
Messages: 122

#11
But sysctl dev.hdaa.0.nid33_config="as=1 seq=15 does not?
The sysctl(8) program allows you to set values used by the kernel (in some cases). It can be done permanently via /etc/sysctl.conf.

On the other hand the boot loader(8) reads /boot/loader.rc and also device.hints(5) during initial startup and then boots the kernel if it is not interrupted.

But you can edit /boot/loader.conf and /boot/device.hints with the sysrc command using the -f flag and the filename.
 

honk

Active Member

Thanks: 17
Messages: 143

#12
Can someone explain why the following in /boot/device.hints works:
Code:
hint.hdaa.0.nid33.config="as=1 seq=15"
But sysctl dev.hdaa.0.nid33_config="as=1 seq=15 does not?
In case of "Intel High Definition Audio" changing the audio configuration during runtime using sysctrl works if you do it right. As per manpage you have to commit your change:

dev.hdaa.%d.reconfig Setting this to a non-zero value makes driver to destroy existing pcm devices and process new pins configuration set via dev.hdaa.%d.nid%d_config.
Example:
Code:
sysctl dev.hdaa.0.reconfig=1
sysctl dev.hdaa.1.reconfig=1
I highly recommend to read snd_hda(). It's not FreeBSD which is complex when it comes to sound. It's the audio chipsets which become more and more complex! In the old days you usually had one stereo output and one microphone or line input. Today you have multichannel output and input and they are (in case of Intel HD Audio) reconfigurable in software to meet different situations (e.g. 5.1, 7.1 and so on). Also todays audio jacks could be used as input or output depending on your software configuration. Beside this you might have multiple sound cards inside your computer. One dedicated sound card and one within your GPU. In case of my Lenovo X230 there is a dedicated audio chip (Realtek ALC269) and another sound card within the GPU(?) for HDMI, both implementing a Intel HD Audio. Would be interesting how the default setting looks like when running a recent Linux distribution. In Windows it might be no problem, because you install a specific driver from the vendor (Lenovo) which gives a reasonable default setting because the driver sticks to a particular hardware model (or line).
 

ozz

New Member


Messages: 1

#13
Hi,

let me confirm next code for /boot/device.hints works well for my Thinkpad X1 Carbon 5gen, type 20HR:
Code:
hint.hdaa.0.nid22.config="as=1 seq=15"
Thanks.
 
Top