# No Sound through docking station headphone jack



## nickednamed (Jan 19, 2017)

Hi all.

I have a laptop (Lenovo X220) plugged into a docking station and I would like to have sound played through the speakers which are plugged into the headphone port at the back of the docking station. At the moment, when I plug my speakers into the dock, I get nothing.

Generally the sound works well (as do all other functions of the dock). When my laptop is not in the dock, sound plays normally through the laptop speakers, and when I plug the speakers into the laptop (not dock) it plays normally through the speakers, over HDMI, etc...

But when the laptop is in the dock, I can use only either the built-in laptop speakers or my external speakers (if plugged into the headphone port on the laptop).

I'd really like to just plug my speakers into the dock, and not have to keep messing around with the cables.

Can anyone point me in the right direction?

When I plug the speakers into the laptop headphone port:
`dmesg`

```
hdaa0: Pin sense: nid=25 sense=0xffffffff (connected)
pcm0: Redirect output to: headphones
pcm0: Playback channel set is: Front Left, Front Right,
pcm0: Playback channel matrix is: 2.0 (connected)
```

When I plug into the headphones port at the back of the dock:
`dmesg`

```
pcm0: Redirect output to: main
pcm0: Playback channel set is: Front Left, Front Right,
pcm0: Playback channel matrix is: 2.0 (unknown)
```

`sysctl dev.hdac.0.pindump=1 && dmesg`

```
hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 25 0421101f 1  15 Headphones    Jack  1/8     Right      Black   0
hdaa0:     Caps:    OUT HP           Sense: 0xffffffff (connected)
hdaa0: 26 61a19050 5  0  Mic           None  1/8     Ext-Rear   Pink    0 DISA
hdaa0:     Caps: IN             VREF Sense: 0x7fffffff (disconnected)
hdaa0: 27 04a1102f 2  15 Mic           Jack  1/8     Right      Black   0
hdaa0:     Caps: IN OUT    EAPD VREF Sense: 0x7fffffff (disconnected)
hdaa0: 28 6121401f 1  15 Headphones    None  1/8     Ext-Rear   Green   0 DISA
hdaa0:     Caps:    OUT              Sense: 0x7fffffff (disconnected)
hdaa0: 29 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa0:     Caps: IN OUT    EAPD      Sense: 0xffffffff (connected)
hdaa0: 30 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa0:     Caps: IN                  Sense: 0xffffffff (connected)
hdaa0: 31 90170110 1  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0:     Caps:    OUT             
hdaa0: 32 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa0:     Caps:    OUT             
hdaa0: 34 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa0:     Caps:    OUT             
hdaa0: 35 90a60120 2  0  Mic           Fixed Digital Internal   Unknown 1
hdaa0:     Caps: IN                 
hdaa0: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa0:  GPIO0: disabled
hdaa0:  GPIO1: disabled
hdaa0:  GPIO2: disabled
hdaa0:  GPIO3: disabled
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1:  5 18560010 1  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa1:     Caps:    OUT              Sense: 0x40000000 (disconnected, ELD valid)
hdaa1:  6 18560020 2  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa1:     Caps:    OUT              Sense: 0x40000000 (disconnected, ELD valid)
hdaa1:  7 18560030 3  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa1:     Caps:    OUT              Sense: 0x40000000 (disconnected, ELD valid)
hdaa1: NumGPIO=0 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0
```


`cat /dev/sndstat`

```
Installed devices:
pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Intel Cougar Point (HDMI/DP 8ch)> (play)
pcm2: <Intel Cougar Point (HDMI/DP 8ch)> (play)
pcm3: <Intel Cougar Point (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```

`ls /dev/dsp*`

```
/dev/dsp0.0
```


----------



## aragats (Jan 19, 2017)

Have you tried changing the default unit?
	
	



```
sysctl hw.snd.default_unit
```
E.g. I have 4 of them in my T430.


----------



## nickednamed (Jan 20, 2017)

To be honest, I haven't tried since updating to FreeBSD 11-RELEASE.

I tried with FreeBSD 10.3 but it didn't make any difference. I'm not at home now, so I'll try when I get back and update this thread.

EDIT:

The command `sysctl hw.snd.default_unit=X` doesn't work (with or without acpi_dock() loaded).

I'm guessing the dock headphone jack is not one of the following devices:
`cat /dev/sndstat`

