# No sound in laptop with FreeBSD 9-RELEASE (Headphones)



## zennybsd (Mar 14, 2012)

I am missing sound in my laptop. I have:

1) In /boot/loader.conf

```
#for Sound
sound_enable="YES"
snd_hda_load="YES"
snd_uaudio_load="YES"
```

2) The /dev/sndstat shows:


```
# cat /dev/sndstat 
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA Conexant CX20585 PCM #0 Analog> (play/rec) default
pcm1: <HDA Conexant CX20585 PCM #1 Analog> (play/rec)
```

3)[CMD=]sysctl[/CMD] shows:


```
# sysctl hw.snd.default_unit
hw.snd.default_unit: 0
```

4) mixer values are:


```
# mixer
Mixer vol      is currently set to  75:75
Mixer pcm      is currently set to  75:75
Mixer speaker  is currently set to  75:75
Mixer mic      is currently set to   0:0
Mixer rec      is currently set to  75:75
Recording source: mic
```

5) The hw.snd sysctl tree:


```
# sysctl hw.snd
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.latency_profile: 1
hw.snd.latency: 7
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1
hw.snd.compat_linux_mmap: 0
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 25
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.vpc_mixer_bypass: 1
hw.snd.verbose: 0
hw.snd.maxautovchans: 16
hw.snd.default_unit: 0
hw.snd.version: 2009061500/amd64
hw.snd.default_auto: 1
```

6) The dev.pcm sysctl tree:


```
# sysctl dev.pcm
dev.pcm.0.%desc: HDA Conexant CX20585 PCM #0 Analog
dev.pcm.0.%driver: pcm
dev.pcm.0.%parent: hdac0
dev.pcm.0.play.vchans: 1
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.rec.vchans: 1
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.buffersize: 65536
dev.pcm.0.bitperfect: 0
dev.pcm.1.%desc: HDA Conexant CX20585 PCM #1 Analog
dev.pcm.1.%driver: pcm
dev.pcm.1.%parent: hdac0
dev.pcm.1.play.vchans: 1
dev.pcm.1.play.vchanmode: fixed
dev.pcm.1.play.vchanrate: 48000
dev.pcm.1.play.vchanformat: s16le:2.0
dev.pcm.1.rec.vchans: 1
dev.pcm.1.rec.vchanmode: fixed
dev.pcm.1.rec.vchanrate: 48000
dev.pcm.1.rec.vchanformat: s16le:2.0
dev.pcm.1.buffersize: 65536
dev.pcm.1.bitperfect: 0
```

I could not figure out what prevents the sound? Thanks!

PS: With FreeBSD8.2, I solved as stated at http://forums.pcbsd.org/showpost.php?p=86074&postcount=2, but /usr/ports/sound/oss is missing in FreeBSD9-RELEASE!

UPDATE: The solution posted below (http://forums.freebsd.org/showpost.php?p=172851&postcount=12) works fine. Thanks ring_zero!


----------



## wblock@ (Mar 14, 2012)

What model of laptop?  Does it have an external volume control?


----------



## fonz (Mar 14, 2012)

zennybsd said:
			
		

> With FreeBSD8.2, I solved as stated at http://forums.pcbsd.org/showpost.php?p=86074&postcount=2, but /usr/ports/sound/oss is missing in FreeBSD9-RELEASE.!


Did you mean audio/oss (/usr/ports/*audio*/oss) by any chance?

Fonz


----------



## zennybsd (Mar 14, 2012)

wblock@ said:
			
		

> What model of laptop?  Does it have an external volume control?



Does not have external volume control.

The laptop is Toshiba C650D.


----------



## zennybsd (Mar 14, 2012)

*OSS conflicts with FreeBSD driver*

I installed oss from the ports, but it shows up an error in dmesg:


```
osscore: Open Sound System conflicts with FreeBSD driver
osscore: Please remove sound(4) from kernel or unload it
module_register_init: MOD_LOAD (osscore, 0xffffffff81646500, 0) error 16
```

I added:


```
oss_enable="YES"
```

in /etc/rc.conf and


```
oss_mod_load="YES"
```

in /boot/loader.conf

I removed  


```
sound_load="YES"
```

from /boot/loader.conf

:-(


----------



## zennybsd (Mar 14, 2012)

*Not Solved Yet!*

Solved without OSS by just changing the default to 1


```
# sysctl -w hw.snd.default_unit=1
hw.snd.default_unit: 0 -> 1
```



Two issues: 

1) With above command, sound works only with pc speakers (no sound with headsets when connected nor the pc speakers goes off after headset connected). 

2) Every reboot needs the above command to enable sound through speakers. 

