FS#15829 - Sound card numbering is inconsistent and sound module snd_hda_codec_atihdmi can't be blacklisted

Attached to Project: Arch Linux
Opened by Heiko Baums (cyberpatrol) - Thursday, 06 August 2009, 12:24 GMT
Last edited by Aaron Griffin (phrakture) - Monday, 10 August 2009, 20:40 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Since the last update, I can't use my audio card anymore without manually reconfiguring audio players after every system booting.

I've got the audio card M-Audio Audiophile 24/96 and the graphics card ATI Radeon HD3450.
For the audio card I'm using the kernel module snd-ice1712 and for the graphics card I'm using xf86-video-radeonhd-git from AUR (the same issue exists with xf86-video-radeonhd from extra).

For MOC I set "AlsaDevice = plughw:0" in ~/.moc/config, because I only have one sound/audio card in my PC.
MOC now can't find a usable audio card anymore and alsamixer somehow showed me a sound card named "HDA ATI HDMI".
lsmod shows me now the modules snd_hda_codec_atihdmi, snd_hda_codec and snd_hda_intel, even if my graphics card doesn't have a HDMI interface. snd_hda_codec_atihdmi got the sound card #0. And my only real sound card got sound card #1.

But reconfiguring MOC to "AlsaDevice = plughw:1" doesn't work, because of inconsistencies in the sound card numbering. Sometimes the unnecessary HDMI sound device is sound card #0 and the needed ICE1712 sound device is sound card #1, and sometimes it's vice versa.

Blacklisting snd_hda_codec_atihdmi by adding "!snd_hda_codec_atihdmi" to the MODULES array in /etc/rc.conf doesn't help. This module is loaded anyway. And putting "snd-ice1712" at the beginning of the MODULES array, also doesn't help with the inconsistent card numbering.

This must be fixed somehow. I don't need and don't want such a HDMI sound module, I need a consistent sound card numbering and I need the real sound card as the default sound card #0 as usual.

Additional info:
* package version(s)
initscripts 2009.07-3
filesystem 2009.07-1
udev 141-5
alsa-lib 1.0.20-1
kernel26 2.6.30.4-1
This task depends upon

Closed by  Aaron Griffin (phrakture)
Monday, 10 August 2009, 20:40 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Fixed with the use of the index= module parameter
Comment by Roman Kyrylych (Romashka) - Thursday, 06 August 2009, 13:28 GMT
Inconsistent card order is because of  FS#12706  implemented.
This is not considered a bug.
Try http://wiki.archlinux.org/index.php/ALSA#Set_the_default_sound_card to get consistent order.

I am not sure why blacklisting does not work though.
@devs: any ideas on this? (did I miss some change in this area?)
Comment by Heiko Baums (cyberpatrol) - Thursday, 06 August 2009, 15:13 GMT
The method mentioned in http://wiki.archlinux.org/index.php/ALSA#Set_the_default_sound_card doesn't work. The order of the sound cards remain randomly.
But I managed it to blacklist the module snd_hda_codec_atihdmi by blacklisting the modules snd_hda_intel and snd_hda_codec, too.

I haven't read  FS#12706 , yet, but I really don't like - or let me say hate - booting anything in the background or parallel etc. This makes booting only slightly faster, but can lead to many big troubles like this one. And such a parallel booting brings only such a little time saving, that the troubles prevail. I'll read  FS#12706  later, and probably write a comment to this bug. So I'd suggest to revert the implementation of  FS#12706 . There are already options for /etc/rc.multi to load daemons in the background. If someone thinks, he needs this, he can do it but only on his own responsibility. Btw., how often is a PC booted? Is it really important, if it needs 1 or 2 seconds longer to boot?
Comment by Roman Kyrylych (Romashka) - Thursday, 06 August 2009, 15:44 GMT
> But I managed it to blacklist the module snd_hda_codec_atihdmi by blacklisting the modules snd_hda_intel and snd_hda_codec, too.
Did you do this by prefixing them with ! in MODULES?
If yes then I'm for closing this report.

Please comment about  FS#12706  in that report (after reading it first), not here.
Comment by Aaron Griffin (phrakture) - Thursday, 06 August 2009, 18:07 GMT
First off:
snd_hda_codec_atihdmi is not a soundcard. It's a codec. If your indexes are random on your sound card modules, set the index option in a modprobe config file for each sound card.

Secondly:
 FS#12706  will not be reverted because of people with 2 sound cards. This is an edge case. The average user has 1 sound card. Additionally, you can, and SHOULD control sound cards via the index property that the modules provide
Comment by Heiko Baums (cyberpatrol) - Thursday, 06 August 2009, 20:32 GMT
I, of course, have the blacklisted modules snd_hda_codec_atihdmi, snd_hda_intel and snd_hda_code prefixed with a !. Otherwise they weren't blacklisted. ;-)
I don't think, this bug should be closed, because there are people, who are using 2 sound cards and need a consistent sound card numbering, which is currently not possible. So this needs to be fixed.

snd_hda_codec_atihdmi may not be a sound card but a codec, but it is recognized by alsa as a sound card and gets a sound card number. Tell me, if this is an upstream bug in alsa. Then I'll file a bug report for alsa.

