[ALSA] Tidy up card recognition.
CA0106 driver Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
This commit is contained in:
committed by
Jaroslav Kysela
parent
8f55fbb0fd
commit
1baa705b75
@@ -508,9 +508,17 @@ struct snd_ca0106_pcm {
|
|||||||
unsigned short running;
|
unsigned short running;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u32 serial;
|
||||||
|
char * name;
|
||||||
|
int ac97;
|
||||||
|
int gpio_type;
|
||||||
|
} ca0106_details_t;
|
||||||
|
|
||||||
// definition of the chip-specific record
|
// definition of the chip-specific record
|
||||||
struct snd_ca0106 {
|
struct snd_ca0106 {
|
||||||
snd_card_t *card;
|
snd_card_t *card;
|
||||||
|
ca0106_details_t *details;
|
||||||
struct pci_dev *pci;
|
struct pci_dev *pci;
|
||||||
|
|
||||||
unsigned long port;
|
unsigned long port;
|
||||||
|
@@ -161,18 +161,29 @@ MODULE_PARM_DESC(enable, "Enable the CA0106 soundcard.");
|
|||||||
|
|
||||||
#include "ca0106.h"
|
#include "ca0106.h"
|
||||||
|
|
||||||
typedef struct {
|
static ca0106_details_t ca0106_chip_details[] = {
|
||||||
u32 serial;
|
/* AudigyLS[SB0310] */
|
||||||
char * name;
|
{ .serial = 0x10021102,
|
||||||
} ca0106_names_t;
|
.name = "AudigyLS [SB0310]",
|
||||||
|
.ac97 = 1 } ,
|
||||||
static ca0106_names_t ca0106_chip_names[] = {
|
/* Unknown AudigyLS that also says SB0310 on it */
|
||||||
{ 0x10021102, "AudigyLS [SB0310]"} ,
|
{ .serial = 0x10051102,
|
||||||
{ 0x10051102, "AudigyLS [SB0310b]"} , /* Unknown AudigyLS that also says SB0310 on it */
|
.name = "AudigyLS [SB0310b]",
|
||||||
{ 0x10061102, "Live! 7.1 24bit [SB0410]"} , /* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */
|
.ac97 = 1 } ,
|
||||||
{ 0x10071102, "Live! 7.1 24bit [SB0413]"} , /* New Dell Sound Blaster Live! 7.1 24bit. This does not have an AC97. */
|
/* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */
|
||||||
{ 0x10091462, "MSI K8N Diamond MB [SB0438]"}, /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */
|
{ .serial = 0x10061102,
|
||||||
{ 0, "AudigyLS [Unknown]" }
|
.name = "Live! 7.1 24bit [SB0410]",
|
||||||
|
.gpio_type = 1 } ,
|
||||||
|
/* New Dell Sound Blaster Live! 7.1 24bit. This does not have an AC97. */
|
||||||
|
{ .serial = 0x10071102,
|
||||||
|
.name = "Live! 7.1 24bit [SB0413]",
|
||||||
|
.gpio_type = 1 } ,
|
||||||
|
/* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */
|
||||||
|
{ .serial = 0x10091462,
|
||||||
|
.name = "MSI K8N Diamond MB [SB0438]",
|
||||||
|
.gpio_type = 1 } ,
|
||||||
|
{ .serial = 0,
|
||||||
|
.name = "AudigyLS [Unknown]" }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* hardware definition */
|
/* hardware definition */
|
||||||
@@ -994,6 +1005,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
|
|||||||
ca0106_t **rchip)
|
ca0106_t **rchip)
|
||||||
{
|
{
|
||||||
ca0106_t *chip;
|
ca0106_t *chip;
|
||||||
|
ca0106_details_t *c;
|
||||||
int err;
|
int err;
|
||||||
int ch;
|
int ch;
|
||||||
static snd_device_ops_t ops = {
|
static snd_device_ops_t ops = {
|
||||||
@@ -1055,6 +1067,15 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
|
|||||||
printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
|
printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
|
||||||
chip->revision, chip->serial);
|
chip->revision, chip->serial);
|
||||||
#endif
|
#endif
|
||||||
|
strcpy(card->driver, "CA0106");
|
||||||
|
strcpy(card->shortname, "CA0106");
|
||||||
|
|
||||||
|
for (c=ca0106_chip_details; c->serial; c++) {
|
||||||
|
if (c->serial == chip->serial) break;
|
||||||
|
}
|
||||||
|
chip->details = c;
|
||||||
|
sprintf(card->longname, "%s at 0x%lx irq %i",
|
||||||
|
c->name, chip->port, chip->irq);
|
||||||
|
|
||||||
outl(0, chip->port + INTE);
|
outl(0, chip->port + INTE);
|
||||||
|
|
||||||
@@ -1139,9 +1160,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
|
|||||||
snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */
|
snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */
|
||||||
chip->capture_source = 3; /* Set CAPTURE_SOURCE */
|
chip->capture_source = 3; /* Set CAPTURE_SOURCE */
|
||||||
|
|
||||||
if ((chip->serial == 0x10061102) ||
|
if (chip->details->gpio_type == 1) { /* The SB0410 and SB0413 use GPIO differently. */
|
||||||
(chip->serial == 0x10071102) ||
|
|
||||||
(chip->serial == 0x10091462)) { /* The SB0410 and SB0413 use GPIO differently. */
|
|
||||||
/* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */
|
/* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */
|
||||||
outl(0x0, chip->port+GPIO);
|
outl(0x0, chip->port+GPIO);
|
||||||
//outl(0x00f0e000, chip->port+GPIO); /* Analog */
|
//outl(0x00f0e000, chip->port+GPIO); /* Analog */
|
||||||
@@ -1173,7 +1192,6 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
|
|||||||
static int dev;
|
static int dev;
|
||||||
snd_card_t *card;
|
snd_card_t *card;
|
||||||
ca0106_t *chip;
|
ca0106_t *chip;
|
||||||
ca0106_names_t *c;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (dev >= SNDRV_CARDS)
|
if (dev >= SNDRV_CARDS)
|
||||||
@@ -1208,9 +1226,7 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
|
|||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if ((chip->serial != 0x10061102) &&
|
if (chip->details->ac97 == 1) { /* The SB0410 and SB0413 do not have an AC97 chip. */
|
||||||
(chip->serial != 0x10071102) &&
|
|
||||||
(chip->serial != 0x10091462) ) { /* The SB0410 and SB0413 do not have an ac97 chip. */
|
|
||||||
if ((err = snd_ca0106_ac97(chip)) < 0) {
|
if ((err = snd_ca0106_ac97(chip)) < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
return err;
|
return err;
|
||||||
@@ -1223,15 +1239,6 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
|
|||||||
|
|
||||||
snd_ca0106_proc_init(chip);
|
snd_ca0106_proc_init(chip);
|
||||||
|
|
||||||
strcpy(card->driver, "CA0106");
|
|
||||||
strcpy(card->shortname, "CA0106");
|
|
||||||
|
|
||||||
for (c=ca0106_chip_names; c->serial; c++) {
|
|
||||||
if (c->serial == chip->serial) break;
|
|
||||||
}
|
|
||||||
sprintf(card->longname, "%s at 0x%lx irq %i",
|
|
||||||
c->name, chip->port, chip->irq);
|
|
||||||
|
|
||||||
if ((err = snd_card_register(card)) < 0) {
|
if ((err = snd_card_register(card)) < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user