/etc/sysctl.conf is empty with the following lines:


```
#  ``sysctl'' to adjust kernel values.  ``man 5 sysct
#

# Uncomment this to prevent users from seeing informa
# are being run under another UID.
#security.bsd.see_other_uids=0
```

I did not see anything that is reported by sysctl about the sound-related services that is in above file. Where exactly are they stored in FreeBSD9-RELEASE?


----------



## joel@ (Mar 15, 2012)

Add 
	
	



```
hw.snd.default_unit=1
```
 to /etc/sysctl.conf. Reboot.

You don't need to load all the sound modules in /boot/loader.conf beginning with FreeBSD 9.0. They are already enabled in the GENERIC kernel.


----------



## zennybsd (Mar 15, 2012)

@joel@: Thanks!

That part is fixed, but the headset part still remains the problem (no sound). Any hints?


----------



## Zare (Mar 15, 2012)

Try appending


```
hint.hdac.1.cad0.nid17.config="as=1 seq=15"
hint.hdac.1.cad0.nid20.config="as=2 seq=1"
```

into /boot/device.hints. Reboot. If jack auto-sensing still doesn't work, boot verbose and paste here everything snd_hda spits out. 

BTW, I might be nitpicking, but it would be wiser to use term "integrated speakers", because "PC speaker" is another type of device (BIOS controlled frequency generator, beeper).


----------



## zennybsd (Mar 15, 2012)

*Didn't work!*

@Zare: Thanks. Appending the two lines didn't work.

Here comes what hda spits out in verbose mode after reboot: http://pastebin.com/tnLV2Jjx


----------



## sim (Mar 30, 2012)

Hi zennybsd

How are you getting on with this problem? I have what seems to be the same problem on a Lenovo T510, which appears to have the same hardware as you (Conexant CX20585). I've been messing about but without any luck so far.  The annoying thing is that I had it working on a previous install on this machine.


I'll keep playing, if I get anywhere I'll report back.

/sim


My stats for reference:


```
sim@tma1> cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm1: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> (play)
pcm4: <Conexant CX20585 HDA CODEC PCM (Right Analog)> (play/rec)
pcm5: <Conexant CX20585 HDA CODEC PCM (Internal Analog)> (play/rec) default
```


```
sim@tma1> sysctl -a |grep -i dev.pcm.*location
dev.pcm.1.%location: nid=5
dev.pcm.2.%location: nid=5
dev.pcm.3.%location: nid=5
dev.pcm.4.%location: nid=25,27
dev.pcm.5.%location: nid=31,35
```


