# Sound on MacBookPro 2011 with FreeBSD 9.1



## andersbo87 (Aug 21, 2012)

Hey! 

Today I saw that a beta for the upcoming 9.1 release was available, and seing that there is better support for Intel video cards, I decided to give it a try.

However, basically I can't get my sound card to work. In 9.0-RELEASE I was able to fix that by modifying /boot/loader.conf, but that method does not seem to have any effect so far in 9.1. As I haven't installed any GUI yet, I'm writing this message from Mountain Lion (Mac OS 10.8). I've uploaded verbose messages from dmesg, as well as results from uname -a, pciconf, sndstat and sysctl that is related to anything that has to do with my sound card. If I'm not completely mistaken, I have a Cirrus Logic CS4206 sound card installed.

Output from pciconf:


> device     = '6 Series/C200 Series Chipset Family High Definition Audio Controller'



Output from cat /dev/sndstat:


> FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
> Installed devices:
> pcm0: <ATI R6xx (HDMI)> (play)
> pcm1: <Cirrus Logic CS4206 (Analog 2.0+HP/2.0)> (play/rec) default
> ...



Output from uname -a:


> FreeBSD andersbo-mac 9.1-BETA1 FreeBSD 9.1-BETA1 #0: Thu Jul 12 09:38:51 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64



Verbose dmesg messages as well as output from sysctl related to my sound card have been uploaded as zipped text files (verbose_dmesg.txt.zip and sysctl.txt.zip) as the files were larger than the allowed 19 kilobytes.

Does anyone here have any suggestions how to fix this little sound problem?
Thanks in advance.


----------



## lme@ (Aug 21, 2012)

That should be easy to solve.

```
pcm0: <ATI R6xx (HDMI)> (play)
pcm1: <Cirrus Logic CS4206 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Cirrus Logic CS4206 (Analog)> (play/rec)
pcm3: <Cirrus Logic CS4206 (Digital)> (play/rec)
```
That means that your current primary sound card is the HDMI output of your graphics card. Unless you connect your TV to it you won't hear a sound.
So what you need to do is telling FreeBSD to use a different device.
Try: `# sysctl hw.snd.default_unit=1` to make pcm1 the default.
If that still doesn't work, try 2 or 3.
If you found the right device, add

```
hw.snd.default_unit=1
```
 or the apropriate device index number to /etc/sysctl.conf.


----------



## andersbo87 (Aug 21, 2012)

Thanks for your help. 
I tried changing the device to all of the available index numbers as you said, but to no avail. Still no sound.

I forgot to mention that in order to get the sound to work in 9.0-RELEASE I had to set some hdac values in /boot/loader.conf. However, in 9.1-PRERELEASE, with or without those values, there are no sounds from my speakers at all.

Here is the contents of /boot/loader.conf (sorry I forgot to post that in my initial post):


> debug.acpi.max_tasks="10000000" # needed to get acpiconf -i 0 to display actual data
> cuse4bsd_load="YES"
> linux_load="YES"
> atapicam_load="YES"
> ...



As I said, this works fine in 9.0-RELEASE, but seemingly not in 9.1.


----------



## lme@ (Aug 21, 2012)

Hmmm, ok.
Maybe the values in loader.conf to be changed?
The good think is that you don't need to set this in loader.conf any longer but you can configure that on the fly:
`# sysctl dev.hdaa`

Please take a look at snd_hda's manpage from FreeBSD 9.1


----------



## plamaiziere (Aug 21, 2012)

andersbo87 said:
			
		

> As I said, this works fine in 9.0-RELEASE, but seemingly not in 9.1.
> 
> ```
> hint.hdac.1.config="gpio1, gpio3"
> ...



There were some changes in 9-STABLE in the snd_hda(4) module and you must update your quirks.

For example to adapt your quirks, see my quirks below :
(9.0 quirks)

```
/boot/device.hints (can we use /boot/loader.conf to define quirks?)
hint.hdac.0.config="gpio0 ovref"
hint.hdac.0.cad0.nid21.config="as=4 seq=15"
```

become (9.1 quirks)

```
hint.hdaa.0.config="ovref"
hint.hdaa.0.nid21.config="as=4 seq=15"
hint.hdaa.0.gpio_config="0=set"
```

Regards


----------



## andersbo87 (Aug 22, 2012)

That worked like a charm! Thank you so much!  Updating my quirks and placing them in device.hints solved my problem. Once again, thank you!


----------



## josser (Sep 2, 2012)

andersbo87 said:
			
		

> Hey!
> 
> Today I saw that a beta for the upcoming 9.1 release was available, and seing that there is better support for Intel video cards, I decided to give it a try.



Hi, I understand that this question is really outside of the topic, but can you tell, which installation method you are use? 
Bootcamp, rEFIt, or? 

I'm trying to install freebsd on my macbook, installations always finishing succesfull, but after install I can't boot into new system.


----------



## andersbo87 (Sep 2, 2012)

josser said:
			
		

> Hi, I understand that this question is really outside of the topic, but can you tell, which installation method you are use?
> Bootcamp, rEFIt, or?
> 
> I'm trying to install freebsd on my macbook, installations always finishing succesfull, but after install I can't boot into new system.



I use BootCamp to install FreeBSD on my Mac which is a rather difficult process: First install FreeBSD 8 (as to get the partitions right as GPT FreeBSD 9 does not work with a Mac) and then do a clean FreeBSD 9 install.



> This is my install guide regarding FreeBSD (in this case FreeBSD 8, as I've not yet been able to boot FreeBSD 9 from my MacBook Pro 2009 model; I did get PC-BSD 9 RC 1 to boot using rEFIt, but RC 2 and RC 3 have been a rather sad story to me).
> 
> Note that if you plan to follow this guide, you should back up your current data and important files in case something goes wrong, which it might when making changes to your system. The following guide was written when installing to an Intel Mac. I do not know if there are any differences from installing on an Intel based Mac to a PowerPC based one. It is a rather long guide, but to me it worked, so I hope it does for you as well.
> 
> ...



Then do the FreeBSD 9 install (my disk is labeled ada0):
Let's say FreeBSD 8 is installed on ada0s4. To install FreeBSD 9 (clean install), delete ada0s4a, b, d, etc, but keep ada0s4.
Make sure ada0s4 is marked and press C on your keyboard. Type the size and mount point of the partition and choose OK. Now, create a swap partition by repeating the previous step, but this time, replace freebsd-ufs with freebsd-swap. When you are happy, choose Finish and confirm the changes.

Partition table example:
ada0p1: efi 200MB
ada0p2: apple-hfs XX GB
ada0p3:apple-boot 650MB
ada0s4: BSD
     ada0s4a     3GB freebsd-ufs   /
     ada0s4b     5GB freebsd-swap
     ada0s4d     6GB freebsd-ufs  /var
     ada0s4e     100GB freebsd-ufs  /usr
     ada0s4f     3GB freebsd-ufs  /tmp


----------



## andersbo87 (Sep 2, 2012)

As always, do the experimenting at your own risk and do not forget to make backups of important system files!!


----------



## josser (Sep 3, 2012)

Oh, thank you very much for guide, hope I can do it


----------

