iMac18,3 built-in speakers working on Fedora 43 / kernel 6.19.12 with an experimental CS8409 patch

Hello,

I would like to share an experimental result for the 2017 27-inch Retina 5K iMac (iMac18,3) with the Cirrus Logic CS8409 audio codec.

I confirmed stable playback from the built-in speakers with the following environment:

  • Hardware: iMac18,3, 27-inch Retina 5K, 2017
  • Distribution: Fedora 43
  • Kernel: 6.19.12
  • Output profile: Analog Stereo
  • Audio stack: ALSA / PipeWire

The built-in audio device was detected by Fedora, but the internal speakers initially remained silent.

During the investigation, I found that the speaker path required additional TAS576 boot/reset initialization. I also found that clearing the speaker DACs 0x02 and 0x03 during cleanup caused the working speaker state to be lost.

After adding the initialization and preserving those speaker DAC states during cleanup, built-in speaker playback became stable across repeated playback and stop cycles.

Current status

Working:

  • Built-in speaker playback
  • Analog Stereo output
  • Normal desktop audio
  • YouTube playback
  • ALSA / PipeWire playback

Known limitations:

  • Headphone switching is not working yet
  • Built-in and external microphone input are not working yet
  • Tested on only one iMac18,3
  • Other Fedora releases, kernels, and Mac models are untested
  • This does not reproduce Apple’s original acoustic tuning

Patch and documentation

Experimental patch and documentation:

Technical report in Japanese:

Narrative record of the investigation in Japanese:

I also shared this result with the upstream CS8409 project:

This result is still experimental, but I hope it may help other iMac18,3 users.

Testing reports would be welcome. Useful details would include:

  • Mac model identifier
  • Fedora version
  • Kernel version
  • Whether the patch builds
  • Whether the built-in speakers work
  • Headphone and microphone behavior

Thank you.

It would be wonderful if you could update to the latest kernel (and all other system software) then confirm this fix still works with the 7.0.12-201 kernel that fedora presently has available. The 6.19.12 kernel is far out of date and no longer available to install or use

Thank you for the comment.

Yes, you are right. My current result was tested with my local Fedora 43 environment using kernel 6.19.12, so it should be treated as an experimental result for that specific kernel, not as a confirmation for the current Fedora kernel.

When I started this investigation, my Fedora installation was using the 6.19.12 kernel, and I focused on making the built-in speakers work in that environment. I did not fully realize how quickly the Fedora kernel target would move during the investigation.

I understand that 6.19.12 is no longer a practical target for most Fedora users.

The next important step is to rebuild and test the patch against the currently available Fedora kernel, such as 7.0.12-201. I can install a fresh Fedora environment on a separate HDD for testing, so I will try to verify the patch there instead of updating the currently working 6.19.12 environment directly.

I want to make sure I have a safe rollback point on my iMac18,3 before testing, because the patch touches the kernel audio driver and I do not want to lose the currently working speaker state.

Once I can test it on the newer kernel, I will report the result here.

If anyone else with an iMac18,3 can test it on the current Fedora kernel before then, reports would also be very welcome.

Thank you again for pointing this out.

Thank you again for suggesting that I test this with the current Fedora kernel.

I have now installed Fedora 44 on a separate external HDD and ported the iMac18,3 CS8409 changes to:

  • Fedora Linux 44
  • Kernel 7.0.12-201.fc44.x86_64
  • PipeWire 1.6.6
  • iMac18,3
  • CS8409 subsystem ID 106b:1000

The CS8409 source layout has changed since 6.19.12, and the related code is now mainly split across:

  • sound/hda/codecs/cirrus/cs8409.c
  • sound/hda/codecs/cirrus/cs8409.h
  • sound/hda/codecs/cirrus/cs8409-tables.c

Most of the earlier patch could be adapted, although the model and fixup table changes required manual adjustment.

The custom module was built for the running kernel and installed as:

/lib/modules/7.0.12-201.fc44.x86_64/updates/cirrus/snd-hda-codec-cs8409.ko

After reboot, I confirmed that this custom module was loaded and that the iMac18,3 fixup, CS42L83 initialization, TAS576 boot/reset and TDM setup, and the playback and cleanup hooks were executed.

