Intel D945GCLF2 and Surround Sound on Gentoo

I while back I purchased an Intel D945GCLF2 motherboard to play with. This board features the dual core Atom 330 processor in a nice mini-ITX form factor. I’ve recently set this up as a media center PC, running Gentoo and XBMC. I’ve been quite happy with its performance in this role, but there was one thing that seemed missing… surround sound. The board only has the standard line in, line out, and mic jacks on the rear panel, but on Intel’s website, they claim it supports 5.1 surround sound. The snd-hda-intel kernel driver only provided 2 channel audio to my ALSA system. The user manual for the board was not much help either:

Intel Desktop Board D945GCLF2 has a 6-channel (5.1) onboard audio subsystem that includes a Realtek ALC662 audio codec.
The audio subsystem features:

  • Intel High Definition Audio interface
  • Advanced jack sense, for the back panel connectors, that enables the audio codec to recognize the device that is connected to an audio port and retask the connector via the audio driver.
  • Back panel audio connectors that are configurable through the audio device drivers:
    • Line in/retasking jack
    • Line out/retasking jack
    • Mic in/retasking jack

I’m not sure how this board behaves with the Windows driver, but needless to say, jack auto detection did not work in Linux. Some searching provided an answer: the kernel driver needs to be configured by ALSA to set the jacks to 6 channel mode. Adding this to the end of /etc/modprobe.d/alsa.conf did the trick:
options snd-hda-intel model=3stack-6ch-dig

With the driver now set, make sure that alsamixer is set to 6 channel audio. The last item in alsamixer for me switches between 2ch and 6ch, so be sure to set it accordingly.

This post on the Ubuntu forums led me to the solution: http://ubuntuforums.org/showthread.php?t=1072792