# Audio/Headphone using FreeBSD 12-release in Dell Inspiron 17-7573 (i7573-7994GRY-PUS)



## manoeldesouza (Mar 5, 2019)

Hello everyone,

     I've been going back and forth on my attempts to depart from Linux in favor for FreeBSD in my new laptop. I have, however, been struggling to have audio over the headphone jack at the left. The audio card in this box is a Realtek ALC3254, and works alike a charm in Manjaro.

I've tried:
`# sysctl hw.snd.default_unit=1`
and:
`# sysctl hw.snd.default_auto=1`
and also, multiple attempts with different combinations using devices.hints but no success. Best result is a little chirp by the time it attempts to play any mp3.
Using
`# sysctl hw.snd.default_unit=0` works fine.

Looks like everything else works fine in this laptop. I`m back in Manjaro, but with hopes to stick for good in FreeBSD. Any ideas?

Thanks in advance.


----------



## A.Petrov (Mar 5, 2019)

You need to carefully read the man page





						snd_hda
					






					www.freebsd.org
				




If you not understand what is described there - perhaps return to Manjaro is a good choice for you.
Sound (HDA) subsystem is not very user friendly in FreeBSD. This is what we all have here.
In Linux world snd_hda subsystem contain a lot more improvements and patches for dozen of variations hda chips (especially from realtek). You can see that by the commentaries in the driver sources for hda sound or a commit history in a repository.
BSD sources do not contain all of them, and as a result - even you take a success with the play on hda pins (via devices.hints), you can stay faced with an improperly setup on a low level hardware initalizations on a driver-side, affected as wrong microphone / headphone setup (wrong/missed i/o port preparations).
What I am talking about you can see on an example of this bug:





						219350 – [snd_hda] ALC256: no sound out off headphones jack
					






					bugs.freebsd.org
				



Enthusiast found a suggestion for ALC255 chip in a may of 2018, and maintainer take the patch into the system source in january on 2019.



manoeldesouza said:


> multiple attempts with different combinations using devices.hints but no success


What exactly you tried? What you see on system console when enter 

```
sysctl dev.hdac.0.pindump=1
```
?


----------



## manoeldesouza (Mar 5, 2019)

I tried multiple combinations in devices.hints:

```
hint.hdaa.0.nid33.config="as=2 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=1"
hint.hdaa.1.nid33.config="as=2 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=1"
hint.hdaa.0.nid33.config="as=1 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=1"
```
etc. None seem to work. Follows the output of some commands from the original setup


```
sysctl dev.hdaa
sysctl dev.pcm
cat /dev/sndstat
mixer
```


```
# sysctl dev.hdac.0.pindump=1
dev.hdac.0.pindump: 0 -> 0
```


----------



## shepper (Mar 5, 2019)

This is a common problem.  FreeBSD associates audio pins based on location.  The internal speakers are usually grouped in one association while the left jacks are placed in a second, different association.  By default, FreeBSD sets only one association as the default.

In /boot/device.hints, you can change the association (as=) of the left headphone nids to match the as of the internal speakers.  In the same line give the left headphone a seq=15 so it will jack sense and mute the internal speakers.

See this example in Thread 66052


----------



## A.Petrov (Mar 6, 2019)

manoeldesouza said:


> I tried multiple combinations in devices.hints:


I think all you need is only next two lines in devices.hints

```
hint.hdaa.0.nid33.config="as=1 seq=15"
hint.hdaa.0.nid18.config="as=1 seq=0"
```
This will join internal speakers (out, nid20) and headphone (out, nid33) with internal mic (in, nid18) in one single _device_ with jack-plug auto detection (for headphones only).

If after that you get noisily/distorted sound from your headphones - snd_hda driver needs a patch for setup i/o coefficients on init stage (like for my Dell Inspirion 3147 with ALC255).


----------



## krnlpk (Mar 16, 2019)

A.Petrov said:


> I think all you need is only next two lines in devices.hints
> 
> ```
> hint.hdaa.0.nid33.config="as=1 seq=15"
> ...



This, I've an Inspiron 5567 with ALC256 and I also had to apply a small patch to make the creaking noises stop. Thankfully it has been merged upstream, so I hope it will land in some dot release further down the road.


----------



## fernandel (Mar 17, 2019)

I have a problem years and I didn't solved:
`dmesg | grep hda`


```
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
hdaa1: hdaa_audio_as_parse: Pin 13 has wrong direction for association 1! Disabling association.
pcm1: <Cirrus Logic CS4206 (Rear Analog Line-in)> at nid 12 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Analog 4ch+HP/2.0)> at nid 10,11,9 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog Line-in)> at nid 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1:  9 012b404f 4  15 Headphones    Jack  Combo   Rear       Green   0
hdaa1:     Caps:    OUT HP           Sense: 0x80000000 (connected)
hdaa1: 10 90100142 4  2  Speaker       Fixed Unknown Internal   Unknown 1
hdaa1:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa1: 11 90100144 4  4  Speaker       Fixed Unknown Internal   Unknown 1
hdaa1:     Caps:    OUT          
hdaa1: 12 018b3020 2  0  Line-in       Jack  Combo   Rear       Blue    0
hdaa1:     Caps: IN                  Sense: 0x00000000 (disconnected)
hdaa1: 13 90a00110 1  0  Mic           Fixed Unknown Internal   Unknown 1
hdaa1:     Caps: IN             VREF Sense: 0x00000000 (disconnected)
hdaa1: 14 400000f0 15 0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa1:     Caps: IN              
hdaa1: 15 01cbe030 3  0  SPDIF-in      Jack  Combo   Rear       White   0
hdaa1:     Caps: IN                  Sense: 0x00000000 (disconnected)
hdaa1: 16 014be060 6  0  SPDIF-out     Jack  Combo   Rear       White   0
hdaa1:     Caps:    OUT          
hdaa1: 18 400000f0 15 0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa1:     Caps: IN              
hdaa1: 21 400000f0 15 0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa1:     Caps:    OUT          
hdaa1: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0
hdaa1:  GPIO0: disabled
hdaa1:  GPIO1: output state=1
hdaa1:  GPIO2: disabled
hdaa1:  GPIO3: output state=1
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Analog 6ch/2.0)> at nid 9,10,11 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog Line-in)> at nid 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Internal Analog 4ch/2.0)> at nid 10,11 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog)> at nid 9 and 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Internal Analog 4ch/2.0)> at nid 10,11 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog)> at nid 9 and 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
```
In /boot/device.hints I have

```
hint.hdaa.1.nid10.config="as=4 seq=2"
hint.hdaa.1.nid11.config="as=4 seq=4"
hint.hdaa.1.nid14.config="as=4 seq=0"
```
and I hear sound just from the speakers but if  I have

```
# hint.hdaa.1.nid9.config="as=4 seq=0 misc=1"
# hint.hdaa.1.nid10.config="as=4 seq=2"
# hint.hdaa.1.nid11.config="as=4 seq=4"
```
than I hear just from the headphones.

Any idea how to solve the problem, please?


----------



## A.Petrov (Mar 18, 2019)

fernandel said:


> Any idea how to solve the problem, please?



hint.hdaa.1.nid9.config="as=4 seq=*15*"
hint.hdaa.1.nid10.config="as=4 seq=2"
hint.hdaa.1.nid11.config="as=4 seq=4"
?


----------



## fernandel (Mar 18, 2019)

A.Petrov said:


> hint.hdaa.1.nid9.config="as=4 seq=*15*"
> hint.hdaa.1.nid10.config="as=4 seq=2"
> hint.hdaa.1.nid11.config="as=4 seq=4"
> ?


No, it doesn't work. The sound is the same time in the speaker and in the headphones and sound is also no good.
`dmesg | grep hda` shows:

```
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Analog 6ch/2.0)> at nid 9,10,11 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog Line-in)> at nid 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa1
hdac0: <ATI RV770 HDA Controller> mem 0xd0630000-0xd0633fff at device 0.1 on pci1
hdac1: <Intel Ibex Peak HDA Controller> mem 0xd0700000-0xd0703fff at device 27.0 on pci0
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
hdacc1: <Cirrus Logic CS4206 HDA CODEC> at cad 0 on hdac1
hdaa1: <Cirrus Logic CS4206 Audio Function Group> at nid 1 on hdacc1
pcm1: <Cirrus Logic CS4206 (Analog 4ch+HP/2.0)> at nid 10,11,9 and 13 on hdaa1
pcm2: <Cirrus Logic CS4206 (Rear Analog Line-in)> at nid 12 on hdaa1
pcm3: <Cirrus Logic CS4206 (Rear Digital)> at nid 16 and 15 on hdaa
```

Thank you.


----------



## Minbari (Mar 18, 2019)

I don't think you can solve this because it's a hardware problem. All Dell laptops have a hardware sensor that in theory should commute from speakers to headphones but most of the time that sensor remain blocked so you have to do it manually. I have a similar probleme running a GNU/Linux distribution on a Dell Latitude E6430.


----------



## fernandel (Mar 18, 2019)

Minbari said:


> I don't think you can solve this because it's a hardware problem. All Dell laptops have a hardware sensor that in theory should commute from speakers to headphones but most of the time that sensor remain blocked so you have to do it manually. I have a similar probleme running a GNU/Linux distribution on a Dell Latitude E6430.


I have iMac 11,1 and I tried again to solve the problem but it doesn't work. Long time ago I ran live Slax Linux and headphones/speakers dodn't have any problem.


----------



## Ancient (Mar 19, 2019)

I tough same Minbari. It is weird that sound fails on every installation. I solved it using: 
	
	



```
sysctl hw.snd.default_unit=1
```


----------



## A.Petrov (Mar 19, 2019)

fernandel said:


> The sound is the same time in the speaker and in the headphones and sound is also no good.


in conjunction with 


fernandel said:


> Long time ago I ran live Slax Linux and headphones/speakers dodn't have any problem


Then only option - dig into the commits history on hda subsystem in linux, and extract line-by-line related to Cirrus Logic "patches" from linux into the FreeBSD...


----------



## fernandel (Mar 19, 2019)

A.Petrov said:


> in conjunction with
> 
> Then only option - dig into the commits history on hda subsystem in linux, and extract line-by-line related to Cirrus Logic "patches" from linux into the FreeBSD...


Thank you very much but I think I will have a new computer earlier than find what is a problem .


----------

