Skip to contentSkip to conversation

Controlling the cards order

DISCUSSION Olivier Langlois 2 participants 3 messages Mar 6, 2014 – Mar 7, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

I have added a second sound device in my system and it unexpectedly took the first card slot.

I have found that it is easy to control the order as long as the devices use different drivers by modifying

/etc/modprobe.d/alsa.conf

( http://alsa.opensrc.org/MultipleCards )

but in my situation I have 2 different devices using the same driver. I think that there is hope that I find an answer by digging the more general topic of ordering PCI devices drivers loading but if someone has few pointers to share, any help is welcome!

Here are my 2 devices that I would like to change the order:

lano1106@whippet2 /proc/asound $ cat cards
0 [PCH ]: HDA-Intel - HDA Intel PCH

                      HDA Intel PCH at 0xfbf20000 irq 84
 1 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xfbe60000 irq 88

thank you for your time,
Olivier

#1 lore raw
Quoted 17 lines · Olivier Langlois

Hi,

I have added a second sound device in my system and it unexpectedly took the first card slot.

I have found that it is easy to control the order as long as the devices use different drivers by modifying

/etc/modprobe.d/alsa.conf

( http://alsa.opensrc.org/MultipleCards )

but in my situation I have 2 different devices using the same driver. I think that there is hope that I find an answer by digging the more general topic of ordering PCI devices drivers loading but if someone has few pointers to share, any help is welcome!

Quoted 7 lines

Here are my 2 devices that I would like to change the order:

lano1106@whippet2 /proc/asound $ cat cards
0 [PCH ]: HDA-Intel - HDA Intel PCH

                      HDA Intel PCH at 0xfbf20000 irq 84
 1 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xfbe60000 irq 88

I love Linux for allowing almost anything imaginable!

in the kernel command line, I added the following:

1.

pci-stub.ids=1002:aaa0,8086:1d20

2.

Create a systemd service

/usr/lib/systemd/system/snd_hda_intel-bind.service:

[Unit]
Description=Binds PCI Audio devices to snd_hda_intel in the specified order
After=syslog.target

[Service]
EnvironmentFile=-/etc/snd_hda_intel.cfg
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/snd_hda_intel-bind $DEVICES

[Install]
WantedBy=multi-user.target

3.

/etc/snd_hda_intel.cfg:

DEVICES="0000:01:00.1 0000:00:1b.0"

4.

/usr/bin/snd_hda_intel-bind:

#!/bin/bash

modprobe snd_hda_intel

for var in "$@"; do
if [ -e /sys/bus/pci/devices/$var/driver ]; then
echo $var > /sys/bus/pci/devices/$var/driver/unbind
fi
echo $var > /sys/bus/pci/drivers/snd_hda_intel/bind
done

Result:

lano1106@whippet2 /proc/asound :( $ cat cards
0 [HDMI ]: HDA-Intel - HDA ATI HDMI

                      HDA ATI HDMI at 0xfbe60000 irq 87
 1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xfbf20000 irq 88

tadam!

#2 lore raw
In reply to Olivier Langlois

At Thu, 06 Mar 2014 12:42:14 -0500,

Quoted 18 lines · Olivier Langlois

Hi,

I have added a second sound device in my system and it unexpectedly took the first card slot.

I have found that it is easy to control the order as long as the devices use different drivers by modifying

/etc/modprobe.d/alsa.conf

( http://alsa.opensrc.org/MultipleCards )

but in my situation I have 2 different devices using the same driver. I think that there is hope that I find an answer by digging the more general topic of ordering PCI devices drivers loading but if someone has few pointers to share, any help is welcome!

Quoted 7 lines

Here are my 2 devices that I would like to change the order:

lano1106@whippet2 /proc/asound $ cat cards
0 [PCH ]: HDA-Intel - HDA Intel PCH

                      HDA Intel PCH at 0xfbf20000 irq 84
 1 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xfbe60000 irq 88

You can pass index=1,0 option to snd-hda-intel module.

Takashi