diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2005-05-21 16:35:58 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:11:35 -0400 |
commit | 1baa705b75124df7cfe3d5d2706f794a14d26ad0 (patch) | |
tree | fb3e4a81c53a52caa33ee27426716360e5e5dc68 /sound/pci/ca0106/ca0106_main.c | |
parent | 8f55fbb0fdb821023ff0a816ebf5056188891ff0 (diff) |
[ALSA] Tidy up card recognition.
CA0106 driver
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Diffstat (limited to 'sound/pci/ca0106/ca0106_main.c')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 90d493ca7c99..a56e68ea87bc 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -161,18 +161,29 @@ MODULE_PARM_DESC(enable, "Enable the CA0106 soundcard."); | |||
161 | 161 | ||
162 | #include "ca0106.h" | 162 | #include "ca0106.h" |
163 | 163 | ||
164 | typedef struct { | 164 | static ca0106_details_t ca0106_chip_details[] = { |
165 | u32 serial; | 165 | /* AudigyLS[SB0310] */ |
166 | char * name; | 166 | { .serial = 0x10021102, |
167 | } ca0106_names_t; | 167 | .name = "AudigyLS [SB0310]", |
168 | 168 | .ac97 = 1 } , | |
169 | static ca0106_names_t ca0106_chip_names[] = { | 169 | /* Unknown AudigyLS that also says SB0310 on it */ |
170 | { 0x10021102, "AudigyLS [SB0310]"} , | 170 | { .serial = 0x10051102, |
171 | { 0x10051102, "AudigyLS [SB0310b]"} , /* Unknown AudigyLS that also says SB0310 on it */ | 171 | .name = "AudigyLS [SB0310b]", |
172 | { 0x10061102, "Live! 7.1 24bit [SB0410]"} , /* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */ | 172 | .ac97 = 1 } , |
173 | { 0x10071102, "Live! 7.1 24bit [SB0413]"} , /* New Dell Sound Blaster Live! 7.1 24bit. This does not have an AC97. */ | 173 | /* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */ |
174 | { 0x10091462, "MSI K8N Diamond MB [SB0438]"}, /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */ | 174 | { .serial = 0x10061102, |
175 | { 0, "AudigyLS [Unknown]" } | 175 | .name = "Live! 7.1 24bit [SB0410]", |
176 | .gpio_type = 1 } , | ||
177 | /* New Dell Sound Blaster Live! 7.1 24bit. This does not have an AC97. */ | ||
178 | { .serial = 0x10071102, | ||
179 | .name = "Live! 7.1 24bit [SB0413]", | ||
180 | .gpio_type = 1 } , | ||
181 | /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */ | ||
182 | { .serial = 0x10091462, | ||
183 | .name = "MSI K8N Diamond MB [SB0438]", | ||
184 | .gpio_type = 1 } , | ||
185 | { .serial = 0, | ||
186 | .name = "AudigyLS [Unknown]" } | ||
176 | }; | 187 | }; |
177 | 188 | ||
178 | /* hardware definition */ | 189 | /* hardware definition */ |
@@ -994,6 +1005,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card, | |||
994 | ca0106_t **rchip) | 1005 | ca0106_t **rchip) |
995 | { | 1006 | { |
996 | ca0106_t *chip; | 1007 | ca0106_t *chip; |
1008 | ca0106_details_t *c; | ||
997 | int err; | 1009 | int err; |
998 | int ch; | 1010 | int ch; |
999 | static snd_device_ops_t ops = { | 1011 | static snd_device_ops_t ops = { |
@@ -1055,6 +1067,15 @@ static int __devinit snd_ca0106_create(snd_card_t *card, | |||
1055 | printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, | 1067 | printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, |
1056 | chip->revision, chip->serial); | 1068 | chip->revision, chip->serial); |
1057 | #endif | 1069 | #endif |
1070 | strcpy(card->driver, "CA0106"); | ||
1071 | strcpy(card->shortname, "CA0106"); | ||
1072 | |||
1073 | for (c=ca0106_chip_details; c->serial; c++) { | ||
1074 | if (c->serial == chip->serial) break; | ||
1075 | } | ||
1076 | chip->details = c; | ||
1077 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
1078 | c->name, chip->port, chip->irq); | ||
1058 | 1079 | ||
1059 | outl(0, chip->port + INTE); | 1080 | outl(0, chip->port + INTE); |
1060 | 1081 | ||
@@ -1139,9 +1160,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card, | |||
1139 | snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */ | 1160 | snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */ |
1140 | chip->capture_source = 3; /* Set CAPTURE_SOURCE */ | 1161 | chip->capture_source = 3; /* Set CAPTURE_SOURCE */ |
1141 | 1162 | ||
1142 | if ((chip->serial == 0x10061102) || | 1163 | if (chip->details->gpio_type == 1) { /* The SB0410 and SB0413 use GPIO differently. */ |
1143 | (chip->serial == 0x10071102) || | ||
1144 | (chip->serial == 0x10091462)) { /* The SB0410 and SB0413 use GPIO differently. */ | ||
1145 | /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */ | 1164 | /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */ |
1146 | outl(0x0, chip->port+GPIO); | 1165 | outl(0x0, chip->port+GPIO); |
1147 | //outl(0x00f0e000, chip->port+GPIO); /* Analog */ | 1166 | //outl(0x00f0e000, chip->port+GPIO); /* Analog */ |
@@ -1173,7 +1192,6 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1173 | static int dev; | 1192 | static int dev; |
1174 | snd_card_t *card; | 1193 | snd_card_t *card; |
1175 | ca0106_t *chip; | 1194 | ca0106_t *chip; |
1176 | ca0106_names_t *c; | ||
1177 | int err; | 1195 | int err; |
1178 | 1196 | ||
1179 | if (dev >= SNDRV_CARDS) | 1197 | if (dev >= SNDRV_CARDS) |
@@ -1208,9 +1226,7 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1208 | snd_card_free(card); | 1226 | snd_card_free(card); |
1209 | return err; | 1227 | return err; |
1210 | } | 1228 | } |
1211 | if ((chip->serial != 0x10061102) && | 1229 | if (chip->details->ac97 == 1) { /* The SB0410 and SB0413 do not have an AC97 chip. */ |
1212 | (chip->serial != 0x10071102) && | ||
1213 | (chip->serial != 0x10091462) ) { /* The SB0410 and SB0413 do not have an ac97 chip. */ | ||
1214 | if ((err = snd_ca0106_ac97(chip)) < 0) { | 1230 | if ((err = snd_ca0106_ac97(chip)) < 0) { |
1215 | snd_card_free(card); | 1231 | snd_card_free(card); |
1216 | return err; | 1232 | return err; |
@@ -1223,15 +1239,6 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1223 | 1239 | ||
1224 | snd_ca0106_proc_init(chip); | 1240 | snd_ca0106_proc_init(chip); |
1225 | 1241 | ||
1226 | strcpy(card->driver, "CA0106"); | ||
1227 | strcpy(card->shortname, "CA0106"); | ||
1228 | |||
1229 | for (c=ca0106_chip_names; c->serial; c++) { | ||
1230 | if (c->serial == chip->serial) break; | ||
1231 | } | ||
1232 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
1233 | c->name, chip->port, chip->irq); | ||
1234 | |||
1235 | if ((err = snd_card_register(card)) < 0) { | 1242 | if ((err = snd_card_register(card)) < 0) { |
1236 | snd_card_free(card); | 1243 | snd_card_free(card); |
1237 | return err; | 1244 | return err; |