The first playback test through PipeWire, using a 48 kHz mono Front_Center.wav, was silent.

I then stopped PipeWire and tested direct ALSA playback with:

speaker-test -D hw:0,0 -c 2 -r 44100 -t sine -f 440 -l 1

With this test, I confirmed audible output from the iMac18,3 built-in speakers.

So far, I can confirm that:

  • The custom CS8409 module loads on kernel 7.0.12
  • The iMac18,3 fixup is selected
  • The CS42L83 and TAS576 initialization path runs
  • The built-in speakers produce sound with direct ALSA playback at 44.1 kHz, 2 channels
  • The speaker DACs 0x02 and 0x03 remain uncleared during cleanup as intended

This is only a preliminary sound-output result, not yet a stability confirmation.

Still to be tested:

  • Normal PipeWire desktop playback
  • 48 kHz playback
  • Repeated playback and stop cycles
  • Reboot reproducibility
  • Channel balance and sound quality
  • Profile switching
  • Headphone switching
  • Microphone input

I also observed an out of range cmd warning and some temporary I²C read/write failures involving the CS42L83, although initialization continued and direct ALSA playback produced sound.

I will continue testing and report further results here.

Thank you again for pointing me toward the current kernel.

Update: I have now published a Fedora 44 / kernel 7.0.12 test patch and test notes.

After the initial direct ALSA sound test, I continued testing the iMac18,3 CS8409 patch on:

  • Fedora Linux 44
  • Kernel 7.0.12-201.fc44.x86_64
  • PipeWire 1.6.6
  • iMac18,3
  • CS8409 subsystem ID 106b:1000
  • External 2 TB HDD test installation

The custom module was built for the running kernel and installed as:

/lib/modules/7.0.12-201.fc44.x86_64/updates/cirrus/snd-hda-codec-cs8409.ko

Unlike the first preliminary result, I was now able to confirm normal desktop playback through PipeWire, including Firefox / YouTube playback.

Confirmed so far:

  • Custom snd-hda-codec-cs8409.ko loads from updates/cirrus
  • alsa_output.pci-0000_00_1f.3.analog-stereo becomes the default output
  • Direct ALSA playback works
  • PipeWire default playback works
  • 44.1 kHz / 48 kHz stereo playback works
  • Firefox / YouTube playback works
  • YouTube pause / resume works
  • GNOME left/right balance control affects playback
  • After switching to another output, playback can be restored by switching back to Analog Stereo

Important behavior from the earlier 6.19.12 stable patch also appears to work on 7.0.12:

  • Speaker DACs 0x02 and 0x03 are not cleared during playback cleanup
  • CS8409 TDM setup, TAS576 TDM slot setup, extra TDM sync, and CS42L83 buffers-on are executed during playback preparation
  • Playback can recover after cleanup

I have added the Fedora 44 / kernel 7.0.12 test patch and notes to the GitHub repository:

Added files:

  • FEDORA_44_KERNEL_7.0.12_TEST_NOTES.md
  • patches/imac18-3-cs8409-speaker-fedora-7.0.12.patch

Relevant commits:

  • 66474e7 Add Fedora 44 kernel 7.0.12 test patch for iMac18,3
  • fef6181 Update README for Fedora 44 kernel 7.0.12 test patch
  • 61546a2 Clarify Fedora 44 kernel 7.0.12 patch usage

Please note that this is still experimental.

Known limitations / open issues:

  • Headphone switching is not supported yet
  • Built-in microphone input is not supported yet
  • External microphone input is not supported yet
  • 4ch / 2.1ch profiles are untested
  • Switching profiles or outputs may still disturb the audio state
  • An out of range cmd warning appears during boot
  • Temporary CS42L83 I2C read/write failures are still observed
  • One initial YouTube silent playback case was observed, but it did not reproduce after reboot

At this point, I can confirm that the knowledge from the Fedora 6.19.12 patch can be ported to Fedora 44 / kernel 7.0.12, and that built-in speaker playback works through the normal desktop audio path on my iMac18,3.

Further testing is still needed, especially around headphone switching, microphone input, profile switching, and long-term stability.