Federico Fuga

Engineering, Tech, Informatics & science

Enabling the Audio on Linux on an iMac Retina 18,2

13 Apr 2023 21:19 CEST

Introduction

Recently I converted all my Apple Computer to Linux.

I have been a Mac User since 2007, when I bought my first MacBookPro. At that time, using linux on office task like writing documents and performing dayly tasks was not very “user friendly” so I opted on a Apple + Linux solution (Linux on a Virtual Machine, or dual boot, or dual machine, whatever worked well for me).

But since a few years, Apple became even more picky about what you can install on MacOS and ports/brew/whatever became difficult and error prone. So my last Apple computer was an iMac Retina 2k late 2017 that I bought more for the design than for need. And my working machine became a Thinkpad p53, a “portable workstation” with enough power to compile whole Android OS or Buildroot without waiting too much.

6 months ago I did the big jump: I declared linux as my office machine for daily routine, without pain or difficulties. The only software I really miss is Autodesk Fusion 360, but I have a full 1Tb SSD disk with windows, just in case1.

So I removed MacOS from ALL my Apple computer without a single issue, except for the Audio of my iMac 18,2.

Until today.

The issue

There are various Audio chip on Apple’s iMacs. For some the snd-intel-hda works well with specific model code, but iMac 18.2 have an unsupported Cirrus Logic chip.

Indeed if you try with some instructons found on the internet, you might have enabled the intel hda driver by enabling the model=generic or model=imac_21 optons in the /etc/modprobe.d/alsa-base.conf. In this case an audio device appears in the Alsa settings, but it doesn’t work.

Compiling the out-of-tree driver

The driver can be found here.

Follow the instructions. The installation script uses an hack to modify the cirrus logic driver, but it requires to identify correctly the OS distribution.

If you are on Mint, that is an Ubuntu derived distribution, it will not be detected correctly and the patches will not apply! you must modify the script by changing the “Ubuntu” string on the grep command with “Mint”:

# we need to handle Ubuntu based distributions eg Mint here
isubuntu=0
if [ `grep '^NAME=' /etc/os-release | grep -c Mint` -eq 1 ]; then
	isubuntu=1
fi

in install.cirrus.driver.sh line 83, change Ubuntu into Mint.

If you prefer to make just installation as root, add some sudo command at lines 233, 239 and 245:

cd $hda_dir

[[ ! -d $update_dir ]] && sudo mkdir $update_dir

if [ $major_version -eq 5 -a $minor_version -lt 13 ]; then

	make PATCH_CIRRUS=1

	sudo make install PATCH_CIRRUS=1

else

	make

	sudo make install

fi

You need to install the kernel sources, but the script will explain how to do.

Remember to remove the options snd-hda-intel model=generic snoop=0 or whatever from /etc/modprobe.d/alsa-base.conf in case you added it.

Then, reboot.

Profit!


  1. till now, I never powered up Fusion or Windows, despite my new Wacom waiting to be used. Life sucks. ↩︎