```
Installed devices:
pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Intel Cougar Point (HDMI/DP 8ch)> (play)
pcm2: <Intel Cougar Point (HDMI/DP 8ch)> (play)
pcm3: <Intel Cougar Point (HDMI/DP 8ch)> (play)
```

Plugging and unplugging the speakers seems to make no difference. There is no change in dmesg, for example.


----------



## akripo (May 31, 2018)

Same issue here with no sound from the docking station port, no matter what sysctl tunables I tried..

Laptop: Lenovo Thinkpad T410
Docking station: Lenovo Mini Dock Plus Series 3 (4338-10U)
OS: FreeBSD 12.0-CURRENT #3 r333874

Edit: Furthermore, the docking station does not work with the acpi_dock kernel module at all, e.g. none acpi event it is generated while docking / undocking laptop to it...


----------



## shepper (May 31, 2018)

FreeBSD groups the pins (nid's in the pindump above)  into associations (as=).  Associations are either input or output - not both.  PIns are assigned by interrogation during boot and usually grouped by location.  Unless specified, pcm0 is the default and likely includes your laptop speaker jack (side location).  The dock connections are likely in a different pcm assignment (back location).  You can check by comparing the pin dumps between booting w/o dock vs booting w/ dock.

I suspect the above pin dump is w/o dock as a group of pins are disconnected.


----------



## Deleted member 30996 (May 31, 2018)

I don't dock my Thinkpads anymore.

The first T61 I acquired was in pristine condition. I loved that laptop... I had it docked compiling ports and unplugged the USB mouse from the docking station since it would not be needed for a while and I wanted to use it. When I unplugged it the screen froze. I waited patiently till it became appartent it wasn't going to pick back up and the only way I could reboot it was to do a hard shutdown by holding in the power button till it reset.

Bye bye, laptop. It went to Heaven before my eyes and there might have been tears in them when it did.


----------



## Partmedia (Jan 3, 2019)

I've also had this issue with a ThinkPad T420 and a Mini-Dock 2 for several years. I finally fixed it, making the docking station port show up as an additional device:

```
$ cat /dev/sndstat
Installed devices:
pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Conexant CX20590 (Ext-Rear Analog)> (play/rec)
```

I've only tried on T420, and you probably have to tweak this for your ThinkPad. In /boot/device.hints, add:


```
hint.hdaa.0.nid28.config="as=3 conn=Jack"
hint.hdaa.0.nid26.config="as=4 conn=Jack"
```

A brief intro to Intel High-Definition Audio (HDA), and in particular how snd_hda(4) implements it:


A chip (the _audio codec_) sits between the audio bus and your audio _pins_ (headphone jacks, speakers, etc.)
The _pins_ are exposed to the _codec_ as _widgets_, each with its own _nid_. (Not all widgets are pins, because there are also hardware mixers, muxes, volume controls, etc.)
Pins are grouped with an _association number_ (as). Each as must have all input devices, or all output devices. When as=0, it is disabled, and when as=15, it is unassociated.
Pins that have a _connection type _(conn) set to None will also be disabled. The other important types are _Jack_ (thing you can plug something into) and _Fixed_ (for a built-in laptop speaker that you cannot remove).
Every pair of enabled input/output as' become a pcm device that shows up in /dev/sndstat.

The problem is that the _conn_ for the docking station ports are set to _none_ by default, so they do not show up. After setting the _conn_, you still might need to set the _as_ to something other than the default to get an audio device for it. Briefly:


Identify the _nid_s for your pins. Use `sysctl dev.hdaa.0`.
Set their _conn_ to Jack. You can test your new setting with `sysctl dev.hda.0.nidXX_config="conn=Jack"` before editing device.hints.
Find two free _as_ to give to the dock. If they already have unique _as_, you don't need to do this.
Ask the driver to reload the configuration with `sysctl dev.hdaa.0.reconfig=1`.
Note that for many machines (not just ThinkPads), the defaults will already have been patched over. For a complete list of kernel sound patches, see /usr/src/sys/dev/sound/pci/hda/hdaa_patches.c. You cannot override the configuration with the sysctl if a particular nid has been patched.

Also, on the T420, there seem to be some extra hardware shenanigans that seem to disable builtin speaker output when something is plugged into either the right jack or the dock port. This interacts with the automatic_ jack presence detection_ (PDC) that switch between the internal speaker and the right jack in an interesting way. I've found that making the dock show up as an extra pcm device made it act in the least surprising way.

No, you cannot make the internal, right jack, and dock jack three separate pcm devices, because the codec only supports two independent audio outputs (DACs from the bus to the codec interconnect). On the bright side, there is a hardware output monitor (records what's going to the speakers), only I can't figure out how to get snd_hda(4) to treat it as such (it disables everything not connected to an I/O pin).


----------



## openjohn (Sep 21, 2021)

I have both the onboard headset and docking station jacks working on my X230.

Edit /boot/device.hints:

```
# Disable the internal Mic (as=7 unpaired).
# pcm0 (as=1 out, as=3 in) will be the onboard speaker and headset jack.
# pcm1 (as=2 out, as=4 in) will be the two docking station jacks.
hint.hdaa.0.nid18.config="as=7"
hint.hdaa.0.nid21.config="as=1 seq=15 device=Headphones"
hint.hdaa.0.nid24.config="as=3 seq=0 device=Mic"
hint.hdaa.0.nid25.config="as=4 seq=0 device=Mic conn=Jack color=Pink"
hint.hdaa.0.nid27.config="as=2 seq=0 device=Line-out conn=Jack color=Green"
```

This works with the onboard headset jack on pcm0 and docking station jacks on pcm1. The colors are for reference only and correspond to the docking station jack colors.

NID 25, the docking station mic jack, also didn't show as a Mic device without hints.

The internal speaker doesn't work for unknown reasons, which is strange because NID 21 is configured to duplicate off of NID 20 (seq=15 Headphones).

Here's the associated pindump when docked:

```
# sysctl dev.hdac.0.pindump=1; dmesg
hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 18 90a60170 7  0  Mic           Fixed Digital Internal   Unknown 1 DISA
hdaa0:     Caps: IN                 
hdaa0: 20 90170110 1  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0:     Caps:    OUT    EAPD      Sense: 0x00000000 (disconnected)
hdaa0: 21 0321101f 1  15 Headphones    Jack  1/8     Left       Black   0
hdaa0:     Caps:    OUT HP EAPD      Sense: 0x00000000 (disconnected)
hdaa0: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT             
hdaa0: 24 03a11830 3  0  Mic           Jack  1/8     Left       Black   8
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 25 01a19140 4  0  Mic           Jack  1/8     Rear       Pink    1
hdaa0:     Caps: IN OUT         VREF Sense: 0x80000000 (connected)
hdaa0: 26 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps: IN OUT HP      VREF Sense: 0x00000000 (disconnected)
hdaa0: 27 01014120 2  0  Line-out      Jack  1/8     Rear       Green   1
hdaa0:     Caps: IN OUT         VREF Sense: 0x80000000 (connected)
hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
```

I arrived at this by comparison with my X220, which works by default without device hints. On the X220, the docking station jacks are on pcm0, the onboard headset jack is on pcm1, and the internal Mic appears to be disabled by default (not mapped to a pcm).

However, with this configuration, the pcm0/1 devices are swapped vs the X220, because the X230 chipset (Realtek) doesn't appear to support hardware jack detection on the docking station jacks (non-zero misc flag), while the X220 chipset (Conexant) does.


----------



## astyle (Sep 21, 2021)

Wow, thread really prone to necroposting... somebody seems to poke in around once a year.


----------



## Deleted member 30996 (Sep 21, 2021)

Trihexagonal said:


> Bye bye, laptop. It went to Heaven before my eyes and there might have been tears in them when it did.


My beloved T61 that passed away before my eyes has risen from the Dead and now runs Kali as my Thanks to the Hindu Goddess of Death. 

I'm using it now.


----------



## astyle (Sep 21, 2021)

Trihexagonal said:


> My beloved T61 that passed away before my eyes has risen from the Dead and now runs Kali as my Thanks to the Hindu Goddess of Death.
> 
> I'm using it now.


I went through a scare once with an HP Folio 13 when its keyboard "died" in 2015. No backlight, no mouse pad, so no way to use that laptop except through USB keyboard and mouse. At the time, I did lug the machine all over the place, so plug/unplug dance was getting to me. But after 6 weeks, it came back to life.


----------

