# Sound driver?



## kasumi (Apr 26, 2011)

Hello.

I did every step in this guide: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sound-setup.html but sound just does not work with my PC so I beg for your help. 

I've got an ASRock 880G Extreme3 Mainboard: http://www.asrock.com/mb/overview.asp?model=880g extreme3 The sound card is:

7.1 CH HD Audio with Content Protection, DAC with 110dB dynamic range (VIAÂ® VT2020 Audio Codec) , Premium Blu-ray audio support

But the onboard sound connector is damaged so I have to use the headphone connector on the front side of my Antec 300 case. I installed ALSA several times but FreeBSD seems to require something different. Can please anyone explain everything step-by-step?

Thank you.


----------



## SirDice (Apr 26, 2011)

What does `# cat /dev/sndstat` tell you?

You probably have snd_hda(4) which requires some tweaking. Not all boards with that chipset are wired the same. It's all explained in the man page.


----------



## kasumi (Apr 26, 2011)

SirDice said:
			
		

> What does `# cat /dev/sndstat` tell you?




```
cat: /dev/sndstat: No such file or directory
```

I'll read the manpage now.


----------



## Zare (Apr 26, 2011)

Did you reboot after those steps? You need to load drivers, and that just tells kernel to load them at boot time. Please show the output of

`# cat /boot/loader.conf`

and

`# kldstat`


----------



## used2bsd (Apr 27, 2011)

Sorry about jumping in on kasumi's question.
I have a similar problem. My sound Device is Realtek ALC662
I get this output for sndstat

```
$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit 2009061500/i386) 
Installed devices: 
pcm1: <HDA Realtek ALC662 PCM #0 Analog> (play/rec) 
pcm2: <HDA Realtek ALC662 PCM #1 Digital> (play) default
```
This is what I get for kldstat

```
$ kldstat 
Id Refs Address    Size     Name 
1   16 0xc0400000 c3a704   kernel 
2    1 0xc103b000 9f7544   nvidia.ko 
3    2 0xc1a33000 2d998    linux.ko 
4    1 0xc6134000 2000     star_saver.ko 
5    1 0xc67ce000 b000     ntfs.ko
```

After I do verbose boot, part of output I get are pasted below

```
hdac0: Probing codec #0...
hdac0: HDA Codec #0: Realtek ALC662
hdac0:  HDA Codec ID: 0x10ec0662
hdac0:        Vendor: 0x10ec
hdac0:        Device: 0x0662
hdac0:      Revision: 0x01
hdac0:      Stepping: 0x01
hdac0: PCI Subvendor: 0xa0021458
hdac0: 	Found audio FG nid=1 startnode=2 endnode=39 total=37
hdac0: 
hdac0: Processing audio FG cad=0 nid=1...
hdac0: GPIO: 0x40000002 NumGPIO=2 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdac0:  nid 20 0x01014010 as  1 seq  0      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac0:  nid 21 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1
hdac0:  nid 24 0x01a19830 as  3 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 8
hdac0:  nid 25 0x02a19c31 as  3 seq  1           Mic  Jack jack  1 loc  2 color    Pink misc 12
hdac0:  nid 26 0x0181303f as  3 seq 15       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac0:  nid 27 0x02214c1f as  1 seq 15    Headphones  Jack jack  1 loc  2 color   Green misc 12
hdac0:  nid 28 0x593301f0 as 15 seq  0            CD  None jack  3 loc 25 color Unknown misc 1
hdac0:  nid 29 0x4005c603 as  0 seq  3      Line-out  None jack  5 loc  0 color   Res.C misc 6
hdac0:  nid 30 0x014b6120 as  2 seq  0     SPDIF-out  Jack jack 11 loc  1 color  Orange misc 1
hdac0: Patched pins configuration:
hdac0:  nid 20 0x01014010 as  1 seq  0      Line-out  Jack jack  1 loc  1 color   Green misc 0
hdac0:  nid 21 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 22 0x411111f0 as 15 seq  0       Speaker  None jack  1 loc  1 color   Black misc 1 [DISABLED]
hdac0:  nid 24 0x01a19830 as  3 seq  0           Mic  Jack jack  1 loc  1 color    Pink misc 8
hdac0:  nid 25 0x02a19c31 as  3 seq  1           Mic  Jack jack  1 loc  2 color    Pink misc 12
hdac0:  nid 26 0x0181303f as  3 seq 15       Line-in  Jack jack  1 loc  1 color    Blue misc 0
hdac0:  nid 27 0x02214c1f as  1 seq 15    Headphones  Jack jack  1 loc  2 color   Green misc 12
hdac0:  nid 28 0x593301f0 as 15 seq  0            CD  None jack  3 loc 25 color Unknown misc 1 [DISABLED]
hdac0:  nid 29 0x4005c603 as  0 seq  3      Line-out  None jack  5 loc  0 color   Res.C misc 6 [DISABLED]
hdac0:  nid 30 0x014b6120 as  2 seq  0     SPDIF-out  Jack jack 11 loc  1 color  Orange misc 1
hdac0: 3 associations found:
hdac0: Association 0 (1) out:
hdac0:  Pin nid=20 seq=0
hdac0:  Pin nid=27 seq=15
hdac0: Association 1 (2) out:
hdac0:  Pin nid=30 seq=0
hdac0: Association 2 (3) in:
hdac0:  Pin nid=24 seq=0
hdac0:  Pin nid=25 seq=1
hdac0:  Pin nid=26 seq=15
..
..
hdac0:           + <- nid=24 [pin: Mic (Pink Jack)]
hdac0:           + <- nid=25 [pin: Mic (Pink Jack)]
hdac0:           + <- nid=26 [pin: Line-in (Blue Jack)]
hdac0:           + [DISABLED] <- nid=27 [pin: Headphones (Green Jack)]
hdac0:           + [DISABLED] <- nid=28 [pin: CD (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=29 [pin: Line-out (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=20 [pin: Line-out (Green Jack)]
hdac0:           + [DISABLED] <- nid=21 [pin: Speaker (None)] [DISABLED]
hdac0:           + [DISABLED] <- nid=22 [pin: Speaker (None)] [DISABLED]
hdac0:           + <- nid=11 [audio mixer]
..
..
pcm1: <HDA Realtek ALC662 PCM #0 Analog> at cad 0 nid 1 on hdac0
..
pcm2: <HDA Realtek ALC662 PCM #1 Digital> at cad 0 nid 1 on hdac0
..
```
Apologies for pasting a big part of the output. I am not sure what I have to include and what to leave out. Not so familiar with FreeBSD ( actually am a newbie ). Any pointers to help would be appreciated. BTW the sound device works perfectly on windows. But on FreeBSD 8.2, I get a message saying

