FreeBSD 7.0 – Finding and Loading the Correct Sound Driver

After getting my desktop setup (following these steps) I realized that I didn’t have working sound. It took me a bit of digging around and help from IRC to find out how. I hope to make this a bit easier for others by getting it on the web and into the infinite wisdom of Google.

First of all you need to find the right module. The method that I used initially was a bit of a shotgun approach, but it ended up telling me the right module in the end.

If you’re coming from Linux you might be familiar with the ‘modprobe’ tool for adding and removing modules from your kernel. In FreeBSD this tool is ‘kldload’. So, what we’ll do is load the ‘snd_driver’ module, which will end up telling us which one. This may take some time and your machine may be unresponsive for a few moments. Don’t panic (…unless, of course, it remains unresponsive for more than five-minutes).

kldload snd_driver

cat /dev/sndstat

On my machine I get the following output, which tells me I should use the ‘snd_hda’ module.

To autoload this module at boot time you’ll want to add the module to your /boot/loader.conf file:

snd_hda_load=”YES”

If your output reports a different module the syntax is still the same. module_name_load=”YES”

Unfortunately, on the D630 and D830, this only activates sound from the headphones but not the built in speakers. A workaround(?) that I found was to add another line to activate the built in speakers. The following line goes in your /boot/device.hints file.

hint.pcm.0.config=”gpio0,gpio1,gpio2,gpio3,gpio4,gpio5,gpio6,gpio7″

note: I don’t know which of the gpioX values actually does the trick, but leaving all of them in doesn’t seem to negatively affect anything. If anyone knows which value(s) actually does the job I’d appreciate the help. (I haven’t had the time to try each one or a combination, followed by reboots, to test.)