[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>

authored by James Courtier-Dutton and committed by Jaroslav Kysela e66bc8b2 2201987c

+23 -9
+1
include/sound/emu10k1.h
··· 1167 unsigned short extout_mask, 1168 long max_cache_bytes, 1169 int enable_ir, 1170 emu10k1_t ** remu); 1171 1172 int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
··· 1167 unsigned short extout_mask, 1168 long max_cache_bytes, 1169 int enable_ir, 1170 + uint subsystem, 1171 emu10k1_t ** remu); 1172 1173 int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm);
+4 -2
sound/pci/emu10k1/emu10k1.c
··· 52 static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 53 static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 54 static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 55 56 module_param_array(index, int, NULL, 0444); 57 MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); ··· 72 MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); 73 module_param_array(enable_ir, bool, NULL, 0444); 74 MODULE_PARM_DESC(enable_ir, "Enable IR."); 75 - 76 /* 77 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 78 */ ··· 124 max_buffer_size[dev] = 1024; 125 if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], 126 (long)max_buffer_size[dev] * 1024 * 1024, 127 - enable_ir[dev], 128 &emu)) < 0) { 129 snd_card_free(card); 130 return err;
··· 52 static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 53 static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 54 static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 55 + static uint subsystem[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* Force card subsystem model */ 56 57 module_param_array(index, int, NULL, 0444); 58 MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); ··· 71 MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); 72 module_param_array(enable_ir, bool, NULL, 0444); 73 MODULE_PARM_DESC(enable_ir, "Enable IR."); 74 + module_param_array(subsystem, uint, NULL, 0444); 75 + MODULE_PARM_DESC(subsystem, "Force card subsystem model."); 76 /* 77 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 78 */ ··· 122 max_buffer_size[dev] = 1024; 123 if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], 124 (long)max_buffer_size[dev] * 1024 * 1024, 125 + enable_ir[dev], subsystem[dev], 126 &emu)) < 0) { 127 snd_card_free(card); 128 return err;
+18 -7
sound/pci/emu10k1/emu10k1_main.c
··· 832 unsigned short extout_mask, 833 long max_cache_bytes, 834 int enable_ir, 835 emu10k1_t ** remu) 836 { 837 emu10k1_t *emu; ··· 878 879 for (c = emu_chip_details; c->vendor; c++) { 880 if (c->vendor == pci->vendor && c->device == pci->device) { 881 - if (c->subsystem && c->subsystem != emu->serial) 882 - continue; 883 - if (c->revision && c->revision != emu->revision) 884 - continue; 885 break; 886 } 887 } ··· 898 return -ENOENT; 899 } 900 emu->card_capabilities = c; 901 - if (c->subsystem != 0) 902 snd_printdd("Sound card name=%s\n", c->name); 903 - else 904 - snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x\n", c->name, pci->vendor, pci->device, emu->serial); 905 906 if (!*card->id && c->id) { 907 int i, n = 0;
··· 832 unsigned short extout_mask, 833 long max_cache_bytes, 834 int enable_ir, 835 + uint subsystem, 836 emu10k1_t ** remu) 837 { 838 emu10k1_t *emu; ··· 877 878 for (c = emu_chip_details; c->vendor; c++) { 879 if (c->vendor == pci->vendor && c->device == pci->device) { 880 + if (subsystem) { 881 + if (c->subsystem && (c->subsystem == subsystem) ) { 882 + break; 883 + } else continue; 884 + } else { 885 + if (c->subsystem && (c->subsystem != emu->serial) ) 886 + continue; 887 + if (c->revision && c->revision != emu->revision) 888 + continue; 889 + } 890 break; 891 } 892 } ··· 891 return -ENOENT; 892 } 893 emu->card_capabilities = c; 894 + if (c->subsystem && !subsystem) 895 snd_printdd("Sound card name=%s\n", c->name); 896 + else if (subsystem) 897 + snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n", 898 + c->name, pci->vendor, pci->device, emu->serial, c->subsystem); 899 + else 900 + snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n", 901 + c->name, pci->vendor, pci->device, emu->serial); 902 903 if (!*card->id && c->id) { 904 int i, n = 0;