Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CX88_alsa - how to specify sound card sequence?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Thu Dec 07, 2006 9:26 pm    Post subject: CX88_alsa - how to specify sound card sequence? Reply with quote

OK - I have too many sound cards :) My motherboard provides the main sound most things use (intel8x0), then there is a motherboard MIDI "card" (mpu401), a PCI TV card (CX88_alsa), and finally a variable number of USB headphones.

What I want to do is set up ALSA so that I get the cards in this order: intel8x0, mpu401, CX88_alsa, USB (not fussed about order of USB).

I have worked out (I think) that I can set the order of the ALSA cards by putting entries in /etc/modules.d/alsa like this:
Code:
options snd-intel8x0 index=0
options snd-mpu401 index=1
options snd-usb-audio index=2
Doing that gets me a /proc/asound/cards entry (after reboot) like this
Code:
 0 [nForce2        ]: NFORCE - NVidia nForce2
                      NVidia nForce2 with ALC650F at 0xec080000, irq 11
 1 [UART           ]: MPU-401 UART - MPU-401 UART
                      MPU-401 UART at 0x330, irq 10
 2 [Phone          ]: USB-Audio - VoIPvoice USB Phone
                      PDT VoIPvoice USB Phone at usb-0000:00:02.0-2, full speed
 3 [CX8811         ]: CX88x - Conexant CX8811
                      Conexant CX8811 at 0xe9000000
What I am not sure about is what I could enter here to get the CX88 to always come in as card 2. I've had a read all of the ALSA documentation I can find, and its all *really* confusing, seeming to imply that the drivers have to have a snd- prefix.

Should it work if I just use the name of the CX88 module (so CX88-alsa maybe)?
Anyone done this with TV cards before?
Thanks
Regards
Ian

Just in case it helps somene say "you've got it all wrong" here is the full /etc/modules.d/alsa contents
Code:
# Alsa kernel modules' configuration file.

alias char-major-116 snd
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `modules-update' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##

# Attempt to control card sequence
options snd-intel8x0 index=0
options snd-mpu401 index=1
options snd-usb-audio index=2

# Sound card 0 -- PCI adapter: intel8x0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias /dev/dsp0 snd-pcm-oss

alias snd-card-0 snd-intel8x0

alias snd-slot-0 snd-card-0
alias sound-slot-0 snd-slot-0

# Sound card 1 -- Motherboard MIDI: mpu401
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
alias /dev/dsp1 snd-pcm-oss

alias snd-card-1 snd-mpu401

alias snd-slot-1 snd-card-1
alias sound-slot-1 snd-slot-1

# Sound card 2 -- USB:
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
alias /dev/dsp2 snd-pcm-oss

alias snd-card-2 snd-usb-audio

alias snd-slot-2 snd-card-2
alias sound-slot-2 snd-slot-2

# End of ALSA configuration file.
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Fri Dec 08, 2006 3:07 pm    Post subject: Reply with quote

I have experimented with the cx88-alsa module name in /etc/modules.d/alsa and it appears that I can now force the sequence of sound cards I want. The entries:
Code:
options cx88-alsa index=2
.. and ..
alias snd-card-2 cx88-alsa
appear to do the trick. I've put a full copy of the file below, just in case it helps someone, or for some ALSA guru to tear apart for me.

So far I have booted twice an get this sequence after both boots:
Code:
$ cat /proc/asound/cards
 0 [nForce2        ]: NFORCE - NVidia nForce2
                      NVidia nForce2 with ALC650F at 0xec080000, irq 11
 1 [UART           ]: MPU-401 UART - MPU-401 UART
                      MPU-401 UART at 0x330, irq 10
 2 [CX8811         ]: CX88x - Conexant CX8811
                      Conexant CX8811 at 0xe9000000
 3 [Phone          ]: USB-Audio - VoIPvoice USB Phone
                      PDT VoIPvoice USB Phone at usb-0000:00:02.0-2, full speed

Its not stayed the same over consecutive reboots before, so something must be working right.

Regards
Ian

The full /etc/modules.d/alsa:
Code:
# Alsa kernel modules' configuration file.

alias char-major-116 snd
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `modules-update' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##

# Attempt to control card sequence
options snd-intel8x0 index=0
options snd-mpu401 index=1
options cx88-alsa index=2
options snd-usb-audio index=3

