/[openvortex]/alsa/alsa-kernel/pci/ice1712/ice1724.c
ViewVC logotype

Diff of /alsa/alsa-kernel/pci/ice1712/ice1724.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by vizard, Sat May 31 02:35:12 2003 UTC revision 1.3 by vizard, Mon Aug 11 00:06:40 2003 UTC
# Line 42  Line 42 
42  /* lowlevel routines */  /* lowlevel routines */
43  #include "amp.h"  #include "amp.h"
44  #include "revo.h"  #include "revo.h"
45    #include "aureon.h"
46    
47  MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");  MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
48  MODULE_DESCRIPTION("ICEnsemble ICE1724 (Envy24HT)");  MODULE_DESCRIPTION("ICEnsemble ICE1724 (Envy24HT)");
# Line 50  MODULE_CLASSES("{sound}"); Line 51  MODULE_CLASSES("{sound}");
51  MODULE_DEVICES("{"  MODULE_DEVICES("{"
52                 REVO_DEVICE_DESC                 REVO_DEVICE_DESC
53                 AMP_AUDIO2000_DEVICE_DESC                 AMP_AUDIO2000_DEVICE_DESC
54                   AUREON_DEVICE_DESC
55                  "{VIA,VT1724},"                  "{VIA,VT1724},"
56                  "{ICEnsemble,Generic ICE1724},"                  "{ICEnsemble,Generic ICE1724},"
57                  "{ICEnsemble,Generic Envy24HT}}");                  "{ICEnsemble,Generic Envy24HT}}");
# Line 172  static unsigned short snd_vt1724_ac97_re Line 174  static unsigned short snd_vt1724_ac97_re
174  static void snd_vt1724_set_gpio_dir(ice1712_t *ice, unsigned int data)  static void snd_vt1724_set_gpio_dir(ice1712_t *ice, unsigned int data)
175  {  {
176          outl(data, ICEREG1724(ice, GPIO_DIRECTION));          outl(data, ICEREG1724(ice, GPIO_DIRECTION));
177            inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */
178  }  }
179    
180  /* set the gpio mask (0 = writable) */  /* set the gpio mask (0 = writable) */
# Line 179  static void snd_vt1724_set_gpio_mask(ice Line 182  static void snd_vt1724_set_gpio_mask(ice
182  {  {
183          outw(data, ICEREG1724(ice, GPIO_WRITE_MASK));          outw(data, ICEREG1724(ice, GPIO_WRITE_MASK));
184          outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22));          outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22));
185            inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */
186  }  }
187    
188  static void snd_vt1724_set_gpio_data(ice1712_t *ice, unsigned int data)  static void snd_vt1724_set_gpio_data(ice1712_t *ice, unsigned int data)
189  {  {
190          outw(data, ICEREG1724(ice, GPIO_DATA));          outw(data, ICEREG1724(ice, GPIO_DATA));
191          outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22));          outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22));
192            inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */
193  }  }
194    
195  static unsigned int snd_vt1724_get_gpio_data(ice1712_t *ice)  static unsigned int snd_vt1724_get_gpio_data(ice1712_t *ice)
# Line 415  static void snd_vt1724_set_pro_rate(ice1 Line 420  static void snd_vt1724_set_pro_rate(ice1
420                          val &= ~VT1724_MT_I2S_MCLK_128X; /* 256x MCLK */                          val &= ~VT1724_MT_I2S_MCLK_128X; /* 256x MCLK */
421                  if (val != old) {                  if (val != old) {
422                          outb(val, ICEMT1724(ice, I2S_FORMAT));                          outb(val, ICEMT1724(ice, I2S_FORMAT));
423                          /* FIXME: is this revo only? */                          if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) {
424                          /* assert PRST# to converters; MT05 bit 7 */                                  /* FIXME: is this revo only? */
425                          outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));                                  /* assert PRST# to converters; MT05 bit 7 */
426                          spin_unlock_irqrestore(&ice->reg_lock, flags);                                  outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
427                          mdelay(5);                                  spin_unlock_irqrestore(&ice->reg_lock, flags);
428                          spin_lock_irqsave(&ice->reg_lock, flags);                                  mdelay(5);
429                          /* deassert PRST# */                                  spin_lock_irqsave(&ice->reg_lock, flags);
430                          outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));                                  /* deassert PRST# */
431                                    outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
432                            }
433                  }                  }
434          }          }
435          spin_unlock_irqrestore(&ice->reg_lock, flags);          spin_unlock_irqrestore(&ice->reg_lock, flags);
# Line 1549  static struct snd_ice1712_card_info no_m Line 1556  static struct snd_ice1712_card_info no_m
1556  static struct snd_ice1712_card_info *card_tables[] __devinitdata = {  static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
1557          snd_vt1724_revo_cards,          snd_vt1724_revo_cards,
1558          snd_vt1724_amp_cards,          snd_vt1724_amp_cards,
1559            snd_vt1724_aureon_cards,
1560          0,          0,
1561  };  };
1562    
# Line 1572  static int __devinit snd_vt1724_read_eep Line 1580  static int __devinit snd_vt1724_read_eep
1580  {  {
1581          int dev = 0xa0;         /* EEPROM device address */          int dev = 0xa0;         /* EEPROM device address */
1582          unsigned int i, size;          unsigned int i, size;
1583            struct snd_ice1712_card_info **tbl, *c;
1584    
1585          if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) {          if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) {
1586                  snd_printk("ICE1724 has not detected EEPROM\n");                  snd_printk(KERN_WARNING "ICE1724 has not detected EEPROM\n");
1587                  return -EIO;                  // return -EIO;
1588          }          }
1589          ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |          ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |
1590                                  (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) |                                  (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) |
1591                                  (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |                                  (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |
1592                                  (snd_vt1724_read_i2c(ice, dev, 0x03) << 24);                                  (snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
1593    
1594            /* if the EEPROM is given by the driver, use it */
1595            for (tbl = card_tables; *tbl; tbl++) {
1596                    for (c = *tbl; c->subvendor; c++) {
1597                            if (c->subvendor == ice->eeprom.subvendor) {
1598                                    if (! c->eeprom_size || ! c->eeprom_data)
1599                                            goto found;
1600                                    snd_printdd("using the defined eeprom..\n");
1601                                    ice->eeprom.version = 2;
1602                                    ice->eeprom.size = c->eeprom_size + 6;
1603                                    memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
1604                                    goto read_skipped;
1605                            }
1606                    }
1607            }
1608    
1609     found:
1610          ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);          ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
1611          if (ice->eeprom.size < 6)          if (ice->eeprom.size < 6)
1612                  ice->eeprom.size = 32;                  ice->eeprom.size = 32;
# Line 1597  static int __devinit snd_vt1724_read_eep Line 1623  static int __devinit snd_vt1724_read_eep
1623          for (i = 0; i < size; i++)          for (i = 0; i < size; i++)
1624                  ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);                  ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);
1625    
1626     read_skipped:
1627          ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK);          ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK);
1628          ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE);          ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE);
1629          ice->eeprom.gpiodir = eeprom_triple(ice, ICE_EEP2_GPIO_DIR);          ice->eeprom.gpiodir = eeprom_triple(ice, ICE_EEP2_GPIO_DIR);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26