Sun, 14 Sep 2008
Intel HDA: Headphones versus Speakers
I have solved an interesting driver problem yesterday: I have a new laptop (more on it later) with an Intel HDA sound device. The problem was that it did not detect when the headphone jack was plugged in, and did not switch the built-in speakers off in that case. After reading many web forums, I have finally managed to get it working. I will try to summarize the steps required, in case somebody in the future will have a similar problem on a different hardware:
- It is necessary to find out which codec chip do you have. It is written in the first line of the
/proc/asound/card0/codec#0file, and also displayed in the line labeled
alsamixer -D hw:0.
- Find out valid "
model" options for this chip. Look at the file
/usr/src/linux*/Documentation/sound/alsa/ALSA-Configuration.txt, find the section "
Module snd-hda-intel", and in this section find a subsection for your codec chip. Mine was "
Realtek ALC660-VD", described in subsection "ALC861VD/660VD".
- Now run the command "
rmmod snd-hda-intel; modprobe snd-hda-intel model=XXXX" for each model valid for your chip. Try to plug the headphones in, play some sound (like "
aplay -D hw:0 /usr/share/sounds/generic.wav), and determine whether the built-in speaker were switched off or not. Warning, the trickiest part ahead: it is necessary to re-plug the headphone jack after each "
modprobe" command. It detects only the event of plugging a jack, not the state of it being plugged in. It took me an hour to discover this, when none of the available models seemed to work.
- Finally, to use the "
model=" option you have just selected (mine was "
model=lenovo", how strange it may look for the ASUS laptop ;-), use the following command:
echo 'options snd-hda-intel model=XXXX' > /etc/modprobe.d/snd-hda-intel(of course substituting
XXXXby the correct model name).
Hope this mini-HOWTO will help somebody.