# Sound card 0 -- PCI adapter: intel8x0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias /dev/dsp0 snd-pcm-oss

alias snd-card-0 snd-intel8x0

alias snd-slot-0 snd-card-0
alias sound-slot-0 snd-slot-0

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Sound card 1 -- Motherboard MIDI: mpu401
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
alias /dev/dsp1 snd-pcm-oss

alias snd-card-1 snd-mpu401

alias snd-slot-1 snd-card-1
alias sound-slot-1 snd-slot-1

# Sound card 2 -- PCI TV Card: cx88-alsa
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
alias /dev/dsp2 snd-pcm-oss

alias snd-card-2 cx88-alsa

alias snd-slot-2 snd-card-2
alias sound-slot-2 snd-slot-2

# Sound card 3 -- USB:
alias sound-service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcm-oss
alias sound-service-3-12 snd-pcm-oss
alias /dev/dsp3 snd-pcm-oss

alias snd-card-3 snd-usb-audio

alias snd-slot-3 snd-card-3
alias sound-slot-3 snd-slot-3

# End of ALSA configuration file.
Back to top
View user's profile Send private message
Bill Thompson
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2005
Posts: 139

PostPosted: Fri Dec 08, 2006 6:30 pm    Post subject: Reply with quote

I believe that for 'index' to work correctly, the drivers have to be listed in the correct order in /etc/modules.autoload.d/kernel-2.6.

I did it that way and it has worked for me: one sound card and one usb headset.
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Fri Dec 08, 2006 8:15 pm    Post subject: Reply with quote

Bill Thompson wrote:
I believe that for 'index' to work correctly, the drivers have to be listed in the correct order in /etc/modules.autoload.d/kernel-2.6.

I did it that way and it has worked for me: one sound card and one usb headset.

I have seen this said before, but I don't see how it can work with the new UDEV (103). When I boot, the sequence is:

1) udev processes events (and thus loads the modules)
2) modules-update is run
3) the contents of /etc/modules.autoload.d/kernel-2.6 are loaded

How do you stop the modules being loaded by udev? Since I started using the entries above the sound card sequence has been in the correct order - before I used them the sequence was truely random. It just looks like udev is influenced by them in some way?

Regards
Ian
Back to top
View user's profile Send private message
Bill Thompson
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jan 2005
Posts: 139

PostPosted: Sat Dec 09, 2006 12:29 am    Post subject: Reply with quote

Sorry -- I have udev-103 masked. Too many questions.
I am unaware of the fact that udev influences /etc/modules.autoload.d.
Can't help
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Sat Dec 09, 2006 1:00 am    Post subject: Reply with quote

https://forums.gentoo.org/viewtopic-t-521075-highlight-.html
That thread discusses this exact same problem.

Code:
RC_COLDPLUG="no"
RC_PLUG_SERVICES="!*"

Did the trick for me.
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Sat Dec 09, 2006 9:14 am    Post subject: Reply with quote

I have a lot of other USB devices attached to this computer, and what I have tends to vary. Up until now, I have been very happy with a combination of coldplug and hotplug, which always gave the same module loading order.

It seems now that this "improvement" in udev means that I either have to have a random loading order, or I have to manually specify all the modules I *may* have need of at load time, and thus have load failures when some of the USB devices are not plugged in when I boot.

It seems to me like a huge backward step - for what benefit?

And yet the changes I made to the /etc/modules.autoload.d. (above) have made the soundcards appear in the desired order for every boot so far (OK only about 5 boots, but I got a different order every boot before).

What is the recommended udev/coldplug/hootplug for my situation - ie unpredictable USB devices plugged at boot time - with a set sequence for multiple static sound cards?

Regards
Ian
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Sat Dec 09, 2006 1:49 pm    Post subject: Reply with quote