```
hdacc0: <NVIDIA GT21x HDA CODEC> at cad 0 on hdac0
hdaa0: <NVIDIA GT21x HDA CODEC Audio Function Group> at nid 1 on hdacc0
pcm0: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> at nid 5 on hdaa0
hdacc1: <NVIDIA GT21x HDA CODEC> at cad 1 on hdac0
hdaa1: <NVIDIA GT21x HDA CODEC Audio Function Group> at nid 1 on hdacc1
pcm1: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> at nid 5 on hdaa1
hdacc2: <NVIDIA GT21x HDA CODEC> at cad 2 on hdac0
hdaa2: <NVIDIA GT21x HDA CODEC Audio Function Group> at nid 1 on hdacc2
pcm2: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> at nid 5 on hdaa2
hdacc3: <NVIDIA GT21x HDA CODEC> at cad 3 on hdac0
hdaa3: <NVIDIA GT21x HDA CODEC Audio Function Group> at nid 1 on hdacc3
pcm3: <NVIDIA GT21x HDA CODEC PCM (HDMI/DP 8ch)> at nid 5 on hdaa3
hdacc4: <Conexant CX20585 HDA CODEC> at cad 0 on hdac1
hdaa4: <Conexant CX20585 HDA CODEC Audio Function Group> at nid 1 on hdacc4
pcm4: <Conexant CX20585 HDA CODEC PCM (Right Analog)> at nid 25 and 27 on hdaa4
pcm5: <Conexant CX20585 HDA CODEC PCM (Internal Analog)> at nid 31 and 35 on hdaa4
unknown: <Conexant CX20585 HDA CODEC Modem Function Group> at nid 2 on hdacc4 (no driver attached)
```


```
dev.hdaa.4.nid25_config: 0x042110f0 as=15 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.4.nid25_original: 0x042110f0 as=15 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.4.nid27_config: 0x04a110f0 as=15 seq=0 device=Mic conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.4.nid27_original: 0x04a110f0 as=15 seq=0 device=Mic conn=Jack ctype=1/8 loc=Right color=Black misc=0
dev.hdaa.4.nid31_config: 0x901701f0 as=15 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.4.nid31_original: 0x901701f0 as=15 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.4.nid35_config: 0x90a601f0 as=15 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.4.nid35_original: 0x90a601f0 as=15 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
```


```
hdaa4: Original pins configuration:
hdaa4: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa4: 25 042110f0 15 0  Headphones    Jack  1/8     Right      Black   0
hdaa4: 26 61a190f0 15 0  Mic           None  1/8     Ext-Rear   Pink    0
hdaa4: 27 04a110f0 15 0  Mic           Jack  1/8     Right      Black   0
hdaa4: 28 612140f0 15 0  Headphones    None  1/8     Ext-Rear   Green   0
hdaa4: 29 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 30 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 31 901701f0 15 0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa4: 32 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 34 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 35 90a601f0 15 0  Mic           Fixed Digital Internal   Unknown 1
hdaa4: Patched pins configuration:
hdaa4: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa4: 25 042110f0 15 0  Headphones    Jack  1/8     Right      Black   0
hdaa4: 26 61a190f0 15 0  Mic           None  1/8     Ext-Rear   Pink    0 DISA
hdaa4: 27 04a110f0 15 0  Mic           Jack  1/8     Right      Black   0
hdaa4: 28 612140f0 15 0  Headphones    None  1/8     Ext-Rear   Green   0 DISA
hdaa4: 29 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 30 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 31 901701f0 15 0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa4: 32 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 34 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 35 90a601f0 15 0  Mic           Fixed Digital Internal   Unknown 1
```


```
sim@tma1> mixer
Mixer vol      is currently set to  95:95
Mixer pcm      is currently set to 100:100
Mixer rec      is currently set to  75:75
Mixer monitor  is currently set to  75:75
Recording source: monitor
```


----------



## ring_zero (Apr 6, 2012)

I had the same issue.  It drove me up the wall.  I just resolved it on my card.  It uses the Conexant CX20585 codec as well.  Sim, Zennybsd, try adding this to /boot/device.hints:

```
hint.hdac.0.cad0.nid31.config="as=2 seq=0 device=Speaker"
hint.hdac.0.cad0.nid25.config="as=2 seq=15 device=Headphones"
```
Then reboot.

This solved the problem for me, hope it works for you as well.

*EDIT*

You need to be using the snd_hda module.
Also, you should not need to change hw.snd.default_unit after you add this code to /boot/device.hints, so if you have changed it to "1", change it back to "0".