```
<HDA Realtek ALC662 PCM #0 Analog> does not work
```
I changed the default device to pcm2 but that does not help
Sorry to kasumi for jumping on his question. I did not want to open another thread.
regards to everyone.


----------



## Imanol (May 12, 2011)

@kasumi

Look up which chipset that soundcard uses, and load the sound and snd_XXX modules, according to the chipset. Maybe it's HDA compliant, try snd_hda.


----------



## used2bsd (May 19, 2011)

@kasumi
You might have to edit /etc/sysctl.conf and change to 
	
	



```
hw.snd.verbose=2
```
 to get a detailed output which shows snd_xxx. Best wishes in solving your problem.

I think I have to reprogram the HDAC pins in my case and I'm not sure how to do it. Troubleshooting sound in FreeBSD needs a fair amount of knowledge.


----------



## used2bsd (May 24, 2011)

I think you should build a custom kernel with sound enabled. The man pages have all the gory details but here are the steps I followed. Be root and then


```
cd /usr/src/sys/i386/conf
cp GENERIC CUSTOMK
conf CUSTOMK
```
edit CUSTOMK with vi and add the following lines:


```
# Sound support
device    sound
device    snd_hda

# Misc devices
device    speaker
```
add the following to device.hints


```
hint.speaker.0.at="isa"
hint.speaker.0.port="0x61"
```

then from the /usr/src/sys/i386/conf directory


```
conf CUSTOMK
```

read message on location of compile directory and any relevant messages. cd to compile directory and then


```
make cleandepend && make depend
make
make install
make clean
```

reboot.

My headphones worked after these steps. Good luck to you but please read the man pages/handbook first.


----------



## SirDice (May 24, 2011)

used2bsd said:
			
		

> edit CUSTOMK with vi and add the following lines


Don't forget to change the "ident" line.




> then from the /usr/src/sys/i386/conf directory
> 
> 
> ```
> ...



This is an old and deprecated way of compiling a kernel. It may work now but it's not guaranteed to work in the future. This is the proper way of building and installing a kernel:


```
cd /usr/src
make buildkernel KERNCONF=CUSTOMK
make installkernel KERNCONF=CUSTOMK
```

Also note that a custom kernel isn't needed. The sound drivers work fine as a module.


----------



## used2bsd (May 25, 2011)

@ SirDice,

My apologies for encroaching on senior users territory. The intention was to help kasumi with what I imagined is a solution. Actually I tried both kernel compiling methods. Both gave me errors. The error on older kernel compiling method seemed easier to solve (I deleted the line with error).

For reasons beyond my understanding, loading the sound and snd_hda modules through /boot/loader.conf did not work. I thought kernel compiling might be the solution.
I still have to get my mic and speakers to work. I'm almost sure editing the HDAC pins is the solution.
regards


----------

