How to fix Apple iMac headphone sound problem

Apple iMac 12,1 and 13,1 models (21.5 or 27 inch) well supported by Linux but there is an annoying problem with sound card.

Builtin speakers works out of the box but when you plugged headphones, you can’t hear any sound on it though it will detected properly (at least Debian Jessie edition).

There is already an open bug report for this problem: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=743936

To fix this problem, you have to load snd-hda-intel module with model=imac27_122 option.

To do this, create a new file (if similar conf file for snd-hda-intel module exists, use that one) for example /etc/modprobe.d/sound.conf with following content:

options snd-hda-intel model=imac27_122

and reboot, that’s all.

Do not try any other model parameters which you may found on some forum sites, it will not work for these Apple iMac models.

You can learn your device’s model name with dmidecode as below:

$ sudo dmidecode | grep "Product Name"
       Product Name: iMac13,1

I can confirm this works on my iMac which has Product Name “iMac17,1”. No need to change model option, just the same as imac27_122. You need to reboot after make such a change.

This doesn’t work on iMac14,1 in Debian Stretch

And it works on my iMac with Debian 10, its Product Name is iMac12,1
I created the sound.conf file and added the line options snd-hda-intel model=imac27_122. I didn’t need to change the model option.
Thank you.

Further data points: this works on both an iMac 13,2 (27-inch, late 2012) and an iMac 14,2 (27-inch, late 2013), in each case running Debian 11 (bullseye) with the default kernel (5.10.0).