diff options
author | Adrian Knoth <adi@drcomp.erfurt.thur.de> | 2012-01-10 14:58:40 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-01-11 02:55:58 -0500 |
commit | f7de8ba3fcf19487d2f0af9aee0c510fc79efa15 (patch) | |
tree | 422003d6891ef94c6a2c57de625f3dbc8f24c97c | |
parent | 74eeb141d3bdf5a9a65c84dd637c41f12c40f41c (diff) |
ALSA: hdspm - Provide unique driver id based on card serial
Before, /proc/asound looked like this:
2 [Default ]: HDSPM - RME RayDAT_f1cd85
RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18
In case of a second HDSPM card, its name would be Default_1. This is
cumbersome, because the order of the cards isn't stable across reboots.
To help userspace tools referring to the correct card, this commit
provides a unique id for each card:
2 [HDSPMxf1cd85 ]: HDSPM - RME RayDAT_f1cd85
RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18
In this example, userspace (configuration files) would then use
hw:HDSPMxf1cd85 to choose the right card.
The serial is masked to 24bits, so this string is always shorter than
sixteen chars.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 16092538e0bb..cc9f6c83d661 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -6783,6 +6783,25 @@ static int __devinit snd_hdspm_create(struct snd_card *card, | |||
6783 | tasklet_init(&hdspm->midi_tasklet, | 6783 | tasklet_init(&hdspm->midi_tasklet, |
6784 | hdspm_midi_tasklet, (unsigned long) hdspm); | 6784 | hdspm_midi_tasklet, (unsigned long) hdspm); |
6785 | 6785 | ||
6786 | |||
6787 | if (hdspm->io_type != MADIface) { | ||
6788 | hdspm->serial = (hdspm_read(hdspm, | ||
6789 | HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; | ||
6790 | /* id contains either a user-provided value or the default | ||
6791 | * NULL. If it's the default, we're safe to | ||
6792 | * fill card->id with the serial number. | ||
6793 | * | ||
6794 | * If the serial number is 0xFFFFFF, then we're dealing with | ||
6795 | * an old PCI revision that comes without a sane number. In | ||
6796 | * this case, we don't set card->id to avoid collisions | ||
6797 | * when running with multiple cards. | ||
6798 | */ | ||
6799 | if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { | ||
6800 | sprintf(card->id, "HDSPMx%06x", hdspm->serial); | ||
6801 | snd_card_set_id(card, card->id); | ||
6802 | } | ||
6803 | } | ||
6804 | |||
6786 | snd_printdd("create alsa devices.\n"); | 6805 | snd_printdd("create alsa devices.\n"); |
6787 | err = snd_hdspm_create_alsa_devices(card, hdspm); | 6806 | err = snd_hdspm_create_alsa_devices(card, hdspm); |
6788 | if (err < 0) | 6807 | if (err < 0) |
@@ -6867,8 +6886,6 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, | |||
6867 | } | 6886 | } |
6868 | 6887 | ||
6869 | if (hdspm->io_type != MADIface) { | 6888 | if (hdspm->io_type != MADIface) { |
6870 | hdspm->serial = (hdspm_read(hdspm, | ||
6871 | HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; | ||
6872 | sprintf(card->shortname, "%s_%x", | 6889 | sprintf(card->shortname, "%s_%x", |
6873 | hdspm->card_name, | 6890 | hdspm->card_name, |
6874 | hdspm->serial); | 6891 | hdspm->serial); |