Sound on MacBookPro 2011 with FreeBSD 9.1

Hey! :D

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
pcm2: <Cirrus Logic CS4206 (Analog)> (play/rec)
pcm3: <Cirrus Logic CS4206 (Digital)> (play/rec)

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.
 

Attachments

That should be easy to solve.
Code:
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
Code:
hw.snd.default_unit=1
or the apropriate device index number to /etc/sysctl.conf.
 
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"
ndis_load="YES"
#hw.msk.msi_disable=1
hint.hdac.1.config="gpio1, gpio3"
hint.hdac.1.cad0.nid9.config="as=1 seq=15 device=Headphones"
hint.hdac.1.cad0.nid10.config="as=4 seq=1"
hint.hdac.1.cad0.nid11.config="as=1 seq=0"
hint.hdac.1.cad0.nid12.config="as=3 seq=0"
hint.hdac.1.cad0.nid13.config="as=2 seq=0"
hint.hdac.1.cad0.nid15.config="as=6 seq=0"
hint.hdac.1.cad0.nid16.config="as=5 seq=0"

As I said, this works fine in 9.0-RELEASE, but seemingly not in 9.1.
 
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
 
andersbo87 said:
As I said, this works fine in 9.0-RELEASE, but seemingly not in 9.1.
Code:
hint.hdac.1.config="gpio1, gpio3"
hint.hdac.1.cad0.nid9.config="as=1 seq=15 device=Headphones"
...

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)
Code:
/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)
Code:
hint.hdaa.0.config="ovref"
hint.hdaa.0.nid21.config="as=4 seq=15"
hint.hdaa.0.gpio_config="0=set"

Regards
 
That worked like a charm! Thank you so much! :D Updating my quirks and placing them in device.hints solved my problem. Once again, thank you! :)
 
andersbo87 said:
Hey! :D

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.
 
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.

1) Boot from the install DVD. Enter fixit menu
2) Choose "CDROM/DVD"
3) Enter "gpart modify -i X -t freebsd adX"
4) Enter fdisk adaX and copy the output to a blank paper. You might need that information later.
5) Enter fdisk -u adX. Answer n to the question to change the idea of what BIOS thinks. The next thing that appears is the data for the EFI/GPT partition. Answer no to change it. Repeat that until you came to the partition you want to change. In this example I want to change partition 3 onto which I have installed Windows or formatted as NTFS. Answer yes to change the partition. Now you'll be asked to supply a decimal value for sysid. Enter 165 for FreeBSD. Don't change the value for start, just press enter. Do the same for "size". You may get a warning that says that the partition doesn't start on a track boundary or end on a cylinder boundary. Answer yes to change beg/end addresses and enter 1023 for beginning cylinder, 254 for beginning head and 63 for beginning sector. Enter 1023 for ending cylinder, 254 for ending head and 63 for ending sector. Answer yes to the question if we are happy with this entry.
If there are any more partitions on your disk, say no to chsnhe them. Don't change the active partition, and say yes to write the new partition table. The system may complain that "Class not found", but you can ignore that message.

6) Reboot you computer from the install disk. When the boot menu appears, press 6 to escape to losder prompt. A message saying Type ? for a list of commands or 'help' for more detailed help. The prompt, labeled "OK" appears on a new line. Now, enter load geom_mbr and press enter. Then, enter load geom_label and press enter. Now, enter load geom_bsd and press enter. Finally enter boot and press enter to continue the boot process. After a little while the main menu appears. Choose "standard install." When you get to the fdisk editor, make dure that one of the partitions is labeled freebsd. If neither of them are, reboot your computer and repeat the previuos speps. DO NOT CHANGE ANYTHING IN THE FDISK EDITOR! Select the partition labeled "freebsd" and press Q to continue. Now you need to create local FreeBSD partitions. Press A (I think it is) to make the system do that automatically. When you are happy, press Q to quit the editor and continue installation. Now, choose the installation type and then choose your installation medium. The installation should now begin.
7) Follow the instructions to create local users, etc
8) Reboot you computer. If you can't boot anything, or if the partition scheme is identified as MBR by OS X, reboot from the install DVD, enter fixit (as in step 1) and choose "CDROM/DVD".
9) Enter fdisk -u adX. Answer n to the question to change the idea of what BIOS thinks. The next thing that appears is the data for the EFI/GPT partition. Make sure that the partition 1 has exactly this value:
sysid 238 (0xee), (efi gpt)
Start 1, size 409639 (200.MB), flag 0
beg: cyl 1023/ head 254/ sector 63;
end: cyl 1023/ head 254/ sector 63;
If it does not have this value, answer yes to change it, enter sysid 238, start 1 and size 409639. Answer no to correct warnings.
Answer yes to change beg/end addresses and enter 1023 for beginning cylinder, 254 for beginning head and 63 for beginning sector. Enter 1023 for ending cylinder, 254 for ending head and 63 for ending sector. Answer yes to the question if we are happy with this entry. Do not change the other partition nor change the active one. Answer yes to write the new partition table.

Now you should have FreeBSD 8 installed on your Mac.

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
 
As always, do the experimenting at your own risk and do not forget to make backups of important system files!! :)
 
Back
Top