A bit more digging after a reboot seems to show that the order of sound module loading does not relate to the order of sound cards if you specify 'index=n' parameters on the sound modules.
I am making an assumption - that the order of a lsmod listing is the order in which the modules were loaded. Assuming that, after a clean reboot I get lsmod showing this sequence:
Code:
--- snip ---
snd_mpu401              5992  0
snd_mpu401_uart         6016  1 snd_mpu401
snd_rawmidi            17568  3 snd_seq_midi,snd_usb_lib,snd_mpu401_uart
snd_seq_device          6028  4 snd_seq_midi,snd_seq_oss,snd_seq,snd_rawmidi
parport_pc             26212  0
parport                28360  1 parport_pc
nvidia               4702804  23
snd_intel8x0           26268  2
snd_ac97_codec         83872  1 snd_intel8x0
snd_ac97_bus            2048  1 snd_ac97_codec
cx8800                 26252  0
cx88_alsa               9384  0
snd_pcm                60808  5 snd_pcm_oss,snd_usb_audio,snd_intel8x0,snd_ac97_codec,cx88_alsa
cx88xx                 56740  2 cx8800,cx88_alsa
aic7xxx               153432  0
snd_timer              16644  2 snd_seq,snd_pcm
compat_ioctl32          1152  1 cx8800
ir_common              25860  1 cx88xx
tveeprom               12560  1 cx88xx
videodev               23168  2 cx8800,cx88xx
v4l2_common            20864  3 tuner,cx8800,videodev
v4l1_compat            11652  2 cx8800,videodev
video_buf              18308  3 cx8800,cx88_alsa,cx88xx
snd                    39268  19 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_usb_audio,snd_hwdep,snd_mpu401,
snd_mpu401_uart,snd_rawmidi,snd_seq_device,snd_intel8x0,snd_ac97_codec,cx88_alsa,snd_pcm,snd_timer
--- snip ---

and the sound cards in this sequence
Code:
$ cat /proc/asound/cards
 0 [nForce2        ]: NFORCE - NVidia nForce2
                      NVidia nForce2 with ALC650F at 0xec080000, irq 11
 1 [UART           ]: MPU-401 UART - MPU-401 UART
                      MPU-401 UART at 0x330, irq 10
 2 [CX8811         ]: CX88x - Conexant CX8811
                      Conexant CX8811 at 0xe9000000
 3 [Phone          ]: USB-Audio - VoIPvoice USB Phone
                      PDT VoIPvoice USB Phone at usb-0000:00:02.0-2, full speed

In the lsmod listing, it appears that cx88_alsa is loaded before snd_intel8x0 and yet the card sequence follows my index settings
Code:
options snd-intel8x0 index=0
options snd-mpu401 index=1
options cx88-alsa index=2
options snd-usb-audio index=3


I'm sure I don't know enough to say anything for sure, but it does seem that the module load order and the ALSA card sequence are not tied together.

Regards
Ian
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Wed Feb 14, 2007 3:46 pm    Post subject: Reply with quote

An Update: There is now a reasonably clean way to force module loading order at boot time. I found it by following this bug thread: https://bugs.gentoo.org/show_bug.cgi?id=130766

To get my card loading order to work I did this:

I created a file called /etc/modprobe.d/blacklist containing the following:
Code:
blacklist snd-intel8x0
blacklist snd-mpu401
blacklist cx8800
blacklist cx88-alsa
blacklist snd-usb-audio

I then ran modules-update to create the /etc/modprobe.conf and /etc/modules.conf files

Then, I placed the following in the file /etc/modules.autoload.d/kernel-2.6
Code:
snd-intel8x0
snd-mpu401
cx8800
cx88-alsa
snd-usb-audio


Then a reboot. Examining both dmesg and lsmod afterwards, the modules were loaded in the sequence I defined in /etc/modules.autoload.d/kernel-2.6

For this to work you have to have
Code:
>=udev-104-r11
>=sys-apps/baselayout-1.12.7-r2
>=sys-apps/module-init-tools-3.2.2-r2


I picked up the final part of this puzzle this morning, so this is the first time that udev blacklisting works for me :-).

As of sys-fs/udev-104-r11 I also get a useful listing on boot up of which modules udev is loading for me, so that helps with making the blacklist/autoload be what you want.

Hope this helps someone.
Regards
Ian
Back to top
View user's profile Send private message
Yak
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2002
Posts: 107

PostPosted: Fri Feb 16, 2007 8:29 pm    Post subject: Reply with quote

My sound card order got messed up too, probably by updating udev to 104-r11. Your info helped me out a bit, thanks. Heres where I'm at now..

from /etc/modules.d/alsa
Code:

alias snd-card-0 snd-cmipci
alias sound-slot-0 snd-cmipci

alias snd-card-1 snd-intel8x0
alias sound-slot-1 snd-intel8x0

options snd-cmipci index=0
options snd-intel8x0 index=1


Code:

cat /proc/asound/cards
 0 [CMI8738MC8     ]: CMI8738-MC8 - C-Media PCI CMI8738-MC8
                      C-Media PCI CMI8738-MC8 (model 68) at 0xa800, irq 66
 1 [CK804          ]: NFORCE - NVidia CK804
                      NVidia CK804 with ALC655 at 0xfebfd000, irq 233
 2 [CX8801         ]: CX88x - Conexant CX8801
                      Conexant CX8801 at 0xfb000000


I'm not sure what the cx88 is for, but this seems to work fine and in the correct order. What I don't get is why you would need to mess with the module loading order and blacklisting? As long as alsa has the cards in the correct order why are we caring about the order the modules load?
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Fri Feb 16, 2007 9:34 pm    Post subject: Reply with quote

Yak wrote:

I'm not sure what the cx88 is for, but this seems to work fine and in the correct order. What I don't get is why you would need to mess with the module loading order and blacklisting? As long as alsa has the cards in the correct order why are we caring about the order the modules load?


I would guess that you have CX88 because you have a TV card with that chip - the V4L drivers will load the ALSA driver for it if they recognize the chip.

The module order thing is part me mixing up two problems, and part because of previous posts.
I also have three possible network cards, and the order those load in determines which one gets eth0, eth1 or eth2. So I mixed the sound card sequence up with solving that.
However, I also found many other posts that said the index=n options didn't work if the cards were not loaded in the correct sequence. My experience (and yours) is otherwise, but I was just so pleased I had finally cracked the loading order I just went overboard and applied it to everything :) .

It seems now that people with more than one sound card have two options: either force the loading sequence, or create modprobe options to set index=n. Doing both does no harm - apparently.

Regards
Ian
Back to top
View user's profile Send private message
Yak
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2002
Posts: 107

PostPosted: Sat Feb 17, 2007 3:15 am    Post subject: Reply with quote

Yeah I'm running mythtv, sort of. Just getting it all set up again after my other computer went nuts and kept locking up; it was the motherboard going bad i think. Anyway I'm glad the sound card order works without having to mess with udev. Actually I even commented out everything in /etc/modules.autoload.d/kernel-2.6 because udev is loading them all automatically now.

About the networking order, you might want to have a look at /etc/udev/rules.d/70-persistent-net.rules
I haven't had the need to mess with it yet, but it looks like you may be able to assign the name to the mac address.

The only thing that bugs me about the networking is how udev now loads the module for eth1 and tries to do dhcp when there is no cable connected. I just set it to timeout really quick for now.
Back to top
View user's profile Send private message
Yak
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2002
Posts: 107

PostPosted: Wed Feb 21, 2007 7:34 am    Post subject: Reply with quote

Just wanted to add that after several reboots I've discovered that the order is still not consistent.. actually the card that I had set to index=0 sometimes failed to show up in /proc/asound/cards. According to this the index must be set for all drivers that get loaded, so I have added the index for the cx88 to /etc/modules.d/alsa

Code:
alias snd-card-0 snd-cmipci
alias sound-slot-0 snd-cmipci

alias snd-card-1 snd-intel8x0
alias sound-slot-1 snd-intel8x0

options snd-cmipci index=0
options snd-intel8x0 index=1
options cx88_alsa index=2

Hopefully this fixes it for good, will have to keep an eye on it after reboots for awhile.
Back to top
View user's profile Send private message
ipic
Guru
Guru


Joined: 29 Dec 2003
Posts: 377
Location: UK

PostPosted: Wed Feb 21, 2007 7:41 am    Post subject: Reply with quote

Yak wrote:
According to this the index must be set for all drivers that get loaded, so I have added the index for the cx88 to /etc/modules.d/alsa


That reference to alsa documentation you give also solves the load order vs index order question:
Quote:
If you set index=0 on one driver module, another driver module might get loaded first and become card number 0 regardless. But if you load two driver modules and one has index=0 and the other has index=1, they will take the respective positions no matter in which order they are loaded.


That looks pretty definitive to me.
Regards
Ian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum