Fix Sound Issues with Intel HDA Driver – Change Device Loading Order

alsaaudiokernel-modules

I have an Acer Aspire One 522 netbook which has an Intel HDA sound card based on the Conexant CX20584 chipset. Although KDE does output sound when starting up, flash and probably many other apps which look for a /dev/dsp device just can't output sound through it, rendering a pretty much useless multimedia experience.

When I checked my ALSA playback devices with aplay -l, I could see the main audio device was getting recognized as card 1 instead of 0, which was being hooked up to HDMI instead:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

That way I get a /dev/dsp1, but it seems most apps are just hardcoded to use /dev/dsp, so I went looking for some way of exchanging the card indexes. After some research through ALSA documentation, I tried to assign indexes to the driver modules used by HDMI and Intel HDA with this /etc/modprobe.d/asound.conf file:

options snd cards_limit=2
options snd-hda-codec-conexant index=0
options snd-hda-codec-hdmi index=1
options snd slots=snd-hda-codec-conexant,snd-hda-codec-hdmi

That didn't work though, and based on some forgotten link on my endless quest for an answer, it seems to be because these index directives are supposed to coordinate module loading order, but both these Conexant and HDMI codecs happen to use the same Intel HDA driver module, so it seems not to apply in this case.

That said, is there any way to define correct card indexes when the devices use the same ALSA driver module (intel HDA in this case)?

Best Answer

I finally found an answer to this problem based on this post from another forum (see "Attempt 1b" for reference). According to it, one can specify the module id, even if the driver used is the same:

alias char-major-116 snd
alias snd-card-0 snd-hda-intel
alias snd-card-1 snd-hda-intel

options snd cards_limit=2

options snd-hda-intel id=SB index=0
options snd-hda-intel id=HDMI index=1

thus yelding the correct card ordering and making sound work as expected:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

For applying to other similar cases, you can inspect /proc/asound for symlinks to your cards, they will be your desired modules IDs:

$ ls -l /proc/asound/
total 0
lrwxrwxrwx 1 root root 5 Jan 26 19:19 HDMI -> card1
lrwxrwxrwx 1 root root 5 Jan 26 19:19 SB -> card0
dr-xr-xr-x 4 root root 0 Jan 26 19:19 card0
dr-xr-xr-x 3 root root 0 Jan 26 19:19 card1
-r--r--r-- 1 root root 0 Jan 26 19:19 cards
-r--r--r-- 1 root root 0 Jan 26 19:19 devices
-r--r--r-- 1 root root 0 Jan 26 19:19 hwdep
-r--r--r-- 1 root root 0 Jan 26 19:19 modules
dr-xr-xr-x 2 root root 0 Jan 26 19:19 oss
-r--r--r-- 1 root root 0 Jan 26 19:19 pcm
dr-xr-xr-x 2 root root 0 Jan 26 19:19 seq
-r--r--r-- 1 root root 0 Jan 26 19:19 timers
-r--r--r-- 1 root root 0 Jan 26 19:19 version
Related Question