diff options
Diffstat (limited to 'sound/pci/ice1712/ice1724.c')
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 180 |
1 files changed, 96 insertions, 84 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 7bb99df44fd1..1b3f11702713 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -20,9 +20,9 @@ | |||
20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <asm/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
@@ -105,7 +105,7 @@ static unsigned int PRO_RATE_DEFAULT = 44100; | |||
105 | /* | 105 | /* |
106 | * Basic I/O | 106 | * Basic I/O |
107 | */ | 107 | */ |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * default rates, default clock routines | 110 | * default rates, default clock routines |
111 | */ | 111 | */ |
@@ -198,7 +198,7 @@ static void snd_vt1724_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) | |||
198 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | 198 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) |
199 | { | 199 | { |
200 | outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); | 200 | outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); |
201 | if (! ice->vt1720) /* VT1720 supports only 16 GPIO bits */ | 201 | if (!ice->vt1720) /* VT1720 supports only 16 GPIO bits */ |
202 | outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); | 202 | outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); |
203 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ | 203 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ |
204 | } | 204 | } |
@@ -206,7 +206,7 @@ static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | |||
206 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) | 206 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) |
207 | { | 207 | { |
208 | outw(data, ICEREG1724(ice, GPIO_DATA)); | 208 | outw(data, ICEREG1724(ice, GPIO_DATA)); |
209 | if (! ice->vt1720) | 209 | if (!ice->vt1720) |
210 | outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); | 210 | outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); |
211 | inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ | 211 | inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ |
212 | } | 212 | } |
@@ -214,7 +214,7 @@ static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) | |||
214 | static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice) | 214 | static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice) |
215 | { | 215 | { |
216 | unsigned int data; | 216 | unsigned int data; |
217 | if (! ice->vt1720) | 217 | if (!ice->vt1720) |
218 | data = (unsigned int)inb(ICEREG1724(ice, GPIO_DATA_22)); | 218 | data = (unsigned int)inb(ICEREG1724(ice, GPIO_DATA_22)); |
219 | else | 219 | else |
220 | data = 0; | 220 | data = 0; |
@@ -399,7 +399,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
399 | break; | 399 | break; |
400 | } | 400 | } |
401 | #endif | 401 | #endif |
402 | handled = 1; | 402 | handled = 1; |
403 | if (status & VT1724_IRQ_MPU_TX) { | 403 | if (status & VT1724_IRQ_MPU_TX) { |
404 | spin_lock(&ice->reg_lock); | 404 | spin_lock(&ice->reg_lock); |
405 | if (ice->midi_output) | 405 | if (ice->midi_output) |
@@ -468,8 +468,8 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
468 | /* ought to really handle this properly */ | 468 | /* ought to really handle this properly */ |
469 | if (mtstat & VT1724_MULTI_FIFO_ERR) { | 469 | if (mtstat & VT1724_MULTI_FIFO_ERR) { |
470 | unsigned char fstat = inb(ICEMT1724(ice, DMA_FIFO_ERR)); | 470 | unsigned char fstat = inb(ICEMT1724(ice, DMA_FIFO_ERR)); |
471 | outb(fstat, ICEMT1724(ice, DMA_FIFO_ERR)); | 471 | outb(fstat, ICEMT1724(ice, DMA_FIFO_ERR)); |
472 | outb(VT1724_MULTI_FIFO_ERR | inb(ICEMT1724(ice, DMA_INT_MASK)), ICEMT1724(ice, DMA_INT_MASK)); | 472 | outb(VT1724_MULTI_FIFO_ERR | inb(ICEMT1724(ice, DMA_INT_MASK)), ICEMT1724(ice, DMA_INT_MASK)); |
473 | /* If I don't do this, I get machine lockup due to continual interrupts */ | 473 | /* If I don't do this, I get machine lockup due to continual interrupts */ |
474 | } | 474 | } |
475 | 475 | ||
@@ -733,17 +733,17 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) | |||
733 | outl(substream->runtime->dma_addr, ICEMT1724(ice, PLAYBACK_ADDR)); | 733 | outl(substream->runtime->dma_addr, ICEMT1724(ice, PLAYBACK_ADDR)); |
734 | 734 | ||
735 | size = (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1; | 735 | size = (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1; |
736 | // outl(size, ICEMT1724(ice, PLAYBACK_SIZE)); | 736 | /* outl(size, ICEMT1724(ice, PLAYBACK_SIZE)); */ |
737 | outw(size, ICEMT1724(ice, PLAYBACK_SIZE)); | 737 | outw(size, ICEMT1724(ice, PLAYBACK_SIZE)); |
738 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_SIZE) + 2); | 738 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_SIZE) + 2); |
739 | size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; | 739 | size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; |
740 | // outl(size, ICEMT1724(ice, PLAYBACK_COUNT)); | 740 | /* outl(size, ICEMT1724(ice, PLAYBACK_COUNT)); */ |
741 | outw(size, ICEMT1724(ice, PLAYBACK_COUNT)); | 741 | outw(size, ICEMT1724(ice, PLAYBACK_COUNT)); |
742 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2); | 742 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2); |
743 | 743 | ||
744 | spin_unlock_irq(&ice->reg_lock); | 744 | spin_unlock_irq(&ice->reg_lock); |
745 | 745 | ||
746 | // printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); | 746 | /* printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); */ |
747 | return 0; | 747 | return 0; |
748 | } | 748 | } |
749 | 749 | ||
@@ -771,7 +771,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea | |||
771 | ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff; | 771 | ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff; |
772 | ptr = (ptr + 1) << 2; | 772 | ptr = (ptr + 1) << 2; |
773 | ptr = bytes_to_frames(substream->runtime, ptr); | 773 | ptr = bytes_to_frames(substream->runtime, ptr); |
774 | if (! ptr) | 774 | if (!ptr) |
775 | ; | 775 | ; |
776 | else if (ptr <= substream->runtime->buffer_size) | 776 | else if (ptr <= substream->runtime->buffer_size) |
777 | ptr = substream->runtime->buffer_size - ptr; | 777 | ptr = substream->runtime->buffer_size - ptr; |
@@ -815,7 +815,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr | |||
815 | ptr = inw(ice->profi_port + reg->size); | 815 | ptr = inw(ice->profi_port + reg->size); |
816 | ptr = (ptr + 1) << 2; | 816 | ptr = (ptr + 1) << 2; |
817 | ptr = bytes_to_frames(substream->runtime, ptr); | 817 | ptr = bytes_to_frames(substream->runtime, ptr); |
818 | if (! ptr) | 818 | if (!ptr) |
819 | ; | 819 | ; |
820 | else if (ptr <= substream->runtime->buffer_size) | 820 | else if (ptr <= substream->runtime->buffer_size) |
821 | ptr = substream->runtime->buffer_size - ptr; | 821 | ptr = substream->runtime->buffer_size - ptr; |
@@ -842,8 +842,7 @@ static const struct vt1724_pcm_reg vt1724_capture_pro_reg = { | |||
842 | .start = VT1724_RDMA0_START, | 842 | .start = VT1724_RDMA0_START, |
843 | }; | 843 | }; |
844 | 844 | ||
845 | static const struct snd_pcm_hardware snd_vt1724_playback_pro = | 845 | static const struct snd_pcm_hardware snd_vt1724_playback_pro = { |
846 | { | ||
847 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 846 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
848 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 847 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
849 | SNDRV_PCM_INFO_MMAP_VALID | | 848 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -861,8 +860,7 @@ static const struct snd_pcm_hardware snd_vt1724_playback_pro = | |||
861 | .periods_max = 1024, | 860 | .periods_max = 1024, |
862 | }; | 861 | }; |
863 | 862 | ||
864 | static const struct snd_pcm_hardware snd_vt1724_spdif = | 863 | static const struct snd_pcm_hardware snd_vt1724_spdif = { |
865 | { | ||
866 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 864 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
867 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 865 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
868 | SNDRV_PCM_INFO_MMAP_VALID | | 866 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -883,8 +881,7 @@ static const struct snd_pcm_hardware snd_vt1724_spdif = | |||
883 | .periods_max = 1024, | 881 | .periods_max = 1024, |
884 | }; | 882 | }; |
885 | 883 | ||
886 | static const struct snd_pcm_hardware snd_vt1724_2ch_stereo = | 884 | static const struct snd_pcm_hardware snd_vt1724_2ch_stereo = { |
887 | { | ||
888 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 885 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
889 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 886 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
890 | SNDRV_PCM_INFO_MMAP_VALID | | 887 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1030,7 +1027,7 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = { | |||
1030 | .pointer = snd_vt1724_pcm_pointer, | 1027 | .pointer = snd_vt1724_pcm_pointer, |
1031 | }; | 1028 | }; |
1032 | 1029 | ||
1033 | static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 * ice, int device) | 1030 | static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) |
1034 | { | 1031 | { |
1035 | struct snd_pcm *pcm; | 1032 | struct snd_pcm *pcm; |
1036 | int err; | 1033 | int err; |
@@ -1115,7 +1112,7 @@ static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate) | |||
1115 | static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream) | 1112 | static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream) |
1116 | { | 1113 | { |
1117 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 1114 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
1118 | if (! ice->force_pdma4) | 1115 | if (!ice->force_pdma4) |
1119 | update_spdif_rate(ice, substream->runtime->rate); | 1116 | update_spdif_rate(ice, substream->runtime->rate); |
1120 | return snd_vt1724_pcm_prepare(substream); | 1117 | return snd_vt1724_pcm_prepare(substream); |
1121 | } | 1118 | } |
@@ -1215,7 +1212,7 @@ static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = { | |||
1215 | }; | 1212 | }; |
1216 | 1213 | ||
1217 | 1214 | ||
1218 | static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 * ice, int device) | 1215 | static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) |
1219 | { | 1216 | { |
1220 | char *name; | 1217 | char *name; |
1221 | struct snd_pcm *pcm; | 1218 | struct snd_pcm *pcm; |
@@ -1234,7 +1231,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 * ice, int device) | |||
1234 | ice->has_spdif = 1; | 1231 | ice->has_spdif = 1; |
1235 | } else | 1232 | } else |
1236 | capt = 0; | 1233 | capt = 0; |
1237 | if (! play && ! capt) | 1234 | if (!play && !capt) |
1238 | return 0; /* no spdif device */ | 1235 | return 0; /* no spdif device */ |
1239 | 1236 | ||
1240 | if (ice->force_pdma4 || ice->force_rdma1) | 1237 | if (ice->force_pdma4 || ice->force_rdma1) |
@@ -1349,7 +1346,7 @@ static struct snd_pcm_ops snd_vt1724_playback_indep_ops = { | |||
1349 | }; | 1346 | }; |
1350 | 1347 | ||
1351 | 1348 | ||
1352 | static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 * ice, int device) | 1349 | static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) |
1353 | { | 1350 | { |
1354 | struct snd_pcm *pcm; | 1351 | struct snd_pcm *pcm; |
1355 | int play; | 1352 | int play; |
@@ -1384,11 +1381,11 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 * ice, int device) | |||
1384 | * Mixer section | 1381 | * Mixer section |
1385 | */ | 1382 | */ |
1386 | 1383 | ||
1387 | static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 * ice) | 1384 | static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 *ice) |
1388 | { | 1385 | { |
1389 | int err; | 1386 | int err; |
1390 | 1387 | ||
1391 | if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { | 1388 | if (!(ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { |
1392 | struct snd_ac97_bus *pbus; | 1389 | struct snd_ac97_bus *pbus; |
1393 | struct snd_ac97_template ac97; | 1390 | struct snd_ac97_template ac97; |
1394 | static struct snd_ac97_bus_ops ops = { | 1391 | static struct snd_ac97_bus_ops ops = { |
@@ -1401,11 +1398,13 @@ static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 * ice) | |||
1401 | mdelay(5); /* FIXME */ | 1398 | mdelay(5); /* FIXME */ |
1402 | outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); | 1399 | outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); |
1403 | 1400 | ||
1404 | if ((err = snd_ac97_bus(ice->card, 0, &ops, NULL, &pbus)) < 0) | 1401 | err = snd_ac97_bus(ice->card, 0, &ops, NULL, &pbus); |
1402 | if (err < 0) | ||
1405 | return err; | 1403 | return err; |
1406 | memset(&ac97, 0, sizeof(ac97)); | 1404 | memset(&ac97, 0, sizeof(ac97)); |
1407 | ac97.private_data = ice; | 1405 | ac97.private_data = ice; |
1408 | if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) | 1406 | err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); |
1407 | if (err < 0) | ||
1409 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); | 1408 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); |
1410 | else | 1409 | else |
1411 | return 0; | 1410 | return 0; |
@@ -1426,7 +1425,7 @@ static inline unsigned int eeprom_triple(struct snd_ice1712 *ice, int idx) | |||
1426 | ((unsigned int)ice->eeprom.data[idx + 2] << 16); | 1425 | ((unsigned int)ice->eeprom.data[idx + 2] << 16); |
1427 | } | 1426 | } |
1428 | 1427 | ||
1429 | static void snd_vt1724_proc_read(struct snd_info_entry *entry, | 1428 | static void snd_vt1724_proc_read(struct snd_info_entry *entry, |
1430 | struct snd_info_buffer *buffer) | 1429 | struct snd_info_buffer *buffer) |
1431 | { | 1430 | { |
1432 | struct snd_ice1712 *ice = entry->private_data; | 1431 | struct snd_ice1712 *ice = entry->private_data; |
@@ -1468,11 +1467,11 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry, | |||
1468 | idx, inb(ice->profi_port+idx)); | 1467 | idx, inb(ice->profi_port+idx)); |
1469 | } | 1468 | } |
1470 | 1469 | ||
1471 | static void __devinit snd_vt1724_proc_init(struct snd_ice1712 * ice) | 1470 | static void __devinit snd_vt1724_proc_init(struct snd_ice1712 *ice) |
1472 | { | 1471 | { |
1473 | struct snd_info_entry *entry; | 1472 | struct snd_info_entry *entry; |
1474 | 1473 | ||
1475 | if (! snd_card_proc_new(ice->card, "ice1724", &entry)) | 1474 | if (!snd_card_proc_new(ice->card, "ice1724", &entry)) |
1476 | snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); | 1475 | snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); |
1477 | } | 1476 | } |
1478 | 1477 | ||
@@ -1492,7 +1491,7 @@ static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol, | |||
1492 | struct snd_ctl_elem_value *ucontrol) | 1491 | struct snd_ctl_elem_value *ucontrol) |
1493 | { | 1492 | { |
1494 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1493 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1495 | 1494 | ||
1496 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); | 1495 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); |
1497 | return 0; | 1496 | return 0; |
1498 | } | 1497 | } |
@@ -1607,13 +1606,13 @@ static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1607 | if (val != old) | 1606 | if (val != old) |
1608 | update_spdif_bits(ice, val); | 1607 | update_spdif_bits(ice, val); |
1609 | spin_unlock_irq(&ice->reg_lock); | 1608 | spin_unlock_irq(&ice->reg_lock); |
1610 | return (val != old); | 1609 | return val != old; |
1611 | } | 1610 | } |
1612 | 1611 | ||
1613 | static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = | 1612 | static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = |
1614 | { | 1613 | { |
1615 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1614 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1616 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 1615 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
1617 | .info = snd_vt1724_spdif_info, | 1616 | .info = snd_vt1724_spdif_info, |
1618 | .get = snd_vt1724_spdif_default_get, | 1617 | .get = snd_vt1724_spdif_default_get, |
1619 | .put = snd_vt1724_spdif_default_put | 1618 | .put = snd_vt1724_spdif_default_put |
@@ -1646,7 +1645,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata = | |||
1646 | { | 1645 | { |
1647 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1646 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1648 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1647 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1649 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1648 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
1650 | .info = snd_vt1724_spdif_info, | 1649 | .info = snd_vt1724_spdif_info, |
1651 | .get = snd_vt1724_spdif_maskc_get, | 1650 | .get = snd_vt1724_spdif_maskc_get, |
1652 | }; | 1651 | }; |
@@ -1655,7 +1654,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskp __devinitdata = | |||
1655 | { | 1654 | { |
1656 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1655 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1657 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1656 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1658 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1657 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
1659 | .info = snd_vt1724_spdif_info, | 1658 | .info = snd_vt1724_spdif_info, |
1660 | .get = snd_vt1724_spdif_maskp_get, | 1659 | .get = snd_vt1724_spdif_maskp_get, |
1661 | }; | 1660 | }; |
@@ -1692,8 +1691,8 @@ static struct snd_kcontrol_new snd_vt1724_spdif_switch __devinitdata = | |||
1692 | { | 1691 | { |
1693 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1692 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1694 | /* FIXME: the following conflict with IEC958 Playback Route */ | 1693 | /* FIXME: the following conflict with IEC958 Playback Route */ |
1695 | // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 1694 | /* .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), */ |
1696 | .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), | 1695 | .name = SNDRV_CTL_NAME_IEC958("Output ", NONE, SWITCH), |
1697 | .info = snd_vt1724_spdif_sw_info, | 1696 | .info = snd_vt1724_spdif_sw_info, |
1698 | .get = snd_vt1724_spdif_sw_get, | 1697 | .get = snd_vt1724_spdif_sw_get, |
1699 | .put = snd_vt1724_spdif_sw_put | 1698 | .put = snd_vt1724_spdif_sw_put |
@@ -1713,7 +1712,7 @@ int snd_vt1724_gpio_get(struct snd_kcontrol *kcontrol, | |||
1713 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1712 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1714 | int shift = kcontrol->private_value & 0xff; | 1713 | int shift = kcontrol->private_value & 0xff; |
1715 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; | 1714 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; |
1716 | 1715 | ||
1717 | snd_ice1712_save_gpio_status(ice); | 1716 | snd_ice1712_save_gpio_status(ice); |
1718 | ucontrol->value.integer.value[0] = | 1717 | ucontrol->value.integer.value[0] = |
1719 | (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert; | 1718 | (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert; |
@@ -1768,7 +1767,7 @@ static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol, | |||
1768 | { | 1767 | { |
1769 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1768 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1770 | unsigned int i, rate; | 1769 | unsigned int i, rate; |
1771 | 1770 | ||
1772 | spin_lock_irq(&ice->reg_lock); | 1771 | spin_lock_irq(&ice->reg_lock); |
1773 | if (ice->is_spdif_master(ice)) { | 1772 | if (ice->is_spdif_master(ice)) { |
1774 | ucontrol->value.enumerated.item[0] = ice->hw_rates->count; | 1773 | ucontrol->value.enumerated.item[0] = ice->hw_rates->count; |
@@ -1924,7 +1923,7 @@ static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol, | |||
1924 | "H/W In 0", "H/W In 1", /* 1-2 */ | 1923 | "H/W In 0", "H/W In 1", /* 1-2 */ |
1925 | "IEC958 In L", "IEC958 In R", /* 3-4 */ | 1924 | "IEC958 In L", "IEC958 In R", /* 3-4 */ |
1926 | }; | 1925 | }; |
1927 | 1926 | ||
1928 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1927 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1929 | uinfo->count = 1; | 1928 | uinfo->count = 1; |
1930 | uinfo->value.enumerated.items = 5; | 1929 | uinfo->value.enumerated.items = 5; |
@@ -1954,7 +1953,7 @@ static int get_route_val(struct snd_ice1712 *ice, int shift) | |||
1954 | 1953 | ||
1955 | val = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); | 1954 | val = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); |
1956 | val >>= shift; | 1955 | val >>= shift; |
1957 | val &= 7; //we now have 3 bits per output | 1956 | val &= 7; /* we now have 3 bits per output */ |
1958 | eitem = xlate[val]; | 1957 | eitem = xlate[val]; |
1959 | if (eitem == 255) { | 1958 | if (eitem == 255) { |
1960 | snd_BUG(); | 1959 | snd_BUG(); |
@@ -2033,7 +2032,7 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = | |||
2033 | 2032 | ||
2034 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { | 2033 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { |
2035 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2036 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", | 2035 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", |
2037 | .info = snd_vt1724_pro_route_info, | 2036 | .info = snd_vt1724_pro_route_info, |
2038 | .get = snd_vt1724_pro_route_spdif_get, | 2037 | .get = snd_vt1724_pro_route_spdif_get, |
2039 | .put = snd_vt1724_pro_route_spdif_put, | 2038 | .put = snd_vt1724_pro_route_spdif_put, |
@@ -2056,7 +2055,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol, | |||
2056 | { | 2055 | { |
2057 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 2056 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
2058 | int idx; | 2057 | int idx; |
2059 | 2058 | ||
2060 | spin_lock_irq(&ice->reg_lock); | 2059 | spin_lock_irq(&ice->reg_lock); |
2061 | for (idx = 0; idx < 22; idx++) { | 2060 | for (idx = 0; idx < 22; idx++) { |
2062 | outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX)); | 2061 | outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX)); |
@@ -2083,7 +2082,7 @@ static struct snd_ice1712_card_info no_matched __devinitdata; | |||
2083 | 2082 | ||
2084 | static struct snd_ice1712_card_info *card_tables[] __devinitdata = { | 2083 | static struct snd_ice1712_card_info *card_tables[] __devinitdata = { |
2085 | snd_vt1724_revo_cards, | 2084 | snd_vt1724_revo_cards, |
2086 | snd_vt1724_amp_cards, | 2085 | snd_vt1724_amp_cards, |
2087 | snd_vt1724_aureon_cards, | 2086 | snd_vt1724_aureon_cards, |
2088 | snd_vt1720_mobo_cards, | 2087 | snd_vt1720_mobo_cards, |
2089 | snd_vt1720_pontis_cards, | 2088 | snd_vt1720_pontis_cards, |
@@ -2121,7 +2120,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, | |||
2121 | wait_i2c_busy(ice); | 2120 | wait_i2c_busy(ice); |
2122 | val = inb(ICEREG1724(ice, I2C_DATA)); | 2121 | val = inb(ICEREG1724(ice, I2C_DATA)); |
2123 | mutex_unlock(&ice->i2c_mutex); | 2122 | mutex_unlock(&ice->i2c_mutex); |
2124 | //printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); | 2123 | /* printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ |
2125 | return val; | 2124 | return val; |
2126 | } | 2125 | } |
2127 | 2126 | ||
@@ -2130,7 +2129,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, | |||
2130 | { | 2129 | { |
2131 | mutex_lock(&ice->i2c_mutex); | 2130 | mutex_lock(&ice->i2c_mutex); |
2132 | wait_i2c_busy(ice); | 2131 | wait_i2c_busy(ice); |
2133 | //printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); | 2132 | /* printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ |
2134 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); | 2133 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); |
2135 | outb(data, ICEREG1724(ice, I2C_DATA)); | 2134 | outb(data, ICEREG1724(ice, I2C_DATA)); |
2136 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); | 2135 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); |
@@ -2145,13 +2144,13 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, | |||
2145 | unsigned int i, size; | 2144 | unsigned int i, size; |
2146 | struct snd_ice1712_card_info * const *tbl, *c; | 2145 | struct snd_ice1712_card_info * const *tbl, *c; |
2147 | 2146 | ||
2148 | if (! modelname || ! *modelname) { | 2147 | if (!modelname || !*modelname) { |
2149 | ice->eeprom.subvendor = 0; | 2148 | ice->eeprom.subvendor = 0; |
2150 | if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0) | 2149 | if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0) |
2151 | ice->eeprom.subvendor = | 2150 | ice->eeprom.subvendor = |
2152 | (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | | 2151 | (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | |
2153 | (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | | 2152 | (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | |
2154 | (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | | 2153 | (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | |
2155 | (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); | 2154 | (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); |
2156 | if (ice->eeprom.subvendor == 0 || | 2155 | if (ice->eeprom.subvendor == 0 || |
2157 | ice->eeprom.subvendor == (unsigned int)-1) { | 2156 | ice->eeprom.subvendor == (unsigned int)-1) { |
@@ -2174,13 +2173,13 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, | |||
2174 | for (tbl = card_tables; *tbl; tbl++) { | 2173 | for (tbl = card_tables; *tbl; tbl++) { |
2175 | for (c = *tbl; c->subvendor; c++) { | 2174 | for (c = *tbl; c->subvendor; c++) { |
2176 | if (modelname && c->model && | 2175 | if (modelname && c->model && |
2177 | ! strcmp(modelname, c->model)) { | 2176 | !strcmp(modelname, c->model)) { |
2178 | printk(KERN_INFO "ice1724: Using board model %s\n", | 2177 | printk(KERN_INFO "ice1724: Using board model %s\n", |
2179 | c->name); | 2178 | c->name); |
2180 | ice->eeprom.subvendor = c->subvendor; | 2179 | ice->eeprom.subvendor = c->subvendor; |
2181 | } else if (c->subvendor != ice->eeprom.subvendor) | 2180 | } else if (c->subvendor != ice->eeprom.subvendor) |
2182 | continue; | 2181 | continue; |
2183 | if (! c->eeprom_size || ! c->eeprom_data) | 2182 | if (!c->eeprom_size || !c->eeprom_data) |
2184 | goto found; | 2183 | goto found; |
2185 | /* if the EEPROM is given by the driver, use it */ | 2184 | /* if the EEPROM is given by the driver, use it */ |
2186 | snd_printdd("using the defined eeprom..\n"); | 2185 | snd_printdd("using the defined eeprom..\n"); |
@@ -2322,13 +2321,13 @@ static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice) | |||
2322 | 2321 | ||
2323 | static int snd_vt1724_free(struct snd_ice1712 *ice) | 2322 | static int snd_vt1724_free(struct snd_ice1712 *ice) |
2324 | { | 2323 | { |
2325 | if (! ice->port) | 2324 | if (!ice->port) |
2326 | goto __hw_end; | 2325 | goto __hw_end; |
2327 | /* mask all interrupts */ | 2326 | /* mask all interrupts */ |
2328 | outb(0xff, ICEMT1724(ice, DMA_INT_MASK)); | 2327 | outb(0xff, ICEMT1724(ice, DMA_INT_MASK)); |
2329 | outb(0xff, ICEREG1724(ice, IRQMASK)); | 2328 | outb(0xff, ICEREG1724(ice, IRQMASK)); |
2330 | /* --- */ | 2329 | /* --- */ |
2331 | __hw_end: | 2330 | __hw_end: |
2332 | if (ice->irq >= 0) | 2331 | if (ice->irq >= 0) |
2333 | free_irq(ice->irq, ice); | 2332 | free_irq(ice->irq, ice); |
2334 | pci_release_regions(ice->pci); | 2333 | pci_release_regions(ice->pci); |
@@ -2348,7 +2347,7 @@ static int snd_vt1724_dev_free(struct snd_device *device) | |||
2348 | static int __devinit snd_vt1724_create(struct snd_card *card, | 2347 | static int __devinit snd_vt1724_create(struct snd_card *card, |
2349 | struct pci_dev *pci, | 2348 | struct pci_dev *pci, |
2350 | const char *modelname, | 2349 | const char *modelname, |
2351 | struct snd_ice1712 ** r_ice1712) | 2350 | struct snd_ice1712 **r_ice1712) |
2352 | { | 2351 | { |
2353 | struct snd_ice1712 *ice; | 2352 | struct snd_ice1712 *ice; |
2354 | int err; | 2353 | int err; |
@@ -2359,8 +2358,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2359 | 2358 | ||
2360 | *r_ice1712 = NULL; | 2359 | *r_ice1712 = NULL; |
2361 | 2360 | ||
2362 | /* enable PCI device */ | 2361 | /* enable PCI device */ |
2363 | if ((err = pci_enable_device(pci)) < 0) | 2362 | err = pci_enable_device(pci); |
2363 | if (err < 0) | ||
2364 | return err; | 2364 | return err; |
2365 | 2365 | ||
2366 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); | 2366 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); |
@@ -2384,7 +2384,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2384 | snd_vt1724_proc_init(ice); | 2384 | snd_vt1724_proc_init(ice); |
2385 | synchronize_irq(pci->irq); | 2385 | synchronize_irq(pci->irq); |
2386 | 2386 | ||
2387 | if ((err = pci_request_regions(pci, "ICE1724")) < 0) { | 2387 | err = pci_request_regions(pci, "ICE1724"); |
2388 | if (err < 0) { | ||
2388 | kfree(ice); | 2389 | kfree(ice); |
2389 | pci_disable_device(pci); | 2390 | pci_disable_device(pci); |
2390 | return err; | 2391 | return err; |
@@ -2419,9 +2420,10 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2419 | */ | 2420 | */ |
2420 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); | 2421 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); |
2421 | 2422 | ||
2422 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) { | 2423 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); |
2424 | if (err < 0) { | ||
2423 | snd_vt1724_free(ice); | 2425 | snd_vt1724_free(ice); |
2424 | return err; | 2426 | return err; |
2425 | } | 2427 | } |
2426 | 2428 | ||
2427 | snd_card_set_dev(card, &pci->dev); | 2429 | snd_card_set_dev(card, &pci->dev); |
@@ -2459,8 +2461,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2459 | 2461 | ||
2460 | strcpy(card->driver, "ICE1724"); | 2462 | strcpy(card->driver, "ICE1724"); |
2461 | strcpy(card->shortname, "ICEnsemble ICE1724"); | 2463 | strcpy(card->shortname, "ICEnsemble ICE1724"); |
2462 | 2464 | ||
2463 | if ((err = snd_vt1724_create(card, pci, model[dev], &ice)) < 0) { | 2465 | err = snd_vt1724_create(card, pci, model[dev], &ice); |
2466 | if (err < 0) { | ||
2464 | snd_card_free(card); | 2467 | snd_card_free(card); |
2465 | return err; | 2468 | return err; |
2466 | } | 2469 | } |
@@ -2472,7 +2475,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2472 | if (c->driver) /* specific driver? */ | 2475 | if (c->driver) /* specific driver? */ |
2473 | strcpy(card->driver, c->driver); | 2476 | strcpy(card->driver, c->driver); |
2474 | if (c->chip_init) { | 2477 | if (c->chip_init) { |
2475 | if ((err = c->chip_init(ice)) < 0) { | 2478 | err = c->chip_init(ice); |
2479 | if (err < 0) { | ||
2476 | snd_card_free(card); | 2480 | snd_card_free(card); |
2477 | return err; | 2481 | return err; |
2478 | } | 2482 | } |
@@ -2482,15 +2486,15 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2482 | } | 2486 | } |
2483 | } | 2487 | } |
2484 | c = &no_matched; | 2488 | c = &no_matched; |
2485 | __found: | 2489 | __found: |
2486 | /* | 2490 | /* |
2487 | * VT1724 has separate DMAs for the analog and the SPDIF streams while | 2491 | * VT1724 has separate DMAs for the analog and the SPDIF streams while |
2488 | * ICE1712 has only one for both (mixed up). | 2492 | * ICE1712 has only one for both (mixed up). |
2489 | * | 2493 | * |
2490 | * Confusingly the analog PCM is named "professional" here because it | 2494 | * Confusingly the analog PCM is named "professional" here because it |
2491 | * was called so in ice1712 driver, and vt1724 driver is derived from | 2495 | * was called so in ice1712 driver, and vt1724 driver is derived from |
2492 | * ice1712 driver. | 2496 | * ice1712 driver. |
2493 | */ | 2497 | */ |
2494 | ice->pro_rate_default = PRO_RATE_DEFAULT; | 2498 | ice->pro_rate_default = PRO_RATE_DEFAULT; |
2495 | if (!ice->is_spdif_master) | 2499 | if (!ice->is_spdif_master) |
2496 | ice->is_spdif_master = stdclock_is_spdif_master; | 2500 | ice->is_spdif_master = stdclock_is_spdif_master; |
@@ -2505,46 +2509,53 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2505 | if (!ice->hw_rates) | 2509 | if (!ice->hw_rates) |
2506 | set_std_hw_rates(ice); | 2510 | set_std_hw_rates(ice); |
2507 | 2511 | ||
2508 | if ((err = snd_vt1724_pcm_profi(ice, pcm_dev++)) < 0) { | 2512 | err = snd_vt1724_pcm_profi(ice, pcm_dev++); |
2513 | if (err < 0) { | ||
2509 | snd_card_free(card); | 2514 | snd_card_free(card); |
2510 | return err; | 2515 | return err; |
2511 | } | 2516 | } |
2512 | 2517 | ||
2513 | if ((err = snd_vt1724_pcm_spdif(ice, pcm_dev++)) < 0) { | 2518 | err = snd_vt1724_pcm_spdif(ice, pcm_dev++); |
2519 | if (err < 0) { | ||
2514 | snd_card_free(card); | 2520 | snd_card_free(card); |
2515 | return err; | 2521 | return err; |
2516 | } | 2522 | } |
2517 | 2523 | ||
2518 | if ((err = snd_vt1724_pcm_indep(ice, pcm_dev++)) < 0) { | 2524 | err = snd_vt1724_pcm_indep(ice, pcm_dev++); |
2525 | if (err < 0) { | ||
2519 | snd_card_free(card); | 2526 | snd_card_free(card); |
2520 | return err; | 2527 | return err; |
2521 | } | 2528 | } |
2522 | 2529 | ||
2523 | if ((err = snd_vt1724_ac97_mixer(ice)) < 0) { | 2530 | err = snd_vt1724_ac97_mixer(ice); |
2531 | if (err < 0) { | ||
2524 | snd_card_free(card); | 2532 | snd_card_free(card); |
2525 | return err; | 2533 | return err; |
2526 | } | 2534 | } |
2527 | 2535 | ||
2528 | if ((err = snd_vt1724_build_controls(ice)) < 0) { | 2536 | err = snd_vt1724_build_controls(ice); |
2537 | if (err < 0) { | ||
2529 | snd_card_free(card); | 2538 | snd_card_free(card); |
2530 | return err; | 2539 | return err; |
2531 | } | 2540 | } |
2532 | 2541 | ||
2533 | if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */ | 2542 | if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */ |
2534 | if ((err = snd_vt1724_spdif_build_controls(ice)) < 0) { | 2543 | err = snd_vt1724_spdif_build_controls(ice); |
2544 | if (err < 0) { | ||
2535 | snd_card_free(card); | 2545 | snd_card_free(card); |
2536 | return err; | 2546 | return err; |
2537 | } | 2547 | } |
2538 | } | 2548 | } |
2539 | 2549 | ||
2540 | if (c->build_controls) { | 2550 | if (c->build_controls) { |
2541 | if ((err = c->build_controls(ice)) < 0) { | 2551 | err = c->build_controls(ice); |
2552 | if (err < 0) { | ||
2542 | snd_card_free(card); | 2553 | snd_card_free(card); |
2543 | return err; | 2554 | return err; |
2544 | } | 2555 | } |
2545 | } | 2556 | } |
2546 | 2557 | ||
2547 | if (! c->no_mpu401) { | 2558 | if (!c->no_mpu401) { |
2548 | if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { | 2559 | if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { |
2549 | struct snd_rawmidi *rmidi; | 2560 | struct snd_rawmidi *rmidi; |
2550 | 2561 | ||
@@ -2576,7 +2587,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2576 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 2587 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
2577 | card->shortname, ice->port, ice->irq); | 2588 | card->shortname, ice->port, ice->irq); |
2578 | 2589 | ||
2579 | if ((err = snd_card_register(card)) < 0) { | 2590 | err = snd_card_register(card); |
2591 | if (err < 0) { | ||
2580 | snd_card_free(card); | 2592 | snd_card_free(card); |
2581 | return err; | 2593 | return err; |
2582 | } | 2594 | } |