[ALSA] emu10k1: Add module option uint subsystem.

EMU10K1/EMU10K2 driver
It allows the user to force the snd-emu10k1 module to think the user
has a particular sound card. Useful if their particular sound card
is not yet recognised.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
This commit is contained in:
James Courtier-Dutton 2005-07-06 22:21:51 +02:00 committed by Jaroslav Kysela
parent 2201987c56
commit e66bc8b2a7
3 changed files with 23 additions and 9 deletions

View file

@ -1167,6 +1167,7 @@ int snd_emu10k1_create(snd_card_t * card,
unsigned short extout_mask, unsigned short extout_mask,
long max_cache_bytes, long max_cache_bytes,
int enable_ir, int enable_ir,
uint subsystem,
emu10k1_t ** remu); emu10k1_t ** remu);
int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);

View file

@ -52,6 +52,7 @@ static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
static uint subsystem[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* Force card subsystem model */
module_param_array(index, int, NULL, 0444); module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");
@ -71,7 +72,8 @@ module_param_array(max_buffer_size, int, NULL, 0444);
MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB.");
module_param_array(enable_ir, bool, NULL, 0444); module_param_array(enable_ir, bool, NULL, 0444);
MODULE_PARM_DESC(enable_ir, "Enable IR."); MODULE_PARM_DESC(enable_ir, "Enable IR.");
module_param_array(subsystem, uint, NULL, 0444);
MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
/* /*
* Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400
*/ */
@ -122,7 +124,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
max_buffer_size[dev] = 1024; max_buffer_size[dev] = 1024;
if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
(long)max_buffer_size[dev] * 1024 * 1024, (long)max_buffer_size[dev] * 1024 * 1024,
enable_ir[dev], enable_ir[dev], subsystem[dev],
&emu)) < 0) { &emu)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;

View file

@ -832,6 +832,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
unsigned short extout_mask, unsigned short extout_mask,
long max_cache_bytes, long max_cache_bytes,
int enable_ir, int enable_ir,
uint subsystem,
emu10k1_t ** remu) emu10k1_t ** remu)
{ {
emu10k1_t *emu; emu10k1_t *emu;
@ -877,10 +878,16 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
for (c = emu_chip_details; c->vendor; c++) { for (c = emu_chip_details; c->vendor; c++) {
if (c->vendor == pci->vendor && c->device == pci->device) { if (c->vendor == pci->vendor && c->device == pci->device) {
if (c->subsystem && c->subsystem != emu->serial) if (subsystem) {
continue; if (c->subsystem && (c->subsystem == subsystem) ) {
if (c->revision && c->revision != emu->revision) break;
continue; } else continue;
} else {
if (c->subsystem && (c->subsystem != emu->serial) )
continue;
if (c->revision && c->revision != emu->revision)
continue;
}
break; break;
} }
} }
@ -891,10 +898,14 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
return -ENOENT; return -ENOENT;
} }
emu->card_capabilities = c; emu->card_capabilities = c;
if (c->subsystem != 0) if (c->subsystem && !subsystem)
snd_printdd("Sound card name=%s\n", c->name); snd_printdd("Sound card name=%s\n", c->name);
else else if (subsystem)
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x\n", c->name, pci->vendor, pci->device, emu->serial); snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n",
c->name, pci->vendor, pci->device, emu->serial, c->subsystem);
else
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n",
c->name, pci->vendor, pci->device, emu->serial);
if (!*card->id && c->id) { if (!*card->id && c->id) {
int i, n = 0; int i, n = 0;