ALSA: ctxfi - Clean up probe routines

Clean up probe routines and model detection routines so that the driver
won't call and check the PCI subsystem id at each time.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2009-06-08 18:10:32 +02:00
parent d362af62ed
commit 9470195a9c
7 changed files with 135 additions and 174 deletions

View File

@ -39,29 +39,40 @@
| (0x10 << 16) \ | (0x10 << 16) \
| ((IEC958_AES3_CON_FS_48000) << 24)) | ((IEC958_AES3_CON_FS_48000) << 24))
static const struct ct_atc_chip_sub_details atc_sub_details[NUM_CTCARDS] = { static struct snd_pci_quirk __devinitdata subsys_20k1_list[] = {
[CTSB0760] = {.subsys = PCI_SUBDEVICE_ID_CREATIVE_SB0760, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0022, "SB055x", CTSB055X),
.nm_model = "SB076x"}, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x002f, "SB055x", CTSB055X),
[CTHENDRIX] = {.subsys = PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0029, "SB073x", CTSB073X),
.nm_model = "Hendrix"}, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0031, "SB073x", CTSB073X),
[CTSB08801] = {.subsys = PCI_SUBDEVICE_ID_CREATIVE_SB08801, SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_CREATIVE, 0x6000,
.nm_model = "SB0880"}, PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, "UAA", CTUAA),
[CTSB08802] = {.subsys = PCI_SUBDEVICE_ID_CREATIVE_SB08802, SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_CREATIVE,
.nm_model = "SB0880"}, "Unknown", CT20K1_UNKNOWN),
[CTSB08803] = {.subsys = PCI_SUBDEVICE_ID_CREATIVE_SB08803, { } /* terminator */
.nm_model = "SB0880"}
}; };
static struct ct_atc_chip_details atc_chip_details[] = { static struct snd_pci_quirk __devinitdata subsys_20k2_list[] = {
{.vendor = PCI_VENDOR_ID_CREATIVE, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB0760,
.device = PCI_DEVICE_ID_CREATIVE_20K1, "SB0760", CTSB0760),
.sub_details = NULL, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08801,
.nm_card = "X-Fi 20k1"}, "SB0880", CTSB0880),
{.vendor = PCI_VENDOR_ID_CREATIVE, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08802,
.device = PCI_DEVICE_ID_CREATIVE_20K2, "SB0880", CTSB0880),
.sub_details = atc_sub_details, SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08803,
.nm_card = "X-Fi 20k2"}, "SB0880", CTSB0880),
{} /* terminator */ SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_CREATIVE, 0x6000,
PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, "UAA", CTHENDRIX),
{ } /* terminator */
};
static const char *ct_subsys_name[NUM_CTCARDS] = {
[CTSB055X] = "SB055x",
[CTSB073X] = "SB073x",
[CTSB0760] = "SB076x",
[CTUAA] = "UAA",
[CT20K1_UNKNOWN] = "Unknown",
[CTHENDRIX] = "Hendrix",
[CTSB0880] = "SB0880",
}; };
static struct { static struct {
@ -1208,62 +1219,39 @@ static int atc_dev_free(struct snd_device *dev)
static int __devinit atc_identify_card(struct ct_atc *atc) static int __devinit atc_identify_card(struct ct_atc *atc)
{ {
u16 subsys; const struct snd_pci_quirk *p;
u8 revision; const struct snd_pci_quirk *list;
struct pci_dev *pci = atc->pci;
const struct ct_atc_chip_details *d;
enum CTCARDS i;
subsys = pci->subsystem_device; switch (atc->chip_type) {
revision = pci->revision; case ATC20K1:
atc->chip_details = NULL; atc->chip_name = "20K1";
atc->model = NUM_CTCARDS; list = subsys_20k1_list;
for (d = atc_chip_details; d->vendor; d++) {
if (d->vendor != pci->vendor || d->device != pci->device)
continue;
if (NULL == d->sub_details) {
atc->chip_details = d;
break;
}
for (i = 0; i < NUM_CTCARDS; i++) {
if ((d->sub_details[i].subsys == subsys) ||
(((subsys & 0x6000) == 0x6000) &&
((d->sub_details[i].subsys & 0x6000) == 0x6000))) {
atc->model = i;
break;
}
}
if (i >= NUM_CTCARDS)
continue;
atc->chip_details = d;
break; break;
/* not take revision into consideration now */ case ATC20K2:
} atc->chip_name = "20K2";
if (!d->vendor) list = subsys_20k2_list;
break;
default:
return -ENOENT; return -ENOENT;
}
p = snd_pci_quirk_lookup(atc->pci, list);
if (!p)
return -ENOENT;
atc->model = p->value;
atc->model_name = ct_subsys_name[atc->model];
snd_printd("ctxfi: chip %s model %s (%04x:%04x) is found\n",
atc->chip_name, atc->model_name,
atc->pci->subsystem_vendor,
atc->pci->subsystem_device);
return 0; return 0;
} }
int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc) int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
{ {
enum CTALSADEVS i; enum CTALSADEVS i;
struct hw *hw = atc->hw;
int err; int err;
switch (hw->get_chip_type(hw)) { alsa_dev_funcs[MIXER].public_name = atc->chip_name;
case ATC20K1:
alsa_dev_funcs[MIXER].public_name = "20K1";
break;
case ATC20K2:
alsa_dev_funcs[MIXER].public_name = "20K2";
break;
default:
alsa_dev_funcs[MIXER].public_name = "Unknown";
break;
}
for (i = 0; i < NUM_CTALSADEVS; i++) { for (i = 0; i < NUM_CTALSADEVS; i++) {
if (NULL == alsa_dev_funcs[i].create) if (NULL == alsa_dev_funcs[i].create)
@ -1287,7 +1275,7 @@ static int __devinit atc_create_hw_devs(struct ct_atc *atc)
struct card_conf info = {0}; struct card_conf info = {0};
int i, err; int i, err;
err = create_hw_obj(atc->pci, &hw); err = create_hw_obj(atc->pci, atc->chip_type, atc->model, &hw);
if (err) { if (err) {
printk(KERN_ERR "Failed to create hw obj!!!\n"); printk(KERN_ERR "Failed to create hw obj!!!\n");
return err; return err;
@ -1328,7 +1316,6 @@ static int __devinit atc_get_resources(struct ct_atc *atc)
struct sum_desc sum_dsc = {0}; struct sum_desc sum_dsc = {0};
struct sum_mgr *sum_mgr; struct sum_mgr *sum_mgr;
int err, i; int err, i;
unsigned short subsys_id;
atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL); atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL);
if (NULL == atc->daios) if (NULL == atc->daios)
@ -1359,13 +1346,10 @@ static int __devinit atc_get_resources(struct ct_atc *atc)
} }
atc->n_daio++; atc->n_daio++;
} }
subsys_id = atc->pci->subsystem_device; if (atc->model == CTSB073X)
if ((subsys_id == 0x0029) || (subsys_id == 0x0031)) {
/* SB073x cards */
da_desc.type = SPDIFI1; da_desc.type = SPDIFI1;
} else { else
da_desc.type = SPDIFIO; da_desc.type = SPDIFIO;
}
err = daio_mgr->get_daio(daio_mgr, &da_desc, err = daio_mgr->get_daio(daio_mgr, &da_desc,
(struct daio **)&atc->daios[i]); (struct daio **)&atc->daios[i]);
if (err) { if (err) {
@ -1555,7 +1539,8 @@ static struct ct_atc atc_preset __devinitdata = {
*/ */
int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
unsigned int rsr, unsigned int msr, struct ct_atc **ratc) unsigned int rsr, unsigned int msr,
int chip_type, struct ct_atc **ratc)
{ {
struct ct_atc *atc; struct ct_atc *atc;
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
@ -1576,6 +1561,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
atc->pci = pci; atc->pci = pci;
atc->rsr = rsr; atc->rsr = rsr;
atc->msr = msr; atc->msr = msr;
atc->chip_type = chip_type;
spin_lock_init(&atc->atc_lock); spin_lock_init(&atc->atc_lock);

View File

@ -37,15 +37,6 @@ enum CTALSADEVS { /* Types of alsa devices */
NUM_CTALSADEVS /* This should always be the last */ NUM_CTALSADEVS /* This should always be the last */
}; };
enum CTCARDS {
CTSB0760,
CTHENDRIX,
CTSB08801,
CTSB08802,
CTSB08803,
NUM_CTCARDS /* This should always be the last */
};
struct ct_atc_chip_sub_details { struct ct_atc_chip_sub_details {
u16 subsys; u16 subsys;
const char *nm_model; const char *nm_model;
@ -89,8 +80,10 @@ struct ct_atc {
unsigned int msr; /* master sample rate in rsr */ unsigned int msr; /* master sample rate in rsr */
unsigned int pll_rate; /* current rate of Phase Lock Loop */ unsigned int pll_rate; /* current rate of Phase Lock Loop */
const struct ct_atc_chip_details *chip_details; int chip_type;
enum CTCARDS model; int model;
const char *chip_name;
const char *model_name;
struct ct_vm *vm; /* device virtual memory manager for this card */ struct ct_vm *vm; /* device virtual memory manager for this card */
int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
@ -147,7 +140,7 @@ struct ct_atc {
int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
unsigned int rsr, unsigned int msr, unsigned int rsr, unsigned int msr, int chip_type,
struct ct_atc **ratc); struct ct_atc **ratc);
int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc); int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc);

View File

@ -116,7 +116,7 @@ static struct rsc_ops daio_in_rsc_ops_20k2 = {
static unsigned int daio_device_index(enum DAIOTYP type, struct hw *hw) static unsigned int daio_device_index(enum DAIOTYP type, struct hw *hw)
{ {
switch (hw->get_chip_type(hw)) { switch (hw->chip_type) {
case ATC20K1: case ATC20K1:
switch (type) { switch (type) {
case SPDIFOO: return 0; case SPDIFOO: return 0;
@ -343,7 +343,7 @@ static int daio_rsc_init(struct daio *daio,
int err; int err;
unsigned int idx_l, idx_r; unsigned int idx_l, idx_r;
switch (((struct hw *)hw)->get_chip_type(hw)) { switch (((struct hw *)hw)->chip_type) {
case ATC20K1: case ATC20K1:
idx_l = idx_20k1[desc->type].left; idx_l = idx_20k1[desc->type].left;
idx_r = idx_20k1[desc->type].right; idx_r = idx_20k1[desc->type].right;
@ -367,7 +367,7 @@ static int daio_rsc_init(struct daio *daio,
if (desc->type <= DAIO_OUT_MAX) { if (desc->type <= DAIO_OUT_MAX) {
daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops; daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops;
} else { } else {
switch (((struct hw *)hw)->get_chip_type(hw)) { switch (((struct hw *)hw)->chip_type) {
case ATC20K1: case ATC20K1:
daio->rscl.ops = daio->rscr.ops = &daio_in_rsc_ops_20k1; daio->rscl.ops = daio->rscr.ops = &daio_in_rsc_ops_20k1;
break; break;

View File

@ -20,34 +20,16 @@
#include "cthw20k2.h" #include "cthw20k2.h"
#include <linux/bug.h> #include <linux/bug.h>
static enum CHIPTYP __devinitdata get_chip_type(struct hw *hw) int __devinit create_hw_obj(struct pci_dev *pci, enum CHIPTYP chip_type,
{ enum CTCARDS model, struct hw **rhw)
enum CHIPTYP type;
switch (hw->pci->device) {
case 0x0005: /* 20k1 device */
type = ATC20K1;
break;
case 0x000B: /* 20k2 device */
type = ATC20K2;
break;
default:
type = ATCNONE;
break;
}
return type;
}
int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
{ {
int err; int err;
switch (pci->device) { switch (chip_type) {
case 0x0005: /* 20k1 device */ case ATC20K1:
err = create_20k1_hw_obj(rhw); err = create_20k1_hw_obj(rhw);
break; break;
case 0x000B: /* 20k2 device */ case ATC20K2:
err = create_20k2_hw_obj(rhw); err = create_20k2_hw_obj(rhw);
break; break;
default: default:
@ -58,7 +40,8 @@ int __devinit create_hw_obj(struct pci_dev *pci, struct hw **rhw)
return err; return err;
(*rhw)->pci = pci; (*rhw)->pci = pci;
(*rhw)->get_chip_type = get_chip_type; (*rhw)->chip_type = chip_type;
(*rhw)->model = model;
return 0; return 0;
} }

View File

@ -27,6 +27,19 @@ enum CHIPTYP {
ATCNONE ATCNONE
}; };
enum CTCARDS {
/* 20k1 models */
CTSB055X,
CTSB073X,
CTUAA,
CT20K1_UNKNOWN,
/* 20k2 models */
CTSB0760,
CTHENDRIX,
CTSB0880,
NUM_CTCARDS /* This should always be the last */
};
/* Type of input source for ADC */ /* Type of input source for ADC */
enum ADCSRC{ enum ADCSRC{
ADC_MICIN, ADC_MICIN,
@ -48,7 +61,6 @@ struct hw {
int (*card_init)(struct hw *hw, struct card_conf *info); int (*card_init)(struct hw *hw, struct card_conf *info);
int (*card_stop)(struct hw *hw); int (*card_stop)(struct hw *hw);
int (*pll_init)(struct hw *hw, unsigned int rsr); int (*pll_init)(struct hw *hw, unsigned int rsr);
enum CHIPTYP (*get_chip_type)(struct hw *hw);
int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source); int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source);
int (*select_adc_source)(struct hw *hw, enum ADCSRC source); int (*select_adc_source)(struct hw *hw, enum ADCSRC source);
int (*have_digit_io_switch)(struct hw *hw); int (*have_digit_io_switch)(struct hw *hw);
@ -156,9 +168,13 @@ struct hw {
int irq; int irq;
unsigned long io_base; unsigned long io_base;
unsigned long mem_base; unsigned long mem_base;
enum CHIPTYP chip_type;
enum CTCARDS model;
}; };
int create_hw_obj(struct pci_dev *pci, struct hw **rhw); int create_hw_obj(struct pci_dev *pci, enum CHIPTYP chip_type,
enum CTCARDS model, struct hw **rhw);
int destroy_hw_obj(struct hw *hw); int destroy_hw_obj(struct hw *hw);
unsigned int get_field(unsigned int data, unsigned int field); unsigned int get_field(unsigned int data, unsigned int field);

View File

@ -1432,11 +1432,9 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info)
{ {
u32 data; u32 data;
u16 gpioorg; u16 gpioorg;
u16 subsys_id;
unsigned int ret; unsigned int ret;
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); if (hw->model == CTSB055X) {
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
/* SB055x, unmute outputs */ /* SB055x, unmute outputs */
gpioorg = (u16)hw_read_20kx(hw, GPIO); gpioorg = (u16)hw_read_20kx(hw, GPIO);
gpioorg &= 0xffbf; /* set GPIO6 to low */ gpioorg &= 0xffbf; /* set GPIO6 to low */
@ -1538,19 +1536,14 @@ static int is_adc_input_selected_hendrix(struct hw *hw, enum ADCSRC type)
static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
{ {
u16 subsys_id; switch (hw->model) {
case CTSB055X:
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
/* SB055x cards */
return is_adc_input_selected_SB055x(hw, type); return is_adc_input_selected_SB055x(hw, type);
} else if ((subsys_id == 0x0029) || (subsys_id == 0x0031)) { case CTSB073X:
/* SB073x cards */
return is_adc_input_selected_hendrix(hw, type); return is_adc_input_selected_hendrix(hw, type);
} else if ((subsys_id & 0xf000) == 0x6000) { case CTHENDRIX:
/* Vista compatible cards */
return is_adc_input_selected_hendrix(hw, type); return is_adc_input_selected_hendrix(hw, type);
} else { default:
return is_adc_input_selected_SBx(hw, type); return is_adc_input_selected_SBx(hw, type);
} }
} }
@ -1692,20 +1685,17 @@ adc_input_select_hendrix(struct hw *hw, enum ADCSRC type, unsigned char boost)
static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
{ {
u16 subsys_id; int state = type == ADC_MICIN;
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); switch (hw->model) {
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { case CTSB055X:
/* SB055x cards */ return adc_input_select_SB055x(hw, type, state);
return adc_input_select_SB055x(hw, type, (ADC_MICIN == type)); case CTSB073X:
} else if ((subsys_id == 0x0029) || (subsys_id == 0x0031)) { return adc_input_select_hendrix(hw, type, state);
/* SB073x cards */ case CTHENDRIX:
return adc_input_select_hendrix(hw, type, (ADC_MICIN == type)); return adc_input_select_hendrix(hw, type, state);
} else if ((subsys_id & 0xf000) == 0x6000) { default:
/* Vista compatible cards */ return adc_input_select_SBx(hw, type, state);
return adc_input_select_hendrix(hw, type, (ADC_MICIN == type));
} else {
return adc_input_select_SBx(hw, type, (ADC_MICIN == type));
} }
} }
@ -1781,28 +1771,16 @@ static int adc_init_SBx(struct hw *hw, int input, int mic20db)
static int hw_adc_init(struct hw *hw, const struct adc_conf *info) static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
{ {
int err; if (hw->model == CTSB055X)
u16 subsys_id; return adc_init_SB055x(hw, info->input, info->mic20db);
else
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id); return adc_init_SBx(hw, info->input, info->mic20db);
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) {
/* Sb055x card */
err = adc_init_SB055x(hw, info->input, info->mic20db);
} else {
err = adc_init_SBx(hw, info->input, info->mic20db);
}
return err;
} }
static int hw_have_digit_io_switch(struct hw *hw) static int hw_have_digit_io_switch(struct hw *hw)
{ {
u16 subsys_id;
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
/* SB073x and Vista compatible cards have no digit IO switch */ /* SB073x and Vista compatible cards have no digit IO switch */
return !((subsys_id == 0x0029) || (subsys_id == 0x0031) return !(hw->model == CTSB073X || hw->model == CTHENDRIX);
|| ((subsys_id & 0xf000) == 0x6000));
} }
#define CTLBITS(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) #define CTLBITS(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
@ -1918,7 +1896,6 @@ static int hw_card_start(struct hw *hw)
{ {
int err; int err;
struct pci_dev *pci = hw->pci; struct pci_dev *pci = hw->pci;
u16 subsys_id;
err = pci_enable_device(pci); err = pci_enable_device(pci);
if (err < 0) if (err < 0)
@ -1939,8 +1916,7 @@ static int hw_card_start(struct hw *hw)
goto error1; goto error1;
/* Switch to X-Fi mode from UAA mode if neeeded */ /* Switch to X-Fi mode from UAA mode if neeeded */
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsys_id); if (hw->model == CTHENDRIX) {
if ((0x5 == pci->device) && (0x6000 == (subsys_id & 0x6000))) {
err = uaa_to_xfi(pci); err = uaa_to_xfi(pci);
if (err) if (err)
goto error2; goto error2;
@ -2004,7 +1980,6 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
{ {
int err; int err;
unsigned int gctl; unsigned int gctl;
u16 subsys_id;
u32 data; u32 data;
struct dac_conf dac_info = {0}; struct dac_conf dac_info = {0};
struct adc_conf adc_info = {0}; struct adc_conf adc_info = {0};
@ -2044,19 +2019,20 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
hw_write_20kx(hw, SRCIP, 0); hw_write_20kx(hw, SRCIP, 0);
mdelay(30); mdelay(30);
pci_read_config_word(hw->pci, PCI_SUBSYSTEM_ID, &subsys_id);
/* Detect the card ID and configure GPIO accordingly. */ /* Detect the card ID and configure GPIO accordingly. */
if ((subsys_id == 0x0022) || (subsys_id == 0x002F)) { switch (hw->model) {
/* SB055x cards */ case CTSB055X:
hw_write_20kx(hw, GPIOCTL, 0x13fe); hw_write_20kx(hw, GPIOCTL, 0x13fe);
} else if ((subsys_id == 0x0029) || (subsys_id == 0x0031)) { break;
/* SB073x cards */ case CTSB073X:
hw_write_20kx(hw, GPIOCTL, 0x00e6); hw_write_20kx(hw, GPIOCTL, 0x00e6);
} else if ((subsys_id & 0xf000) == 0x6000) { break;
/* Vista compatible cards */ case CTHENDRIX: /* Vista compatible cards */
hw_write_20kx(hw, GPIOCTL, 0x00c2); hw_write_20kx(hw, GPIOCTL, 0x00c2);
} else { break;
default:
hw_write_20kx(hw, GPIOCTL, 0x01e6); hw_write_20kx(hw, GPIOCTL, 0x01e6);
break;
} }
trn_info.vm_pgt_phys = info->vm_pgt_phys; trn_info.vm_pgt_phys = info->vm_pgt_phys;

View File

@ -15,6 +15,7 @@
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
#include "ctatc.h" #include "ctatc.h"
#include "cthardware.h"
MODULE_AUTHOR("Creative Technology Ltd"); MODULE_AUTHOR("Creative Technology Ltd");
MODULE_DESCRIPTION("X-Fi driver version 1.03"); MODULE_DESCRIPTION("X-Fi driver version 1.03");
@ -41,8 +42,12 @@ MODULE_PARM_DESC(enable, "Enable Creative X-Fi driver");
static struct pci_device_id ct_pci_dev_ids[] = { static struct pci_device_id ct_pci_dev_ids[] = {
/* only X-Fi is supported, so... */ /* only X-Fi is supported, so... */
{ PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_20K1) }, { PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_20K1),
{ PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_20K2) }, .driver_data = ATC20K1,
},
{ PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_20K2),
.driver_data = ATC20K2,
},
{ 0, } { 0, }
}; };
MODULE_DEVICE_TABLE(pci, ct_pci_dev_ids); MODULE_DEVICE_TABLE(pci, ct_pci_dev_ids);
@ -79,7 +84,8 @@ ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
"1 and 2, Value 2 is assumed.\n"); "1 and 2, Value 2 is assumed.\n");
multiple = 2; multiple = 2;
} }
err = ct_atc_create(card, pci, reference_rate, multiple, &atc); err = ct_atc_create(card, pci, reference_rate, multiple,
pci_id->driver_data, &atc);
if (err < 0) if (err < 0)
goto error; goto error;
@ -92,7 +98,8 @@ ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
strcpy(card->driver, "SB-XFi"); strcpy(card->driver, "SB-XFi");
strcpy(card->shortname, "Creative X-Fi"); strcpy(card->shortname, "Creative X-Fi");
strcpy(card->longname, "Creative ALSA Driver X-Fi"); snprintf(card->longname, sizeof(card->longname), "%s %s %s",
card->shortname, atc->chip_name, atc->model_name);
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) if (err < 0)