----------



## zennybsd (Apr 10, 2012)

*ring_zero's suggestion works*

@ring_zero: Thanks, it works. But I am yet to check with microphone stuff.


----------



## ring_zero (Apr 10, 2012)

Not sure about the microphone.  It should work, but I don't have one to test with.  I am glad that it worked for you.


----------



## sim (Apr 14, 2012)

Unfortunately this hasn't worked in my case.  Anyone else still having trouble?

Looking at my system (see above), I've been trying things like this:


```
hint.hdaa.4.nid31.config="as=15 seq=0 device=Speaker"
hint.hdaa.4.nid25.config="as=15 seq=15 device=Headphones"
```

but to no avail.  If anyone else has any clues I'd be very grateful 

sim


----------



## ring_zero (Apr 14, 2012)

sim said:
			
		

> Unfortunately this hasn't worked in my case.  Anyone else still having trouble?
> 
> Looking at my system (see above), I've been trying things like this:
> 
> ...


Looking at the snd_hda output, it appears that hdaa4 is at cad 0 on hdac 1, so assuming I read this correctly, try: 
	
	



```
hint.hdac.1.cad0.nid31.config="as=2 seq=0 device=Speaker"
hint.hdac.1.cad0.nid25.config="as=2 seq=15 device=Headphones"
```
If that does not work, try (I did say that I might not have read it correctly, didn't I? :e) 
	
	



```
hint.hdac.0.cad1.nid31.config="as=2 seq=0 device=Speaker"
hint.hdac.0.cad1.nid25.config="as=2 seq=15 device=Headphones"
```
 Also it would be helpful if you could post the section of output from snd_hda related to associations.  The section I am referring to will look something like this:
	
	



```
hdac0: Association 0 (1) out:
     hdac0:   Pin nid=21 seq=0
     hdac0:   Pin nid=27 seq=15
     hdac0: Association 1 (2) out:
     hdac0:   Pin nid=20 seq=0
     hdac0: Association 2 (3) in:
     hdac0:   Pin nid=24 seq=0
     hdac0:   Pin nid=26 seq=1
     hdac0:   Pin nid=25 seq=15
```
 Basically what we are trying to do here, is get both the integrated speakers and the line-out into the same association. We have to know the associations that the codec supports to do this. The sequence numbers mean: seq=0(stereo), and seq=15 when used in conjunction with type "Headphones", will duplicate with auto muting if supported.


----------



## sim (Apr 15, 2012)

Thanks for your help ring_zero, I really appreciate it.

I've tried both your suggested dev hints - the first resulted in no sound through either output, the second had sound through the speakers which muted when the headphones were plugged in (good) but the headphones didn't work.

Here is my verbose dmesg, grepped by 'hda', booting with your second dev hint suggestion: 
http://pastebin.com/FbHGeyDq

If I understand correctly, you can see from this bit that the association '2' given in your second dev hint is apparently not being picked up:


```
hdacc4: <Conexant CX20585 HDA CODEC> at cad 0 on hdac1
hdacc4: Root Node at nid=0: 2 subnodes 1-2
hdaa4: <Conexant CX20585 HDA CODEC Audio Function Group> at nid 1 on hdacc4
hdaa4: Audio Function Group at nid=1: 22 subnodes 16-37
hdaa4: NumGPIO=4 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa4:  GPIO0: disabled
hdaa4:  GPIO1: disabled
hdaa4:  GPIO2: disabled
hdaa4:  GPIO3: disabled
hdaa4: Original pins configuration:
hdaa4: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa4: 25 042110f0 15 0  Headphones    Jack  1/8     Right      Black   0
hdaa4: 26 61a190f0 15 0  Mic           None  1/8     Ext-Rear   Pink    0
hdaa4: 27 04a110f0 15 0  Mic           Jack  1/8     Right      Black   0
hdaa4: 28 612140f0 15 0  Headphones    None  1/8     Ext-Rear   Green   0
hdaa4: 29 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 30 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 31 901701f0 15 0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa4: 32 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 34 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1
hdaa4: 35 90a601f0 15 0  Mic           Fixed Digital Internal   Unknown 1
hdaa4: Patched pins configuration:
hdaa4: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa4: 25 042110f0 15 0  Headphones    Jack  1/8     Right      Black   0
hdaa4: 26 61a190f0 15 0  Mic           None  1/8     Ext-Rear   Pink    0 DISA
hdaa4: 27 04a110f0 15 0  Mic           Jack  1/8     Right      Black   0
hdaa4: 28 612140f0 15 0  Headphones    None  1/8     Ext-Rear   Green   0 DISA
hdaa4: 29 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 30 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 31 901701f0 15 0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa4: 32 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 34 40f001f0 15 0  Other         None  Unknown 0x00       Unknown 1 DISA
hdaa4: 35 90a601f0 15 0  Mic           Fixed Digital Internal   Unknown 1
```

It does look like it should be cad 0 on hdac1, as per your first suggestion:


```
hdacc4: <Conexant CX20585 HDA CODEC> at cad 0 on hdac1
hdacc4: Root Node at nid=0: 2 subnodes 1-2
hdaa4: <Conexant CX20585 HDA CODEC Audio Function Group> at nid 1 on hdacc4
hdaa4: Audio Function Group at nid=1: 22 subnodes 16-37
```

However as I mentioned above this seemed to kill all output!

Anyway I'm still looking through the dmesg output for more clues - in the meantime if you have any more suggestions do let me know 

Many thanks

sim


----------



## ring_zero (Apr 16, 2012)

Sim, from the looks of dmesg you have five PCM devices, two of which are relevant to our discussion, pcm4 and pcm5.  Looking at dmesg I see two things, nid 31 (the internal speakers) is located on pcm4 on hdaa4, and nid 25 (the headphones) is located on pcm5 on hdaa4.  So let's try to force them both into the same association "as=2", and hopefully the same device using:
	
	



```
hint.hdaa.4.nid31.config="as=2 seq=0 device=Speaker"
hint.hdaa.4.nid25.config="as=2 seq=15 device=Headphones"
```
 I realize that you have tried something similar to this before, but you were using: 
	
	



```
hint.hdaa.4.nid31.config="as=15 seq=0 device=Speaker"
hint.hdaa.4.nid25.config="as=15 seq=15 device=Headphones"
```
 15 is a non-existent association.  Sorry for all the running around, but I don't have a card this complex to test with. I would like to see the output of `sysctl hw.snd.default_unit` This could shed a little more light on things.


----------



## sim (Apr 18, 2012)

Give that man a beer! :beergrin

It's working! I restarted with the new device.hints and neither of the two outputs worked at all.  I then checked the sysctrl as suggested, which I had previously forced to 5 so that at least the internal speakers worked.  Switching this to 4 then magically made both outputs work as desired, with the speakers muting when the headphones are inserted. 

A couple of tips for anyone else messing with this stuff in case it's not 100% obvious:

1) You have to reboot for a change to /etc/device.hints to take effect.
2) If like me you're using something like Flash video / Youtube to test sound, changes to the sysctls don't apppear to take effect until you reload the media file (e.g. refresh the browser page).

Anyway, thanks once again for your help ring_zero 

sim


----------



## ring_zero (Apr 19, 2012)

Any time. Glad to hear that it worked.


----------



## laufdi (Aug 2, 2012)

for a Thinkpad T510, I had to set hw.snd.default_unit=5

```
# cat /dev/sndstat 
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <NVIDIA GT21x (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA GT21x (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA GT21x (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GT21x (HDMI/DP 8ch)> (play)
pcm4: <Conexant CX20585 (Right Analog)> (play/rec)
pcm5: <Conexant CX20585 (Internal Analog)> (play/rec) default
```


----------