I don't think, that having 2 sound cards is an edge case. Even if it was one, those people, too, need a stable and consistent system. A Linux distribution, especially Arch Linux ;-), is not only for the average user. If you, Aaron, mean with "control sound cards via the index property" the method in the wiki, Roman, has linked to, then this doesn't work at least not with snd-ice1712 and snd_hda_codec_atihdmi.
Comment by Heiko Baums (cyberpatrol) - Thursday, 06 August 2009, 21:39 GMT
I've searched a bit more and found a solution. With these lines in /etc/modprobe.de/modprobe.conf it works:

# ALSA portion
options snd cards_limit=2
alias snd-card-0 snd-ice1712
alias snd-card-1 snd-hda-intel
options snd-ice1712 index=0
options snd-hda-intel index=1
# OSS/Free portion
alias sound-slot-0 snd-ice1712
alias sound-slot-1 snd-hda-intel

So the wiki is not quite wrong, but incomplete. I'll add the missing parts to the wiki.

To blacklist the ATI HDMI modules, it is sufficient to blacklist the module snd-hda-intel in the MODULES array. The other 2 modules are loaded by snd-hda-intel.

Maybe now this bug can be closed. ;-)
Comment by Aaron Griffin (phrakture) - Thursday, 06 August 2009, 21:44 GMT
Curious, could you try with JUST the "snd-card-0/snd-card-1" part and then with JUST the "index=0/index=1" part. It feels like you shouldn't need both of them.
Comment by Aaron Griffin (phrakture) - Thursday, 06 August 2009, 21:52 GMT
I'm also a little curious why blacklisting the hdmi module itself causes it to still load. I will try to play around with this. As far as I can see, there is no direct dependence between the two, but they both had snd-hda-codec in common, which may possibly load other coded modules...

$ modprobe --show-depends snd-hda-intel
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-page-alloc.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/soundcore.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-timer.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-pcm.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-hwdep.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/pci/hda/snd-hda-codec.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/pci/hda/snd-hda-intel.ko

$ modprobe --show-depends snd-hda-codec-atihdmi
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-page-alloc.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/soundcore.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-timer.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-pcm.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/core/snd-hwdep.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/pci/hda/snd-hda-codec.ko
insmod /lib/modules/2.6.30-ARCH/kernel/sound/pci/hda/snd-hda-codec-atihdmi.ko
Comment by Heiko Baums (cyberpatrol) - Thursday, 06 August 2009, 23:21 GMT
With just the "snd-card-0/snd-card-1" part it doesn't work, but it works with just the "index=0/index=1" part.

I took the lines in my last comment from the "Module Autoloading Support" section in http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt, which is the first link in the wiki. And I can remember, that an older version of alsaconf puts these lines into modprobe.conf resp. modules.conf. And I can remember having read this somewhere in a documentation, possibly the "Gentoo Linux ALSA Guide". But it's not in this guide anymore.

These pages also show something similar:
http://alsa.opensrc.org/index.php/MultipleCards
http://alsa.opensrc.org/index.php/FAQ

In http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt there's also a list of ALSA modules. The only HDA module there is snd-hda-intel, which is also for ATI graphics cards. And as you've written, snd_hda_codec_atihdmi and snd_hda_codec are just codecs. The only sound card driver is snd-hda-intel. So from this point of view it makes sense, that only this module needs to be blacklisted.
Comment by Aaron Griffin (phrakture) - Friday, 07 August 2009, 00:21 GMT
In my original comment I said "Additionally, you can, and SHOULD control sound cards via the index property that the modules provide". Your solution above is what I intended with that. To use the index=0 and index=1 properties on the modules
Comment by Heiko Baums (cyberpatrol) - Friday, 07 August 2009, 00:48 GMT
But I have to admit, that I didn't know the index options yet. Anything else I could remember after reading the ALSA-Configuration.txt.
If you know a similar solution for the eventX input drivers in /dev/input and /dev/input/by-path in  FS#15828  this would be great. At least Roman had the idea, that this could be similar.
Comment by Roman Kyrylych (Romashka) - Friday, 07 August 2009, 08:22 GMT
> With just the "snd-card-0/snd-card-1" part it doesn't work, but it works with just the "index=0/index=1" part.
So please simplify the wiki section to reflect this fact.
Thank you for modifying the wiki, BTW. This is really appreciated.
Comment by Heiko Baums (cyberpatrol) - Friday, 07 August 2009, 12:31 GMT
Wiki simplified. You're welcome!
Comment by Aaron Griffin (phrakture) - Monday, 10 August 2009, 20:21 GMT
So is this now solved? The intent of removing the ordering on boot is that there are other ways (such as the index=* parameter) to handle device ordering in a more sane manner
Comment by Heiko Baums (cyberpatrol) - Monday, 10 August 2009, 20:35 GMT
This particular ALSA issue is now fixed. But consider, that not every module (e.g. cx8800 and cx8802) has an index parameter.
Comment by Aaron Griffin (phrakture) - Monday, 10 August 2009, 20:40 GMT
Let's move the discussion of that issue to the relevant report. Closing this one

Loading...