Update of /cvsroot/alsa/alsa-kernel/pci/ice1712
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25277/pci/ice1712

Modified Files:
        amp.c aureon.c delta.c envy24ht.h ews.c hoontech.c hoontech.h 
        ice1712.c ice1712.h ice1724.c prodigy.c revo.c 
Log Message:
- 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).


Index: amp.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/amp.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- amp.c       5 Mar 2004 09:08:38 -0000       1.4
+++ amp.c       7 May 2004 10:18:59 -0000       1.5
@@ -54,10 +54,11 @@
 /* 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 */
 };

Index: aureon.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/aureon.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- aureon.c    5 Mar 2004 09:08:39 -0000       1.5
+++ aureon.c    7 May 2004 10:18:59 -0000       1.6
@@ -496,6 +496,7 @@
        {
                .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 @@
        {
                .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),

Index: delta.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/delta.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- delta.c     28 Mar 2004 15:45:32 -0000      1.16
+++ delta.c     7 May 2004 10:18:59 -0000       1.17
@@ -692,56 +692,64 @@
 /* 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,
-       },
-       {
-               ICE1712_SUBDEVICE_DELTADIO2496,
-               "M Audio Delta DiO 2496",
-               snd_ice1712_delta_init,
-               snd_ice1712_delta_add_controls,
-               1, /* NO MPU */
-       },
-       {
-               ICE1712_SUBDEVICE_DELTA66,
-               "M Audio Delta 66",
-               snd_ice1712_delta_init,
-               snd_ice1712_delta_add_controls,
-               1, /* NO MPU */
-       },
-       {
-               ICE1712_SUBDEVICE_DELTA44,
-               "M Audio Delta 44",
-               snd_ice1712_delta_init,
-               snd_ice1712_delta_add_controls,
-               1, /* NO MPU */
-       },
-       {
-               ICE1712_SUBDEVICE_AUDIOPHILE,
-               "M Audio Audiophile 24/96",
-               snd_ice1712_delta_init,
-               snd_ice1712_delta_add_controls,
-       },
-       {
-               ICE1712_SUBDEVICE_DELTA410,
-               "M Audio Delta 410",
-               snd_ice1712_delta_init,
-               snd_ice1712_delta_add_controls,
-       },
-       {
-               ICE1712_SUBDEVICE_DELTA1010LT,
-               "M Audio Delta 1010LT",
-               snd_ice1712_delta_init,
-               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_DELTA1010,
+               .name = "M Audio Delta 1010",
+               .model = "delta1010",
+               .chip_init = snd_ice1712_delta_init,
+               .build_controls = snd_ice1712_delta_add_controls,
+       },
+       {
+               .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,
+       },
+       {
+               .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,
+       },
+       {
+               .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,
+       },
+       {
+               .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,
+       },
+       {
+               .subvendor = ICE1712_SUBDEVICE_DELTA410,
+               .name = "M Audio Delta 410",
+               .model = "delta410",
+               .chip_init = snd_ice1712_delta_init,
+               .build_controls = 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,
+       },
+       {
+               .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 */
 };

Index: envy24ht.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/envy24ht.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- envy24ht.h  9 May 2003 14:10:36 -0000       1.3
+++ envy24ht.h  7 May 2004 10:18:59 -0000       1.4
@@ -209,4 +209,7 @@
 #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 */

Index: ews.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ews.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ews.c       5 Mar 2004 09:08:39 -0000       1.16
+++ ews.c       7 May 2004 10:18:59 -0000       1.17
@@ -971,34 +971,39 @@
 /* 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 */
 };

Index: hoontech.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/hoontech.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- hoontech.c  4 May 2004 06:46:29 -0000       1.5
+++ hoontech.c  7 May 2004 10:18:59 -0000       1.6
@@ -156,20 +156,6 @@
 {
        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_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 */
 };

Index: hoontech.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/hoontech.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- hoontech.h  16 Dec 2002 14:23:48 -0000      1.3
+++ hoontech.h  7 May 2004 10:18:59 -0000       1.4
@@ -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[];
 

Index: ice1712.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ice1712.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- ice1712.c   16 Apr 2004 13:08:35 -0000      1.51
+++ ice1712.c   7 May 2004 10:18:59 -0000       1.52
@@ -84,9 +84,9 @@
 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_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 @@
  *
  */
 
+/*
+ * 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 @@
        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 @@
                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 __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 @@
                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 @@
        
        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 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 @@
        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;
        }

Index: ice1712.h
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ice1712.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ice1712.h   13 Apr 2004 15:39:21 -0000      1.19
+++ ice1712.h   7 May 2004 10:19:00 -0000       1.20
@@ -329,7 +329,6 @@
        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 @@
 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;

Index: ice1724.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ice1724.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- ice1724.c   13 Apr 2004 14:59:01 -0000      1.29
+++ ice1724.c   7 May 2004 10:19:00 -0000       1.30
@@ -62,6 +62,7 @@
 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_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 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 @@
        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 __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 @@
 
        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 @@
        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;
        }

Index: prodigy.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/prodigy.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- prodigy.c   5 Mar 2004 09:08:39 -0000       1.4
+++ prodigy.c   7 May 2004 10:19:00 -0000       1.5
@@ -654,6 +654,7 @@
        {
                .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),

Index: revo.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/revo.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- revo.c      5 Mar 2004 09:08:39 -0000       1.5
+++ revo.c      7 May 2004 10:19:00 -0000       1.6
@@ -171,10 +171,11 @@
 /* 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 */
 };



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to