diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:29:19 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:29:19 +0200 |
commit | 382305a33f3d313ca36f83a81f25531daba1e035 (patch) | |
tree | 7b1e7c25432138a171c6046bbcb1b188899dabb9 /sound | |
parent | fcdd368f2c7fa33f04ce973cb54dde750de38691 (diff) | |
download | history-382305a33f3d313ca36f83a81f25531daba1e035.tar.gz |
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
Documentation,ICE1724 driver,ICE1712 driver
- added model module option to specify board model to snd-ice1712 and snd-ice1724
drivers.
- removed ez8 option from ice1724. this can be specified as 'model=ez8' option.
- rewritten some struct init in C99 style.
- function for accessing i2c of ice1724 (for future use).
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ice1712/amp.c | 9 | ||||
-rw-r--r-- | sound/pci/ice1712/aureon.c | 2 | ||||
-rw-r--r-- | sound/pci/ice1712/delta.c | 80 | ||||
-rw-r--r-- | sound/pci/ice1712/envy24ht.h | 3 | ||||
-rw-r--r-- | sound/pci/ice1712/ews.c | 45 | ||||
-rw-r--r-- | sound/pci/ice1712/hoontech.c | 45 | ||||
-rw-r--r-- | sound/pci/ice1712/hoontech.h | 8 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 55 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.h | 2 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 62 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy.c | 1 | ||||
-rw-r--r-- | sound/pci/ice1712/revo.c | 9 |
12 files changed, 188 insertions, 133 deletions
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 0969907ab9abe0..779951725e1e44 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c @@ -54,10 +54,11 @@ static int __devinit snd_vt1724_amp_add_controls(ice1712_t *ice) /* entry point */ struct snd_ice1712_card_info snd_vt1724_amp_cards[] __devinitdata = { { - VT1724_SUBDEVICE_AUDIO2000, - "AMP Ltd AUDIO2000", - snd_vt1724_amp_init, - snd_vt1724_amp_add_controls, + .subvendor = VT1724_SUBDEVICE_AUDIO2000, + .name = "AMP Ltd AUDIO2000", + .model = "amp2000", + .chip_init = snd_vt1724_amp_init, + .build_controls = snd_vt1724_amp_add_controls, }, { } /* terminator */ }; diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 6e8be2406e1cce..8c886ca530d629 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -496,6 +496,7 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { { .subvendor = VT1724_SUBDEVICE_AUREON51_SKY, .name = "Terratec Aureon 5.1-Sky", + .model = "aureon51", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon51_eeprom), @@ -504,6 +505,7 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { { .subvendor = VT1724_SUBDEVICE_AUREON71_SPACE, .name = "Terratec Aureon 7.1-Space", + .model = "aureon71", .chip_init = aureon_init, .build_controls = aureon_add_controls, .eeprom_size = sizeof(aureon71_eeprom), diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index a5ba80c48e87d1..85fc5e4f67cd5d 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -692,56 +692,64 @@ static int __devinit snd_ice1712_delta_add_controls(ice1712_t *ice) /* entry point */ struct snd_ice1712_card_info snd_ice1712_delta_cards[] __devinitdata = { { - ICE1712_SUBDEVICE_DELTA1010, - "M Audio Delta 1010", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, + .subvendor = ICE1712_SUBDEVICE_DELTA1010, + .name = "M Audio Delta 1010", + .model = "delta1010", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, }, { - ICE1712_SUBDEVICE_DELTADIO2496, - "M Audio Delta DiO 2496", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, - 1, /* NO MPU */ + .subvendor = ICE1712_SUBDEVICE_DELTADIO2496, + .name = "M Audio Delta DiO 2496", + .model = "dio2496", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, + .no_mpu401 = 1, }, { - ICE1712_SUBDEVICE_DELTA66, - "M Audio Delta 66", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, - 1, /* NO MPU */ + .subvendor = ICE1712_SUBDEVICE_DELTA66, + .name = "M Audio Delta 66", + .model = "delta66", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, + .no_mpu401 = 1, }, { - ICE1712_SUBDEVICE_DELTA44, - "M Audio Delta 44", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, - 1, /* NO MPU */ + .subvendor = ICE1712_SUBDEVICE_DELTA44, + .name = "M Audio Delta 44", + .model = "delta44", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, + .no_mpu401 = 1, }, { - ICE1712_SUBDEVICE_AUDIOPHILE, - "M Audio Audiophile 24/96", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, + .subvendor = ICE1712_SUBDEVICE_AUDIOPHILE, + .name = "M Audio Audiophile 24/96", + .model = "audiophile", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, }, { - ICE1712_SUBDEVICE_DELTA410, - "M Audio Delta 410", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, + .subvendor = ICE1712_SUBDEVICE_DELTA410, + .name = "M Audio Delta 410", + .model = "delta410", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, }, { - ICE1712_SUBDEVICE_DELTA1010LT, - "M Audio Delta 1010LT", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, + .subvendor = ICE1712_SUBDEVICE_DELTA1010LT, + .name = "M Audio Delta 1010LT", + .model = "delta1010lt", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, }, { - ICE1712_SUBDEVICE_VX442, - "Digigram VX442", - snd_ice1712_delta_init, - snd_ice1712_delta_add_controls, - 1, /* NO MPU */ + .subvendor = ICE1712_SUBDEVICE_VX442, + .name = "Digigram VX442", + .model = "vx442", + .chip_init = snd_ice1712_delta_init, + .build_controls = snd_ice1712_delta_add_controls, + .no_mpu401 = 1, }, { } /* terminator */ }; diff --git a/sound/pci/ice1712/envy24ht.h b/sound/pci/ice1712/envy24ht.h index 1e99183bdaa2ae..375e5fb00c878d 100644 --- a/sound/pci/ice1712/envy24ht.h +++ b/sound/pci/ice1712/envy24ht.h @@ -209,4 +209,7 @@ enum { #define VT1724_MT_PDMA1_COUNT 0x76 /* word */ +unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr); +void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data); + #endif /* __SOUND_VT1724_H */ diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index 5392fc2f7fe845..9509e48402ed23 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -971,34 +971,39 @@ static int __devinit snd_ice1712_ews_add_controls(ice1712_t *ice) /* entry point */ struct snd_ice1712_card_info snd_ice1712_ews_cards[] __devinitdata = { { - ICE1712_SUBDEVICE_EWX2496, - "TerraTec EWX24/96", - snd_ice1712_ews_init, - snd_ice1712_ews_add_controls, + .subvendor = ICE1712_SUBDEVICE_EWX2496, + .name = "TerraTec EWX24/96", + .model = "ewx2496", + .chip_init = snd_ice1712_ews_init, + .build_controls = snd_ice1712_ews_add_controls, }, { - ICE1712_SUBDEVICE_EWS88MT, - "TerraTec EWS88MT", - snd_ice1712_ews_init, - snd_ice1712_ews_add_controls, + .subvendor = ICE1712_SUBDEVICE_EWS88MT, + .name = "TerraTec EWS88MT", + .model = "ews88mt", + .chip_init = snd_ice1712_ews_init, + .build_controls = snd_ice1712_ews_add_controls, }, { - ICE1712_SUBDEVICE_EWS88MT_NEW, - "TerraTec EWS88MT", - snd_ice1712_ews_init, - snd_ice1712_ews_add_controls, + .subvendor = ICE1712_SUBDEVICE_EWS88MT_NEW, + .name = "TerraTec EWS88MT", + .model = "ews88mt_new", + .chip_init = snd_ice1712_ews_init, + .build_controls = snd_ice1712_ews_add_controls, }, { - ICE1712_SUBDEVICE_EWS88D, - "TerraTec EWS88D", - snd_ice1712_ews_init, - snd_ice1712_ews_add_controls, + .subvendor = ICE1712_SUBDEVICE_EWS88D, + .name = "TerraTec EWS88D", + .model = "ews88d", + .chip_init = snd_ice1712_ews_init, + .build_controls = snd_ice1712_ews_add_controls, }, { - ICE1712_SUBDEVICE_DMX6FIRE, - "TerraTec DMX6Fire", - snd_ice1712_ews_init, - snd_ice1712_ews_add_controls, + .subvendor = ICE1712_SUBDEVICE_DMX6FIRE, + .name = "TerraTec DMX6Fire", + .model = "dmx6fire", + .chip_init = snd_ice1712_ews_init, + .build_controls = snd_ice1712_ews_add_controls, }, { } /* terminator */ }; diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index 074121fb375a3f..86aa59ca4d5079 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -156,20 +156,6 @@ static int __devinit snd_ice1712_hoontech_init(ice1712_t *ice) { int box, chn; - /* EZ8 Hack: Change shortname and subvendor id, Recall functions called in - * snd_ice1712_chip_init when it still thinks it is a Hoontech DSP24 card. - */ - if (ice->ez8) { - strcpy(ice->card->shortname, "Event Electronics EZ8"); - ice->eeprom.subvendor = 0; - ice->gpio.write_mask = ice->eeprom.gpiomask; - ice->gpio.direction = ice->eeprom.gpiodir; - snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ice->eeprom.gpiomask); - snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->eeprom.gpiodir); - snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ice->eeprom.gpiostate); - return 0; - } - ice->num_total_dacs = 8; ice->num_total_adcs = 8; @@ -231,17 +217,36 @@ static int __devinit snd_ice1712_hoontech_init(ice1712_t *ice) } +static int __devinit snd_ice1712_ez8_init(ice1712_t *ice) +{ + ice->gpio.write_mask = ice->eeprom.gpiomask; + ice->gpio.direction = ice->eeprom.gpiodir; + snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ice->eeprom.gpiomask); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->eeprom.gpiodir); + snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ice->eeprom.gpiostate); + return 0; +} + + /* entry point */ struct snd_ice1712_card_info snd_ice1712_hoontech_cards[] __devinitdata = { { - ICE1712_SUBDEVICE_STDSP24, - "Hoontech SoundTrack Audio DSP24", - snd_ice1712_hoontech_init, + .subvendor = ICE1712_SUBDEVICE_STDSP24, + .name = "Hoontech SoundTrack Audio DSP24", + .model = "dsp24", + .chip_init = snd_ice1712_hoontech_init, + }, + { + .subvendor = ICE1712_SUBDEVICE_STDSP24_MEDIA7_1, + .name = "Hoontech STA DSP24 Media 7.1", + .model = "dsp24_71", + .chip_init = snd_ice1712_hoontech_init, }, { - ICE1712_SUBDEVICE_STDSP24_MEDIA7_1, - "Hoontech STA DSP24 Media 7.1", - snd_ice1712_hoontech_init, + .subvendor = ICE1712_SUBDEVICE_EVENT_EZ8, /* a dummy id */ + .name = "Event Electronics EZ8", + .model = "ez8", + .chip_init = snd_ice1712_ez8_init, }, { } /* terminator */ }; diff --git a/sound/pci/ice1712/hoontech.h b/sound/pci/ice1712/hoontech.h index e1fe25b3638a65..b44ff1d6739747 100644 --- a/sound/pci/ice1712/hoontech.h +++ b/sound/pci/ice1712/hoontech.h @@ -25,12 +25,14 @@ */ #define HOONTECH_DEVICE_DESC \ - "{Hoontech SoundTrack DSP 24}," \ - "{Hoontech SoundTrack DSP 24 Value}," \ - "{Hoontech SoundTrack DSP 24 Media 7.1}," \ + "{Hoontech,SoundTrack DSP 24}," \ + "{Hoontech,SoundTrack DSP 24 Value}," \ + "{Hoontech,SoundTrack DSP 24 Media 7.1}," \ + "{Event Electronics,EZ8}," #define ICE1712_SUBDEVICE_STDSP24 0x12141217 /* Hoontech SoundTrack Audio DSP 24 */ #define ICE1712_SUBDEVICE_STDSP24_MEDIA7_1 0x16141217 /* Hoontech ST Audio DSP24 Media 7.1 */ +#define ICE1712_SUBDEVICE_EVENT_EZ8 0x00010001 /* A dummy id for EZ8 */ extern struct snd_ice1712_card_info snd_ice1712_hoontech_cards[]; diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 78bc9c3a719a5b..dda65cfdec4a60 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -84,9 +84,9 @@ MODULE_DEVICES("{" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static char *model[SNDRV_CARDS]; static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */ -static int ez8[SNDRV_CARDS]; /* EZ8 card */ static int boot_devs; module_param_array(index, int, boot_devs, 0444); @@ -104,9 +104,8 @@ MODULE_PARM_SYNTAX(omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC); module_param_array(cs8427_timeout, int, boot_devs, 0444); MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution."); MODULE_PARM_SYNTAX(cs8427_timeout, SNDRV_ENABLED ", allows:{{1,1000}},default=500,skill:advanced"); -module_param_array(ez8, bool, boot_devs, 0444); -MODULE_PARM_DESC(ez8, "Enable Event Electronics EZ8 support."); -MODULE_PARM_SYNTAX(ez8, SNDRV_ENABLED "," SNDRV_ENABLE_DESC); +module_param_array(model, charp, boot_devs, 0444); +MODULE_PARM_DESC(model, "Use the given board model."); #ifndef PCI_VENDOR_ID_ICE #define PCI_VENDOR_ID_ICE 0x1412 @@ -2289,6 +2288,16 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_peak __devinitdata = { * */ +/* + * list of available boards + */ +static struct snd_ice1712_card_info *card_tables[] __devinitdata = { + snd_ice1712_hoontech_cards, + snd_ice1712_delta_cards, + snd_ice1712_ews_cards, + 0, +}; + static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr) @@ -2301,7 +2310,7 @@ static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice, return inb(ICEREG(ice, I2C_DATA)); } -static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice) +static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice, const char *modelname) { int dev = 0xa0; /* EEPROM device address */ unsigned int i, size; @@ -2310,10 +2319,23 @@ static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice) snd_printk("ICE1712 has not detected EEPROM\n"); return -EIO; } - ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | - (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | - (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | - (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); + if (modelname && *modelname) { + struct snd_ice1712_card_info **tbl, *c; + for (tbl = card_tables; *tbl; tbl++) { + for (c = *tbl; c->subvendor; c++) { + if (c->model && !strcmp(modelname, c->model)) { + /* use the given subvendor */ + printk(KERN_INFO "ice1712: Using board model %s\n", c->name); + ice->eeprom.subvendor = c->subvendor; + break; + } + } + } + } else + ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | + (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | + (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | + (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); if (ice->eeprom.size < 6) ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ @@ -2486,9 +2508,9 @@ static int snd_ice1712_dev_free(snd_device_t *device) static int __devinit snd_ice1712_create(snd_card_t * card, struct pci_dev *pci, + const char *modelname, int omni, int cs8427_timeout, - int ez8, ice1712_t ** r_ice1712) { ice1712_t *ice; @@ -2517,7 +2539,6 @@ static int __devinit snd_ice1712_create(snd_card_t * card, cs8427_timeout = 1; else if (cs8427_timeout > 1000) cs8427_timeout = 1000; - ice->ez8 = ez8 ? 1 : 0; ice->cs8427_timeout = cs8427_timeout; spin_lock_init(&ice->reg_lock); init_MUTEX(&ice->gpio_mutex); @@ -2572,7 +2593,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card, ice->irq = pci->irq; - if (snd_ice1712_read_eeprom(ice) < 0) { + if (snd_ice1712_read_eeprom(ice, modelname) < 0) { snd_ice1712_free(ice); return -EIO; } @@ -2607,14 +2628,6 @@ static int __devinit snd_ice1712_create(snd_card_t * card, static struct snd_ice1712_card_info no_matched __devinitdata; -static struct snd_ice1712_card_info *card_tables[] __devinitdata = { - snd_ice1712_hoontech_cards, - snd_ice1712_delta_cards, - snd_ice1712_ews_cards, - 0, -}; - - static int __devinit snd_ice1712_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -2638,7 +2651,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, strcpy(card->driver, "ICE1712"); strcpy(card->shortname, "ICEnsemble ICE1712"); - if ((err = snd_ice1712_create(card, pci, omni[dev], cs8427_timeout[dev], ez8[dev], &ice)) < 0) { + if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], cs8427_timeout[dev], &ice)) < 0) { snd_card_free(card); return err; } diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index bb44ebae7c928a..0fe02e46823a77 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -329,7 +329,6 @@ struct _snd_ice1712 { unsigned int pro_volumes[20]; unsigned int omni: 1; /* Delta Omni I/O */ unsigned int vt1724: 1; - unsigned int ez8: 1; /* EZ8 support */ unsigned int num_total_dacs; /* total DACs */ unsigned int num_total_adcs; /* total ADCs */ unsigned char hoontech_boxbits[4]; @@ -461,6 +460,7 @@ static inline u8 snd_ice1712_read(ice1712_t * ice, u8 addr) struct snd_ice1712_card_info { unsigned int subvendor; char *name; + char *model; int (*chip_init)(ice1712_t *); int (*build_controls)(ice1712_t *); int no_mpu401: 1; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 878f4424e46374..0b607054bf031a 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -62,6 +62,7 @@ MODULE_DEVICES("{" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static char *model[SNDRV_CARDS]; static int boot_devs; module_param_array(index, int, boot_devs, 0444); @@ -73,6 +74,8 @@ MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC); module_param_array(enable, bool, boot_devs, 0444); MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard."); MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); +module_param_array(model, charp, boot_devs, 0444); +MODULE_PARM_DESC(model, "Use the given board model."); #ifndef PCI_VENDOR_ID_ICE #define PCI_VENDOR_ID_ICE 0x1412 @@ -1732,9 +1735,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = { /* */ -static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice, - unsigned char dev, - unsigned char addr) +unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr) { long t = 0x10000; @@ -1744,37 +1745,49 @@ static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice, return inb(ICEREG1724(ice, I2C_DATA)); } -static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice) +void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data) +{ + long t = 0x10000; + + outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); + outb(data, ICEREG1724(ice, I2C_DATA)); + outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); + while (t-- > 0 && (inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY)) ; +} + +static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelname) { int dev = 0xa0; /* EEPROM device address */ unsigned int i, size; struct snd_ice1712_card_info **tbl, *c; - if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) { - snd_printk(KERN_WARNING "ICE1724 has not detected EEPROM\n"); - // return -EIO; - } - ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | + if (! modelname || ! *modelname) { + if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) { + snd_printk(KERN_WARNING "ICE1724 has not detected EEPROM\n"); + // return -EIO; + } + ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); - - /* if the EEPROM is given by the driver, use it */ + } for (tbl = card_tables; *tbl; tbl++) { for (c = *tbl; c->subvendor; c++) { - if (c->subvendor == ice->eeprom.subvendor) { - if (! c->eeprom_size || ! c->eeprom_data) - goto found; - snd_printdd("using the defined eeprom..\n"); - ice->eeprom.version = 2; - ice->eeprom.size = c->eeprom_size + 6; - memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); - goto read_skipped; - } + if (modelname && c->model && ! strcmp(modelname, c->model)) { + printk(KERN_INFO "ice1724: Using board model %s\n", c->name); + ice->eeprom.subvendor = c->subvendor; + } else if (c->subvendor != ice->eeprom.subvendor) + continue; + if (! c->eeprom_size || ! c->eeprom_data) + break; + /* if the EEPROM is given by the driver, use it */ + snd_printdd("using the defined eeprom..\n"); + ice->eeprom.version = 2; + ice->eeprom.size = c->eeprom_size + 6; + memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); + goto read_skipped; } } - - found: ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); if (ice->eeprom.size < 6) ice->eeprom.size = 32; @@ -1928,6 +1941,7 @@ static int snd_vt1724_dev_free(snd_device_t *device) static int __devinit snd_vt1724_create(snd_card_t * card, struct pci_dev *pci, + const char *modelname, ice1712_t ** r_ice1712) { ice1712_t *ice; @@ -1983,7 +1997,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card, ice->irq = pci->irq; - if (snd_vt1724_read_eeprom(ice) < 0) { + if (snd_vt1724_read_eeprom(ice, modelname) < 0) { snd_vt1724_free(ice); return -EIO; } @@ -2042,7 +2056,7 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, strcpy(card->driver, "ICE1724"); strcpy(card->shortname, "ICEnsemble ICE1724"); - if ((err = snd_vt1724_create(card, pci, &ice)) < 0) { + if ((err = snd_vt1724_create(card, pci, model[dev], &ice)) < 0) { snd_card_free(card); return err; } diff --git a/sound/pci/ice1712/prodigy.c b/sound/pci/ice1712/prodigy.c index eee13e6441e8b7..b7ef0ea284e332 100644 --- a/sound/pci/ice1712/prodigy.c +++ b/sound/pci/ice1712/prodigy.c @@ -654,6 +654,7 @@ struct snd_ice1712_card_info snd_vt1724_prodigy_cards[] __devinitdata = { { .subvendor = VT1724_SUBDEVICE_PRODIGY71, .name = "Audiotrak Prodigy 7.1", + .model = "prodigy71", .chip_init = prodigy_init, .build_controls = prodigy_add_controls, .eeprom_size = sizeof(prodigy71_eeprom), diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 5c171aed033d14..8056312707ed59 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -171,10 +171,11 @@ static int __devinit revo_add_controls(ice1712_t *ice) /* entry point */ struct snd_ice1712_card_info snd_vt1724_revo_cards[] __devinitdata = { { - VT1724_SUBDEVICE_REVOLUTION71, - "M Audio Revolution-7.1", - revo_init, - revo_add_controls, + .subvendor = VT1724_SUBDEVICE_REVOLUTION71, + .name = "M Audio Revolution-7.1", + .model = "revo71", + .chip_init = revo_init, + .build_controls = revo_add_controls, }, { } /* terminator */ }; |