diff options
author | Adrian Knoth <adi@drcomp.erfurt.thur.de> | 2012-01-10 20:58:40 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-01-11 08:55:58 +0100 |
commit | f7de8ba3fcf19487d2f0af9aee0c510fc79efa15 (patch) | |
tree | 422003d6891ef94c6a2c57de625f3dbc8f24c97c /sound/pci/rme9652 | |
parent | ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info() (diff) | |
download | linux-f7de8ba3fcf19487d2f0af9aee0c510fc79efa15.tar.xz linux-f7de8ba3fcf19487d2f0af9aee0c510fc79efa15.zip |
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>
Diffstat (limited to 'sound/pci/rme9652')
-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, tasklet_init(&hdspm->midi_tasklet, hdspm_midi_tasklet, (unsigned long) hdspm); + + if (hdspm->io_type != MADIface) { + hdspm->serial = (hdspm_read(hdspm, + HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; + /* id contains either a user-provided value or the default + * NULL. If it's the default, we're safe to + * fill card->id with the serial number. + * + * If the serial number is 0xFFFFFF, then we're dealing with + * an old PCI revision that comes without a sane number. In + * this case, we don't set card->id to avoid collisions + * when running with multiple cards. + */ + if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { + sprintf(card->id, "HDSPMx%06x", hdspm->serial); + snd_card_set_id(card, card->id); + } + } + snd_printdd("create alsa devices.\n"); err = snd_hdspm_create_alsa_devices(card, hdspm); if (err < 0) @@ -6867,8 +6886,6 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, } if (hdspm->io_type != MADIface) { - hdspm->serial = (hdspm_read(hdspm, - HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; sprintf(card->shortname, "%s_%x", hdspm->card_name, hdspm->serial); |