Changeset 250 for GPL/branches/alsa-resync1/alsa-kernel/pci
- Timestamp:
- Aug 27, 2007, 7:41:50 PM (18 years ago)
- Location:
- GPL/branches/alsa-resync1/alsa-kernel/pci
- Files:
-
- 2 added
- 1 deleted
- 17 edited
-
cs4281.c (modified) (7 diffs)
-
es1968.c (modified) (1 diff)
-
ice1712/ak4xxx.c (modified) (3 diffs)
-
ice1712/aureon.c (added)
-
ice1712/aureon.h (added)
-
ice1712/ews.c (modified) (4 diffs)
-
ice1712/ice1712.c (modified) (12 diffs)
-
ice1712/ice1712.h (modified) (1 diff)
-
ice1712/ice1724.c (modified) (17 diffs)
-
ice1712/makefile.os2 (modified) (1 diff)
-
ice1712/revo.c (modified) (4 diffs)
-
korg1212/korg1212.c (modified) (2 diffs)
-
maestro3.c (modified) (2 diffs)
-
rme96.c (modified) (5 diffs)
-
rme9652/hammerfall_mem.c (deleted)
-
rme9652/hdsp.c (modified) (48 diffs)
-
rme9652/makefile.os2 (modified) (1 diff)
-
rme9652/rme9652.c (modified) (3 diffs)
-
sonicvibes.c (modified) (3 diffs)
-
ymfpci/ymfpci_main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/pci/cs4281.c
r212 r250 27 27 #include <linux/pci.h> 28 28 #include <linux/slab.h> 29 #ifndef TARGET_OS2 //TODO: Implement linux/gameport.h 30 #include <linux/gameport.h> 31 #endif /* TARGET_OS2 */ 29 32 #include <sound/core.h> 30 33 #include <sound/control.h> … … 36 39 #include <sound/initval.h> 37 40 38 #ifndef LINUX_2_239 #include <linux/gameport.h>40 #endif41 41 42 42 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 1247 1247 */ 1248 1248 1249 #if ndef LINUX_2_21249 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1250 1250 1251 1251 typedef struct snd_cs4281_gameport { … … 1342 1342 static int snd_cs4281_free(cs4281_t *chip) 1343 1343 { 1344 #if ndef LINUX_2_21344 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1345 1345 if (chip->gameport) { 1346 1346 gameport_unregister_port(&chip->gameport->info); … … 1730 1730 chip->uartm |= CS4281_MODE_OUTPUT; 1731 1731 chip->midcr |= BA0_MIDCR_TXE; 1732 chip->midi_input = substream;1732 chip->midi_output = substream; 1733 1733 if (!(chip->uartm & CS4281_MODE_INPUT)) { 1734 1734 snd_cs4281_midi_reset(chip); … … 1913 1913 /* EOI to the PCI part... reenables interrupts */ 1914 1914 snd_cs4281_pokeBA0(chip, BA0_HICR, BA0_HICR_EOI); 1915 1915 1916 return IRQ_HANDLED; 1916 1917 … … 1991 1992 return err; 1992 1993 } 1993 #ifndef LINUX_2_21994 #ifndef TARGET_OS2 1994 1995 snd_cs4281_gameport(chip); 1995 #endif 1996 #endif /* !TARGET_OS2 */ 1996 1997 strcpy(card->driver, "CS4281"); 1997 1998 strcpy(card->shortname, "Cirrus Logic CS4281"); -
GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c
r212 r250 667 667 } 668 668 669 #define big_mdelay(msec) do {\ 670 set_current_state(TASK_UNINTERRUPTIBLE);\ 671 schedule_timeout(((msec) * HZ + 999) / 1000);\ 672 } while (0) 673 669 674 /* Wait for the codec bus to be free */ 670 675 static int snd_es1968_ac97_wait(es1968_t *chip) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ak4xxx.c
r246 r250 28 28 #include <linux/init.h> 29 29 #include <sound/core.h> 30 #include <sound/initval.h> 30 31 #include "ice1712.h" 32 33 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 34 MODULE_DESCRIPTION("ICEnsemble ICE17xx <-> AK4xxx AD/DA chip interface"); 35 MODULE_LICENSE("GPL"); 36 MODULE_CLASSES("{sound}"); 31 37 32 38 static void snd_ice1712_akm4xxx_lock(akm4xxx_t *ak, int chip) … … 98 104 } 99 105 100 /* save the data */101 if (ak->type == SND_AK4524 || ak->type == SND_AK4528) {102 if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)103 ak->images[chip][addr] = data;104 else105 ak->ipga_gain[chip][addr-4] = data;106 } else {107 /* AK4529, or else */108 ak->images[chip][addr] = data;109 }110 111 106 if (priv->cs_mask == priv->cs_addr) { 112 107 if (priv->cif) { … … 180 175 return 0; 181 176 } 177 178 EXPORT_SYMBOL(snd_ice1712_akm4xxx_init); 179 EXPORT_SYMBOL(snd_ice1712_akm4xxx_free); 180 EXPORT_SYMBOL(snd_ice1712_akm4xxx_build_controls); -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c
r246 r250 390 390 */ 391 391 392 /* 6fire specific */ 393 #define PCF9554_REG_INPUT 0 394 #define PCF9554_REG_OUTPUT 1 395 #define PCF9554_REG_POLARITY 2 396 #define PCF9554_REG_CONFIG 3 397 398 static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data); 399 392 400 static int __devinit snd_ice1712_ews_init(ice1712_t *ice) 393 401 { … … 426 434 return err; 427 435 } 436 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); 428 437 break; 429 438 case ICE1712_SUBDEVICE_EWS88MT: … … 450 459 if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0) 451 460 return err; 461 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); 452 462 break; 453 463 case ICE1712_SUBDEVICE_DMX6FIRE: 454 464 if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0) 455 465 return err; 466 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); 456 467 break; 457 468 case ICE1712_SUBDEVICE_EWS88MT: … … 750 761 * DMX 6Fire specific controls 751 762 */ 752 753 #define PCF9554_REG_INPUT 0754 #define PCF9554_REG_OUTPUT 1755 #define PCF9554_REG_POLARITY 2756 #define PCF9554_REG_CONFIG 3757 763 758 764 static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c
r246 r250 119 119 120 120 /* 121 * AK4xxx stuff122 */123 124 #include "ak4xxx.c"125 126 /*127 121 * Basic I/O 128 122 */ … … 305 299 { 306 300 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data); 301 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 307 302 } 308 303 … … 310 305 { 311 306 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); 307 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 312 308 } 313 309 … … 320 316 { 321 317 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val); 318 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 322 319 } 323 320 … … 667 664 return 0; 668 665 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); 666 if (ptr == runtime->buffer_size) 667 ptr = 0; 669 668 return bytes_to_frames(substream->runtime, ptr); 670 669 } … … 684 683 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - 685 684 ice->playback_con_virt_addr[substream->number]; 685 if (ptr == substream->runtime->buffer_size) 686 ptr = 0; 686 687 return bytes_to_frames(substream->runtime, ptr); 687 688 } … … 695 696 return 0; 696 697 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; 698 if (ptr == substream->runtime->buffer_size) 699 ptr = 0; 697 700 return bytes_to_frames(substream->runtime, ptr); 698 701 } … … 1105 1108 return 0; 1106 1109 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); 1110 if (ptr == substream->runtime->buffer_size) 1111 ptr = 0; 1107 1112 return bytes_to_frames(substream->runtime, ptr); 1108 1113 } … … 1116 1121 return 0; 1117 1122 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); 1123 if (ptr == substream->runtime->buffer_size) 1124 ptr = 0; 1118 1125 return bytes_to_frames(substream->runtime, ptr); 1119 1126 } … … 2152 2159 { 2153 2160 int dev = 0xa0; /* EEPROM device address */ 2154 unsigned int i ;2161 unsigned int i, size; 2155 2162 2156 2163 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) == 0) { … … 2163 2170 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); 2164 2171 ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); 2165 if (ice->eeprom.size > 32) { 2172 if (ice->eeprom.size < 6) 2173 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ 2174 else if (ice->eeprom.size > 32) { 2166 2175 snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); 2167 2176 return -EIO; … … 2172 2181 /* return -EIO; */ 2173 2182 } 2174 for (i = 0; i < ice->eeprom.size; i++) 2183 size = ice->eeprom.size - 6; 2184 for (i = 0; i < size; i++) 2175 2185 ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); 2176 2186 -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h
r246 r250 457 457 int (*build_controls)(ice1712_t *); 458 458 int no_mpu401: 1; 459 unsigned int eeprom_size; 460 unsigned char *eeprom_data; 459 461 }; 460 462 -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c
r246 r250 43 43 #include "amp.h" 44 44 #include "revo.h" 45 #include "aureon.h" 45 46 46 47 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 51 52 REVO_DEVICE_DESC 52 53 AMP_AUDIO2000_DEVICE_DESC 54 AUREON_DEVICE_DESC 53 55 "{VIA,VT1724}," 54 56 "{ICEnsemble,Generic ICE1724}," … … 89 91 90 92 /* 91 * AK4xxx stuff92 */93 94 #include "ak4xxx.c"95 96 /*97 93 * Basic I/O 98 94 */ … … 123 119 if (!(old_cmd & VT1724_AC97_READY)) 124 120 continue; 125 return 0; 126 } 121 return old_cmd; 122 } 123 snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n"); 127 124 return old_cmd; 128 125 } … … 134 131 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0) 135 132 return 0; 133 snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n"); 136 134 return -EIO; 137 135 } … … 145 143 146 144 old_cmd = snd_vt1724_ac97_ready(ice); 145 old_cmd &= ~VT1724_AC97_ID_MASK; 146 old_cmd |= ac97->num; 147 147 outb(reg, ICEMT1724(ice, AC97_INDEX)); 148 148 outw(val, ICEMT1724(ice, AC97_DATA)); 149 old_cmd &= ~(VT1724_AC97_PBK_VSR | VT1724_AC97_CAP_VSR);150 149 outb(old_cmd | VT1724_AC97_WRITE, ICEMT1724(ice, AC97_CMD)); 151 150 snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE); … … 158 157 159 158 old_cmd = snd_vt1724_ac97_ready(ice); 159 old_cmd &= ~VT1724_AC97_ID_MASK; 160 old_cmd |= ac97->num; 160 161 outb(reg, ICEMT1724(ice, AC97_INDEX)); 161 162 outb(old_cmd | VT1724_AC97_READ, ICEMT1724(ice, AC97_CMD)); … … 174 175 { 175 176 outl(data, ICEREG1724(ice, GPIO_DIRECTION)); 177 inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ 176 178 } 177 179 … … 181 183 outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); 182 184 outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); 185 inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ 183 186 } 184 187 … … 187 190 outw(data, ICEREG1724(ice, GPIO_DATA)); 188 191 outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); 192 inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ 189 193 } 190 194 … … 417 421 if (val != old) { 418 422 outb(val, ICEMT1724(ice, I2S_FORMAT)); 419 /* FIXME: is this revo only? */ 420 /* assert PRST# to converters; MT05 bit 7 */ 421 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 422 spin_unlock_irqrestore(&ice->reg_lock, flags); 423 mdelay(5); 424 spin_lock_irqsave(&ice->reg_lock, flags); 425 /* deassert PRST# */ 426 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 423 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) { 424 /* FIXME: is this revo only? */ 425 /* assert PRST# to converters; MT05 bit 7 */ 426 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 427 spin_unlock_irqrestore(&ice->reg_lock, flags); 428 mdelay(5); 429 spin_lock_irqsave(&ice->reg_lock, flags); 430 /* deassert PRST# */ 431 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 432 } 427 433 } 428 434 } … … 885 891 if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { 886 892 ac97_t ac97; 893 /* cold reset */ 894 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 895 mdelay(5); /* FIXME */ 896 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 897 887 898 memset(&ac97, 0, sizeof(ac97)); 888 899 ac97.write = snd_vt1724_ac97_write; … … 1541 1552 */ 1542 1553 1554 static struct snd_ice1712_card_info no_matched __devinitdata; 1555 1556 static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 1557 snd_vt1724_revo_cards, 1558 snd_vt1724_amp_cards, 1559 snd_vt1724_aureon_cards, 1560 0, 1561 }; 1562 1563 1564 /* 1565 */ 1566 1543 1567 static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice, 1544 1568 unsigned char dev, … … 1556 1580 { 1557 1581 int dev = 0xa0; /* EEPROM device address */ 1558 unsigned int i; 1582 unsigned int i, size; 1583 struct snd_ice1712_card_info **tbl, *c; 1559 1584 1560 1585 if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) { … … 1566 1591 (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | 1567 1592 (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: 1568 1610 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); 1569 if (ice->eeprom.size > 32) { 1611 if (ice->eeprom.size < 6) 1612 ice->eeprom.size = 32; 1613 else if (ice->eeprom.size > 32) { 1570 1614 snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); 1571 1615 return -EIO; … … 1576 1620 // return -EIO; 1577 1621 } 1578 for (i = 0; i < ice->eeprom.size; i++) 1622 size = ice->eeprom.size - 6; 1623 for (i = 0; i < size; i++) 1579 1624 ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6); 1580 1625 1626 read_skipped: 1581 1627 ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK); 1582 1628 ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE); … … 1804 1850 */ 1805 1851 1806 static struct snd_ice1712_card_info no_matched __devinitdata;1807 1808 static struct snd_ice1712_card_info *card_tables[] __devinitdata = {1809 snd_vt1724_revo_cards,1810 snd_vt1724_amp_cards,1811 0,1812 };1813 1814 1815 1852 static int __devinit snd_vt1724_probe(struct pci_dev *pci, 1816 1853 const struct pci_device_id *pci_id) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/makefile.os2
r246 r250 15 15 FILE1 = ak4xxx.obj delta.obj ews.obj hoontech.obj ice1712.obj 16 16 FILE2 = ice1724.obj revo.obj 17 FILE3 = 17 FILE3 = aureon.obj 18 18 FILE4 = 19 19 FILE5 = -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/revo.c
r246 r250 60 60 shift = 3; 61 61 } 62 tmp = ak->images[0][reg];62 tmp = snd_akm4xxx_get(ak, 0, reg); 63 63 old = (tmp >> shift) & 0x03; 64 64 if (old == dfs) … … 67 67 /* reset DFS */ 68 68 snd_akm4xxx_reset(ak, 1); 69 tmp = ak->images[0][reg];69 tmp = snd_akm4xxx_get(ak, 0, reg); 70 70 tmp &= ~(0x03 << shift); 71 71 tmp |= dfs << shift; … … 122 122 { 123 123 akm4xxx_t *ak; 124 int err; 124 125 125 126 /* determine I2C, DACs and ADCs */ … … 140 141 switch (ice->eeprom.subvendor) { 141 142 case VT1724_SUBDEVICE_REVOLUTION71: 142 snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice); 143 snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice); 143 if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0) 144 return err; 145 if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0) 146 return err; 144 147 /* unmute all codecs */ 145 148 snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE); -
GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c
r246 r250 1145 1145 1146 1146 if (!doorbellValue) 1147 return IRQ_ HANDLED;1147 return IRQ_NONE; 1148 1148 1149 1149 spin_lock(&korg1212->lock); … … 1219 1219 1220 1220 spin_unlock(&korg1212->lock); 1221 1221 1222 return IRQ_HANDLED; 1222 1223 } -
GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c
r212 r250 44 44 #include <sound/control.h> 45 45 #include <sound/pcm.h> 46 #include <sound/mpu401.h> 46 47 #include <sound/ac97_codec.h> 47 48 #define SNDRV_GET_ID … … 1055 1056 */ 1056 1057 1058 #define big_mdelay(msec) do {\ 1059 set_current_state(TASK_UNINTERRUPTIBLE);\ 1060 schedule_timeout(((msec) * HZ) / 1000);\ 1061 } while (0) 1062 1057 1063 inline static void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg) 1058 1064 { -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c
r246 r250 807 807 switch (mode) { 808 808 case RME96_CLOCKMODE_SLAVE: 809 /* AutoSync */ 809 810 rme96->wcreg &= ~RME96_WCR_MASTER; 810 811 rme96->areg &= ~RME96_AR_WSEL; 811 812 break; 812 813 case RME96_CLOCKMODE_MASTER: 814 /* Internal */ 813 815 rme96->wcreg |= RME96_WCR_MASTER; 814 816 rme96->areg &= ~RME96_AR_WSEL; … … 1319 1321 1320 1322 runtime->hw = snd_rme96_capture_adat_info; 1321 if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {1323 if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) { 1322 1324 /* makes no sense to use analog input. Note that analog 1323 1325 expension cards AEB4/8-I are RME96_INPUT_INTERNAL */ … … 1863 1865 } 1864 1866 if (rme96->areg & RME96_AR_WSEL) { 1865 snd_iprintf(buffer, " clock mode: word clock\n");1867 snd_iprintf(buffer, " sample clock source: word clock\n"); 1866 1868 } else if (rme96->wcreg & RME96_WCR_MASTER) { 1867 snd_iprintf(buffer, " clock mode: master\n");1869 snd_iprintf(buffer, " sample clock source: internal\n"); 1868 1870 } else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) { 1869 snd_iprintf(buffer, " clock mode: slave (masteranyway due to analog input setting)\n");1871 snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to analog input setting)\n"); 1870 1872 } else if (snd_rme96_capture_getrate(rme96, &n) < 0) { 1871 snd_iprintf(buffer, " clock mode: slave (masteranyway due to no valid signal)\n");1873 snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to no valid signal)\n"); 1872 1874 } else { 1873 snd_iprintf(buffer, " clock mode: slave\n");1875 snd_iprintf(buffer, " sample clock source: autosync\n"); 1874 1876 } 1875 1877 if (rme96->wcreg & RME96_WCR_PRO) { … … 2102 2104 snd_rme96_info_clockmode_control(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2103 2105 { 2104 static char *texts[3] = { " Slave", "Master", "Wordclock" };2106 static char *texts[3] = { "AutoSync", "Internal", "Word" }; 2105 2107 2106 2108 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; … … 2425 2427 { 2426 2428 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2427 .name = " Clock Mode",2429 .name = "Sample Clock Source", 2428 2430 .info = snd_rme96_info_clockmode_control, 2429 2431 .get = snd_rme96_get_clockmode_control, -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c
r246 r250 23 23 24 24 #include <sound/driver.h> 25 #include <linux/init.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/interrupt.h> … … 76 77 #define MULTIFACE_SS_CHANNELS 18 77 78 #define MULTIFACE_DS_CHANNELS 14 79 #define H9652_DS_CHANNELS 26 80 #define H9652_SS_CHANNELS 14 78 81 79 82 /* Write registers. These are defined as byte-offsets from the iobase value. … … 85 88 #define HDSP_interruptConfirmation 96 86 89 #define HDSP_outputEnable 128 87 #define HDSP_ jtagReg25690 #define HDSP_control2Reg 256 88 91 #define HDSP_midiDataOut0 352 89 92 #define HDSP_midiDataOut1 356 … … 121 124 #define HDSP_IO_EXTENT 5192 122 125 123 /* jtagregister bits */126 /* control2 register bits */ 124 127 125 128 #define HDSP_TMS 0x01 … … 134 137 #define HDSP_BIGENDIAN_MODE 0x200 135 138 #define HDSP_RD_MULTIPLE 0x400 139 #define HDSP_9652_ENABLE_MIXER 0x800 136 140 137 141 #define HDSP_S_PROGRAM (HDSP_PROGRAM|HDSP_CONFIG_MODE_0) … … 359 363 struct tasklet_struct midi_tasklet; 360 364 int precise_ptr; 361 u32 control_register; /* cached value */ 365 u32 control_register; /* cached value */ 366 u32 control2_register; /* cached value */ 362 367 u32 creg_spdif; 363 368 u32 creg_spdif_stream; 364 char *card_name; /* digiface/multiface */369 char *card_name; /* digiface/multiface */ 365 370 HDSP_IO_Type io_type; /* ditto, but for code use */ 366 371 unsigned short firmware_rev; 367 372 unsigned short state; /* stores state bits */ 368 373 u32 firmware_cache[24413]; /* this helps recover from accidental iobox power failure */ 369 size_t period_bytes; /* guess what this is */374 size_t period_bytes; /* guess what this is */ 370 375 unsigned char ds_channels; 371 376 unsigned char ss_channels; /* different for multiface/digiface */ … … 434 439 435 440 #ifdef HDSP_PREALLOCATE_MEMORY 436 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr); 437 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr); 441 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 442 { 443 struct snd_dma_device pdev; 444 struct snd_dma_buffer dmbuf; 445 446 snd_dma_device_pci(&pdev, pci, capture); 447 dmbuf.bytes = 0; 448 if (! snd_dma_get_reserved(&pdev, &dmbuf)) { 449 if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0) 450 return NULL; 451 snd_dma_set_reserved(&pdev, &dmbuf); 452 } 453 *addrp = dmbuf.addr; 454 return dmbuf.area; 455 } 456 457 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 458 { 459 struct snd_dma_device dev; 460 snd_dma_device_pci(&dev, pci, capture); 461 snd_dma_free_reserved(&dev); 462 } 463 464 #else 465 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 466 { 467 return snd_malloc_pci_pages(pci, size, addrp); 468 } 469 470 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 471 { 472 snd_free_pci_pages(pci, size, ptr, addr); 473 } 438 474 #endif 439 475 … … 453 489 static int __devinit snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp); 454 490 static int __devinit snd_hdsp_create_pcm(snd_card_t *card, hdsp_t *hdsp); 455 static inline int snd_hdsp_ initialize_input_enable(hdsp_t *hdsp);491 static inline int snd_hdsp_enable_io (hdsp_t *hdsp); 456 492 static inline void snd_hdsp_initialize_midi_flush (hdsp_t *hdsp); 457 493 static inline void snd_hdsp_initialize_channels (hdsp_t *hdsp); … … 461 497 static int snd_hdsp_set_defaults(hdsp_t *hdsp); 462 498 463 static inline int hdsp_is_9652 (hdsp_t *hdsp)464 {465 switch (hdsp->firmware_rev) {466 case 0x64:467 case 0x65:468 case 0x68:469 return 1;470 default:471 return 0;472 }473 }474 475 499 static inline int hdsp_playback_to_output_key (hdsp_t *hdsp, int in, int out) 476 500 { … … 505 529 static inline int hdsp_check_for_iobox (hdsp_t *hdsp) 506 530 { 531 532 if (hdsp->io_type == H9652) return 0; 507 533 if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { 508 534 snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); … … 511 537 } 512 538 return 0; 539 513 540 } 514 541 … … 522 549 snd_printk ("loading firmware\n"); 523 550 524 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_PROGRAM);551 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); 525 552 hdsp_write (hdsp, HDSP_fifoData, 0); 526 553 … … 530 557 } 531 558 532 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);559 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 533 560 534 561 for (i = 0; i < 24413; ++i) { … … 545 572 } 546 573 547 hdsp_write (hdsp, HDSP_jtagReg, 0); 574 #ifdef SNDRV_BIG_ENDIAN 575 hdsp->control2_register = HDSP_BIGENDIAN_MODE; 576 #else 577 hdsp->control2_register = 0; 578 #endif 579 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 548 580 snd_printk ("finished firmware loading\n"); 549 581 … … 575 607 } 576 608 577 if ((err = snd_hdsp_ initialize_input_enable(hdsp)) < 0) {609 if ((err = snd_hdsp_enable_io(hdsp)) < 0) { 578 610 return err; 579 611 } … … 581 613 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 582 614 583 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_PROGRAM);615 hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); 584 616 hdsp_write (hdsp, HDSP_fifoData, 0); 585 617 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) { … … 587 619 } 588 620 589 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);621 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 590 622 hdsp_write (hdsp, HDSP_fifoData, 0); 591 623 592 624 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT)) { 593 625 hdsp->io_type = Multiface; 594 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_VERSION_BIT);595 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);626 hdsp_write (hdsp, HDSP_control2Reg, HDSP_VERSION_BIT); 627 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 596 628 hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); 597 629 } else { … … 658 690 unsigned int ad; 659 691 660 if (hdsp_is_9652 (hdsp)) { 661 662 if ((ad = addr/2) < 676) { 663 664 /* from martin björnsen: 665 666 "You can only write dwords to the 667 mixer memory which contain two 668 mixer values in the low and high 669 word. So if you want to change 670 value 0 you have to read value 1 671 from the cache and write both to 672 the first dword in the mixer 673 memory." 674 */ 675 676 hdsp->mixer_matrix[addr] = data; 677 hdsp_write (hdsp, 1024 + ad, 678 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 679 hdsp->mixer_matrix[addr&0x7fe]); 680 return 0; 681 } else { 682 return -1; 683 } 692 if (addr >= HDSP_MATRIX_MIXER_SIZE) 693 return -1; 684 694 695 if (hdsp->io_type == H9652) { 696 697 /* from martin björnsen: 698 699 "You can only write dwords to the 700 mixer memory which contain two 701 mixer values in the low and high 702 word. So if you want to change 703 value 0 you have to read value 1 704 from the cache and write both to 705 the first dword in the mixer 706 memory." 707 */ 708 709 hdsp->mixer_matrix[addr] = data; 710 711 /* `addr' addresses a 16-bit wide address, but 712 the address space accessed via hdsp_write 713 uses byte offsets. put another way, addr 714 varies from 0 to 1351, but to access the 715 corresponding memory location, we need 716 to access 0 to 2703 ... 717 */ 718 719 hdsp_write (hdsp, 4096 + (addr*2), 720 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 721 hdsp->mixer_matrix[addr&0x7fe]); 722 723 return 0; 685 724 686 725 } else { 687 if (addr >= HDSP_MATRIX_MIXER_SIZE) 688 return -1; 689 726 690 727 ad = (addr << 16) + data; 691 728 … … 830 867 int rate_bits; 831 868 869 /* ASSUMPTION: hdsp->lock is either help, or 870 there is no need for it (e.g. during module 871 initialization). 872 */ 873 832 874 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 833 875 if (called_internally) { … … 861 903 is to flag rate changes in the read/write routines. */ 862 904 863 spin_lock_irq(&hdsp->lock);864 865 905 switch (rate) { 866 906 case 32000: … … 901 941 break; 902 942 default: 903 spin_unlock_irq(&hdsp->lock);904 943 return -EINVAL; 905 944 } … … 909 948 hdsp->capture_pid, 910 949 hdsp->playback_pid); 911 spin_unlock_irq(&hdsp->lock);912 950 return -EBUSY; 913 951 } … … 925 963 break; 926 964 case Digiface: 965 case H9652: 927 966 hdsp->channel_map = channel_map_df_ss; 928 967 break; … … 939 978 } 940 979 941 spin_unlock_irq(&hdsp->lock);942 980 return 0; 943 981 } … … 1132 1170 hdsp_midi_t *hmidi; 1133 1171 unsigned long flags; 1172 u32 ie; 1134 1173 1135 1174 hmidi = (hdsp_midi_t *) substream->rmidi->private_data; 1136 1175 hdsp = hmidi->hdsp; 1176 ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable; 1137 1177 spin_lock_irqsave (&hdsp->lock, flags); 1138 1178 if (up) { 1139 snd_hdsp_flush_midi_input (hdsp, hmidi->id); 1140 if (hmidi->id) 1141 hdsp->control_register |= HDSP_Midi1InterruptEnable; 1142 else 1143 hdsp->control_register |= HDSP_Midi0InterruptEnable; 1179 if (!(hdsp->control_register & ie)) { 1180 snd_hdsp_flush_midi_input (hdsp, hmidi->id); 1181 hdsp->control_register |= ie; 1182 } 1144 1183 } else { 1145 if (hmidi->id) 1146 hdsp->control_register &= ~HDSP_Midi1InterruptEnable; 1147 else 1148 hdsp->control_register &= ~HDSP_Midi0InterruptEnable; 1184 hdsp->control_register &= ~ie; 1149 1185 } 1150 1186 … … 2005 2041 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2006 2042 uinfo->count = 1; 2007 uinfo->value.enumerated.items = (hdsp->io_type == Digiface) ? 6 : 4; 2043 2044 switch (hdsp->io_type) { 2045 case Digiface: 2046 case H9652: 2047 uinfo->value.enumerated.items = 6; 2048 break; 2049 case Multiface: 2050 uinfo->value.enumerated.items = 4; 2051 default: 2052 uinfo->value.enumerated.items = 0; 2053 break; 2054 } 2055 2008 2056 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2009 2057 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; … … 2029 2077 if (!snd_hdsp_use_is_exclusive(hdsp)) 2030 2078 return -EBUSY; 2031 max = (hdsp->io_type == Digiface) ? 6 : 4; 2079 2080 switch (hdsp->io_type) { 2081 case Digiface: 2082 case H9652: 2083 max = 6; 2084 break; 2085 case Multiface: 2086 max = 4; 2087 break; 2088 default: 2089 return -EIO; 2090 } 2091 2032 2092 val = ucontrol->value.enumerated.item[0] % max; 2033 2093 spin_lock_irqsave(&hdsp->lock, flags); … … 2497 2557 2498 2558 offset = ucontrol->id.index - 1; 2499 snd_assert(offset >= 0 || offset < ((hdsp->io_type == Digiface) ? 3 : 1), return -EINVAL); 2559 snd_assert(offset >= 0); 2560 2561 switch (hdsp->io_type) { 2562 case Digiface: 2563 case H9652: 2564 if (offset >= 3) 2565 return -EINVAL; 2566 break; 2567 case Multiface: 2568 if (offset >= 1) 2569 return -EINVAL; 2570 break; 2571 default: 2572 return -EIO; 2573 } 2574 2500 2575 ucontrol->value.enumerated.item[0] = hdsp_adat_sync_check(hdsp, offset); 2501 2576 return 0; … … 2594 2669 2595 2670 for (idx = 0; idx < HDSP_CONTROLS; idx++) { 2596 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) 2671 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) { 2597 2672 return err; 2673 } 2598 2674 if (idx == 1) /* IEC958 (S/PDIF) Stream */ 2599 2675 hdsp->spdif_ctl = kctl; … … 2603 2679 snd_hdsp_adat_sync_check.name = "ADAT Lock Status"; 2604 2680 2605 if (hdsp->io_type == Digiface) { 2681 switch (hdsp->io_type) { 2682 case Digiface: 2606 2683 limit = DIGIFACE_SS_CHANNELS; 2607 } else { 2684 break; 2685 case H9652: 2686 limit = H9652_SS_CHANNELS; 2687 break; 2688 case Multiface: 2608 2689 limit = MULTIFACE_SS_CHANNELS; 2690 break; 2691 default: 2692 return -EIO; 2609 2693 } 2610 2694 … … 2628 2712 return err; 2629 2713 } 2630 if (hdsp->io_type == Digiface ) {2714 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { 2631 2715 for (idx = 1; idx < 3; ++idx) { 2632 2716 snd_hdsp_adat_sync_check.index = idx+1; … … 2682 2766 hdsp->irq, hdsp->port, hdsp->iobase); 2683 2767 snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register); 2768 snd_iprintf(buffer, "Control2 register: 0x%x\n", hdsp->control2_register); 2684 2769 snd_iprintf(buffer, "Status register: 0x%x\n", status); 2685 2770 snd_iprintf(buffer, "Status2 register: 0x%x\n", status2); … … 2855 2940 switch (hdsp->io_type) { 2856 2941 case Digiface: 2942 case H9652: 2857 2943 x = status & HDSP_Sync1; 2858 2944 if (status & HDSP_Lock1) { … … 2914 3000 { 2915 3001 if (hdsp->capture_buffer_unaligned) { 2916 #ifndef HDSP_PREALLOCATE_MEMORY 2917 snd_free_pci_pages(hdsp->pci, 2918 HDSP_DMA_AREA_BYTES, 2919 hdsp->capture_buffer_unaligned, 2920 hdsp->capture_buffer_addr); 2921 #else 2922 snd_hammerfall_free_buffer(hdsp->pci, hdsp->capture_buffer_unaligned); 2923 #endif 3002 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, 3003 hdsp->capture_buffer_unaligned, 3004 hdsp->capture_buffer_addr, 1); 2924 3005 } 2925 3006 2926 3007 if (hdsp->playback_buffer_unaligned) { 2927 #ifndef HDSP_PREALLOCATE_MEMORY 2928 snd_free_pci_pages(hdsp->pci, 2929 HDSP_DMA_AREA_BYTES, 2930 hdsp->playback_buffer_unaligned, 2931 hdsp->playback_buffer_addr); 2932 #else 2933 snd_hammerfall_free_buffer(hdsp->pci, hdsp->playback_buffer_unaligned); 2934 #endif 3008 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, 3009 hdsp->playback_buffer_unaligned, 3010 hdsp->playback_buffer_addr, 0); 2935 3011 } 2936 3012 } … … 2942 3018 unsigned long pb_bus, cb_bus; 2943 3019 2944 #ifndef HDSP_PREALLOCATE_MEMORY 2945 cb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr); 2946 pb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr); 2947 #else 2948 cb = snd_hammerfall_get_buffer(hdsp->pci, &cb_addr); 2949 pb = snd_hammerfall_get_buffer(hdsp->pci, &pb_addr); 2950 #endif 3020 cb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr, 1); 3021 pb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr, 0); 2951 3022 2952 3023 if (cb == 0 || pb == 0) { 2953 3024 if (cb) { 2954 #ifdef HDSP_PREALLOCATE_MEMORY 2955 snd_hammerfall_free_buffer(hdsp->pci, cb); 2956 #else 2957 snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr); 2958 #endif 3025 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr, 1); 2959 3026 } 2960 3027 if (pb) { 2961 #ifdef HDSP_PREALLOCATE_MEMORY 2962 snd_hammerfall_free_buffer(hdsp->pci, pb); 2963 #else 2964 snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr); 2965 #endif 3028 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr, 0); 2966 3029 } 2967 3030 … … 3026 3089 } 3027 3090 3028 for (i = 0; i < (hdsp _is_9652(hdsp)? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {3091 for (i = 0; i < (hdsp->io_type == H9652 ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) { 3029 3092 if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) { 3030 3093 return -EIO; … … 3032 3095 } 3033 3096 3034 if ( !hdsp_is_9652(hdsp) && line_outs_monitor[hdsp->dev]) {3097 if ((hdsp->io_type != H9652) && line_outs_monitor[hdsp->dev]) { 3035 3098 3036 3099 snd_printk ("sending all inputs and playback streams to line outs.\n"); … … 3292 3355 */ 3293 3356 3357 spin_lock_irq(&hdsp->lock); 3294 3358 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { 3359 spin_unlock_irq(&hdsp->lock); 3295 3360 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); 3296 3361 return err; 3362 } else { 3363 spin_unlock_irq(&hdsp->lock); 3297 3364 } 3298 3365 … … 3784 3851 break; 3785 3852 case SNDRV_HDSP_IOCTL_GET_VERSION: 3786 if (hdsp _is_9652(hdsp)) return -EINVAL;3853 if (hdsp->io_type == H9652) return -EINVAL; 3787 3854 if (hdsp->io_type == Undefined) { 3788 3855 if ((err = hdsp_get_iobox_version(hdsp)) < 0) { … … 3797 3864 break; 3798 3865 case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: 3799 if (hdsp _is_9652(hdsp)) return -EINVAL;3866 if (hdsp->io_type == H9652) return -EINVAL; 3800 3867 /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ 3801 3868 if (hdsp->io_type == Undefined) return -EINVAL; … … 3905 3972 } 3906 3973 3907 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp) 3974 static inline void snd_hdsp_9652_enable_mixer (hdsp_t *hdsp) 3975 { 3976 hdsp->control2_register |= HDSP_9652_ENABLE_MIXER; 3977 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 3978 } 3979 3980 static inline void snd_hdsp_9652_disable_mixer (hdsp_t *hdsp) 3981 { 3982 hdsp->control2_register &= ~HDSP_9652_ENABLE_MIXER; 3983 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 3984 } 3985 3986 static inline int snd_hdsp_enable_io (hdsp_t *hdsp) 3908 3987 { 3909 3988 int i; … … 3923 4002 static inline void snd_hdsp_initialize_channels(hdsp_t *hdsp) 3924 4003 { 3925 if (hdsp->io_type == Digiface) { 4004 switch (hdsp->io_type) { 4005 case Digiface: 3926 4006 hdsp->card_name = "RME Hammerfall DSP + Digiface"; 3927 4007 hdsp->ss_channels = DIGIFACE_SS_CHANNELS; 3928 4008 hdsp->ds_channels = DIGIFACE_DS_CHANNELS; 3929 } else { 4009 break; 4010 4011 case H9652: 4012 hdsp->card_name = "RME Hammerfall HDSP 9652"; 4013 hdsp->ss_channels = H9652_SS_CHANNELS; 4014 hdsp->ds_channels = H9652_DS_CHANNELS; 4015 break; 4016 4017 case Multiface: 3930 4018 hdsp->card_name = "RME Hammerfall DSP + Multiface"; 3931 4019 hdsp->ss_channels = MULTIFACE_SS_CHANNELS; 3932 4020 hdsp->ds_channels = MULTIFACE_DS_CHANNELS; 4021 4022 default: 4023 /* should never get here */ 4024 break; 3933 4025 } 3934 4026 } … … 3938 4030 snd_hdsp_flush_midi_input (hdsp, 0); 3939 4031 snd_hdsp_flush_midi_input (hdsp, 1); 3940 3941 #ifdef SNDRV_BIG_ENDIAN3942 hdsp_write(hdsp, HDSP_jtagReg, HDSP_BIGENDIAN_MODE);3943 #endif3944 4032 } 3945 4033 … … 4002 4090 int err; 4003 4091 int i; 4092 int is_9652 = 0; 4004 4093 4005 4094 hdsp->irq = -1; … … 4028 4117 strcpy(card->driver, "H-DSP"); 4029 4118 strcpy(card->mixername, "Xilinx FPGA"); 4030 4119 4031 4120 switch (hdsp->firmware_rev & 0xff) { 4032 4121 case 0xa: … … 4034 4123 hdsp->card_name = "RME Hammerfall DSP"; 4035 4124 break; 4125 4036 4126 case 0x64: 4037 4127 case 0x65: 4038 4128 case 0x68: 4039 4129 hdsp->card_name = "RME HDSP 9652"; 4040 break; 4130 is_9652 = 1; 4131 break; 4132 4041 4133 default: 4042 4134 return -ENODEV; 4043 4135 } 4044 4136 4045 if ((err = pci_enable_device(pci)) < 0) 4137 if ((err = pci_enable_device(pci)) < 0) { 4046 4138 return err; 4139 } 4047 4140 4048 4141 pci_set_master(hdsp->pci); … … 4072 4165 } 4073 4166 4074 if (hdsp_is_9652(hdsp)) { 4075 4076 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) { 4077 return err; 4078 } 4079 4080 hdsp->io_type = Digiface; 4081 4082 hdsp->ss_channels = DIGIFACE_SS_CHANNELS; 4083 hdsp->ds_channels = DIGIFACE_DS_CHANNELS; 4084 4085 snd_hdsp_initialize_midi_flush(hdsp); 4086 4167 if (!is_9652 && hdsp_check_for_iobox (hdsp)) { 4168 /* no iobox connected, we defer initialization */ 4169 snd_printk("card initialization pending : waiting for firmware\n"); 4087 4170 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4088 4171 return err; 4089 4172 } 4090 4091 } else {4092 4093 if (hdsp_check_for_iobox (hdsp)) {4094 /* no iobox connected, we defer initialization */4095 snd_printk("card initialization pending : waiting for firmware\n");4096 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {4097 return err;4098 }4099 return 0;4100 }4101 4102 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {4103 return err;4104 }4105 4106 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {4107 snd_printk("card initialization pending : waiting for firmware\n");4108 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {4109 return err;4110 }4111 4173 return 0; 4112 } 4113 4114 snd_printk("Firmware already loaded, initializing card.\n"); 4115 4116 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { 4117 hdsp->io_type = Multiface; 4118 } else { 4119 hdsp->io_type = Digiface; 4120 } 4121 4174 } 4175 4176 if ((err = snd_hdsp_enable_io(hdsp)) != 0) { 4177 return err; 4178 } 4179 4180 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 4181 snd_printk("card initialization pending : waiting for firmware\n"); 4122 4182 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4123 4183 return err; 4124 4184 } 4125 4126 snd_hdsp_initialize_channels(hdsp); 4127 4128 snd_hdsp_initialize_midi_flush(hdsp); 4129 4130 } 4131 4185 return 0; 4186 } 4187 4188 snd_printk("Firmware already loaded, initializing card.\n"); 4189 4190 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { 4191 hdsp->io_type = Multiface; 4192 } else { 4193 hdsp->io_type = Digiface; 4194 } 4195 4196 if (is_9652) { 4197 hdsp->io_type = H9652; 4198 snd_hdsp_9652_enable_mixer (hdsp); 4199 } 4200 4201 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4202 return err; 4203 } 4204 4205 snd_hdsp_initialize_channels(hdsp); 4206 snd_hdsp_initialize_midi_flush(hdsp); 4207 4132 4208 hdsp->state |= HDSP_FirmwareLoaded; 4133 4209 4134 4210 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) { 4135 4211 return err; 4136 4212 } 4137 4213 4138 4214 return 0; 4139 4215 } … … 4202 4278 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 4203 4279 hdsp->port, hdsp->irq); 4204 4280 4205 4281 if ((err = snd_card_register(card)) < 0) { 4206 4282 snd_card_free(card); -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/makefile.os2
r207 r250 13 13 # 14 14 #=================================================================== 15 FILE1 = hammerfall_mem.objrme9652.obj hdsp.obj15 FILE1 = rme9652.obj hdsp.obj 16 16 FILE2 = 17 17 FILE3 = -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c
r246 r250 310 310 311 311 #ifdef RME9652_PREALLOCATE_MEMORY 312 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr); 313 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr); 312 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 313 { 314 struct snd_dma_device pdev; 315 struct snd_dma_buffer dmbuf; 316 317 snd_dma_device_pci(&pdev, pci, capture); 318 dmbuf.bytes = 0; 319 if (! snd_dma_get_reserved(&pdev, &dmbuf)) { 320 if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0) 321 return NULL; 322 snd_dma_set_reserved(&pdev, &dmbuf); 323 } 324 *addrp = dmbuf.addr; 325 return dmbuf.area; 326 } 327 328 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 329 { 330 struct snd_dma_device dev; 331 snd_dma_device_pci(&dev, pci, capture); 332 snd_dma_free_reserved(&dev); 333 } 334 335 #else 336 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 337 { 338 return snd_malloc_pci_pages(pci, size, addrp); 339 } 340 341 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 342 { 343 snd_free_pci_pages(pci, size, ptr, addr); 344 } 314 345 #endif 346 315 347 316 348 static struct pci_device_id snd_rme9652_ids[] __devinitdata = { … … 1810 1842 { 1811 1843 if (rme9652->capture_buffer_unaligned) { 1812 #ifndef RME9652_PREALLOCATE_MEMORY 1813 snd_free_pci_pages(rme9652->pci, 1814 RME9652_DMA_AREA_BYTES, 1815 rme9652->capture_buffer_unaligned, 1816 rme9652->capture_buffer_addr); 1817 #else 1818 snd_hammerfall_free_buffer(rme9652->pci, rme9652->capture_buffer_unaligned); 1819 #endif 1844 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, 1845 rme9652->capture_buffer_unaligned, 1846 rme9652->capture_buffer_addr, 1); 1820 1847 } 1821 1848 1822 1849 if (rme9652->playback_buffer_unaligned) { 1823 #ifndef RME9652_PREALLOCATE_MEMORY 1824 snd_free_pci_pages(rme9652->pci, 1825 RME9652_DMA_AREA_BYTES, 1826 rme9652->playback_buffer_unaligned, 1827 rme9652->playback_buffer_addr); 1828 #else 1829 snd_hammerfall_free_buffer(rme9652->pci, rme9652->playback_buffer_unaligned); 1830 #endif 1850 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, 1851 rme9652->playback_buffer_unaligned, 1852 rme9652->playback_buffer_addr, 0); 1831 1853 } 1832 1854 } … … 1855 1877 unsigned long pb_bus, cb_bus; 1856 1878 1857 #ifndef RME9652_PREALLOCATE_MEMORY 1858 cb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr); 1859 pb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr); 1860 #else 1861 cb = snd_hammerfall_get_buffer(rme9652->pci, &cb_addr); 1862 pb = snd_hammerfall_get_buffer(rme9652->pci, &pb_addr); 1863 #endif 1879 cb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr, 1); 1880 pb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr, 0); 1864 1881 1865 1882 if (cb == 0 || pb == 0) { 1866 1883 if (cb) { 1867 #ifdef RME9652_PREALLOCATE_MEMORY 1868 snd_hammerfall_free_buffer(rme9652->pci, cb); 1869 #else 1870 snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr); 1871 #endif 1884 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr, 1); 1872 1885 } 1873 1886 if (pb) { 1874 #ifdef RME9652_PREALLOCATE_MEMORY 1875 snd_hammerfall_free_buffer(rme9652->pci, pb); 1876 #else 1877 snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr); 1878 #endif 1887 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr, 0); 1879 1888 } 1880 1889 -
GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c
r246 r250 260 260 snd_kcontrol_t *master_volume; 261 261 262 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)262 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 263 263 struct gameport gameport; 264 264 #endif … … 1194 1194 static int snd_sonicvibes_free(sonicvibes_t *sonic) 1195 1195 { 1196 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)1196 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1197 1197 if (sonic->gameport.io) 1198 1198 gameport_unregister_port(&sonic->gameport); … … 1498 1498 return err; 1499 1499 } 1500 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)1500 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1501 1501 sonic->gameport.io = sonic->game_port; 1502 1502 gameport_register_port(&sonic->gameport); -
GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci_main.c
r246 r250 2316 2316 init_waitqueue_head(&chip->interrupt_sleep); 2317 2317 atomic_set(&chip->interrupt_sleep_count, 0); 2318 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 2319 init_MUTEX(&chip->joystick_mutex); 2320 #endif 2318 2321 chip->card = card; 2319 2322 chip->pci = pci;
Note:
See TracChangeset
for help on using the changeset viewer.
