Lines Matching refs:codec

168 #define ALI_REG(codec, x) ((codec)->port + x)
207 struct snd_ali *codec;
293 static inline unsigned int snd_ali_5451_peek(struct snd_ali *codec,
296 return (unsigned int)inl(ALI_REG(codec, port));
299 static inline void snd_ali_5451_poke(struct snd_ali *codec,
303 outl((unsigned int)val, ALI_REG(codec, port));
306 static int snd_ali_codec_ready(struct snd_ali *codec,
315 res = snd_ali_5451_peek(codec,port);
323 snd_ali_5451_poke(codec, port, res & ~0x8000);
324 snd_printdd("ali_codec_ready: codec is not ready.\n ");
328 static int snd_ali_stimer_ready(struct snd_ali *codec)
333 dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER);
337 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
349 static void snd_ali_codec_poke(struct snd_ali *codec,int secondary,
361 port = codec->chregs.regs.ac97write;
363 if (snd_ali_codec_ready(codec, port) < 0)
365 if (snd_ali_stimer_ready(codec) < 0)
372 if (codec->revision == ALI_5451_V02)
375 snd_ali_5451_poke(codec, port, dwVal);
380 static unsigned short snd_ali_codec_peek(struct snd_ali *codec,
392 port = codec->chregs.regs.ac97read;
394 if (snd_ali_codec_ready(codec, port) < 0)
396 if (snd_ali_stimer_ready(codec) < 0)
404 snd_ali_5451_poke(codec, port, dwVal);
406 if (snd_ali_stimer_ready(codec) < 0)
408 if (snd_ali_codec_ready(codec, port) < 0)
411 return (snd_ali_5451_peek(codec, port) & 0xffff0000) >> 16;
418 struct snd_ali *codec = ac97->private_data;
423 ALI_REG(codec, ALI_AC97_GPIO));
426 snd_ali_codec_poke(codec, ac97->num, reg, val);
434 struct snd_ali *codec = ac97->private_data;
437 return snd_ali_codec_peek(codec, ac97->num, reg);
444 static int snd_ali_reset_5451(struct snd_ali *codec)
450 pci_dev = codec->pci_m1533;
460 pci_dev = codec->pci;
470 wReg = snd_ali_codec_peek(codec, 0, AC97_POWERDOWN);
476 /* non-fatal if you have a non PM capable codec */
485 static void snd_ali_enable_special_channel(struct snd_ali *codec,
490 dwVal = inl(ALI_REG(codec, ALI_GLOBAL_CONTROL));
492 outl(dwVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
495 static void snd_ali_disable_special_channel(struct snd_ali *codec,
500 dwVal = inl(ALI_REG(codec, ALI_GLOBAL_CONTROL));
502 outl(dwVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
505 static void snd_ali_enable_address_interrupt(struct snd_ali *codec)
509 gc = inl(ALI_REG(codec, ALI_GC_CIR));
512 outl( gc, ALI_REG(codec, ALI_GC_CIR));
515 static void snd_ali_disable_address_interrupt(struct snd_ali *codec)
519 gc = inl(ALI_REG(codec, ALI_GC_CIR));
522 outl(gc, ALI_REG(codec, ALI_GC_CIR));
525 static void snd_ali_disable_voice_irq(struct snd_ali *codec,
529 struct snd_ali_channel_control *pchregs = &(codec->chregs);
534 pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten));
536 outl(pchregs->data.ainten, ALI_REG(codec, pchregs->regs.ainten));
539 static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
543 if (codec->synth.chcnt >= ALI_CHANNELS){
549 if (!(codec->synth.chmap & (1 << idx))) {
550 codec->synth.chmap |= 1 << idx;
551 codec->synth.chcnt++;
558 static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
567 if (codec->spdif_support &&
568 (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) &
574 result = snd_ali_alloc_pcm_channel(codec, idx);
585 if (codec->spdif_support &&
586 (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) &
589 result = snd_ali_alloc_pcm_channel(codec, idx);
598 result = snd_ali_alloc_pcm_channel(codec, idx);
606 static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel)
615 if (!(codec->synth.chmap & (1 << idx))) {
620 codec->synth.chmap &= ~(1 << idx);
621 codec->synth.chcnt--;
625 static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
630 outl(mask, ALI_REG(codec, codec->chregs.regs.stop));
637 static void snd_ali_delay(struct snd_ali *codec,int interval)
641 begintimer = inl(ALI_REG(codec, ALI_STIMER));
642 currenttimer = inl(ALI_REG(codec, ALI_STIMER));
645 if (snd_ali_stimer_ready(codec) < 0)
647 currenttimer = inl(ALI_REG(codec, ALI_STIMER));
652 static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
658 bval = inb(ALI_REG(codec, ALI_SPDIF_CTRL + 1));
660 outb(bval, ALI_REG(codec, ALI_SPDIF_CTRL + 1));
664 snd_ali_delay(codec, 6);
665 bval = inb(ALI_REG(codec, ALI_SPDIF_CTRL + 1));
675 snd_ali_delay(codec, 6);
676 bval = inb(ALI_REG(codec,ALI_SPDIF_CTRL + 1));
690 wval = inw(ALI_REG(codec, ALI_SPDIF_CTRL + 2));
693 outw(wval, ALI_REG(codec, ALI_SPDIF_CTRL + 2));
695 bval = inb(ALI_REG(codec, ALI_SPDIF_CS + 3)) & 0xf0;
696 outb(bval | 0x02, ALI_REG(codec, ALI_SPDIF_CS + 3));
698 wval = inw(ALI_REG(codec, ALI_SPDIF_CTRL + 2));
701 outw(wval, ALI_REG(codec, ALI_SPDIF_CTRL + 2));
703 bval = inb(ALI_REG(codec,ALI_SPDIF_CS + 3)) & 0xf0;
704 outb(bval | 0x03, ALI_REG(codec, ALI_SPDIF_CS + 3));
708 static unsigned int snd_ali_get_spdif_in_rate(struct snd_ali *codec)
713 bval = inb(ALI_REG(codec, ALI_SPDIF_CTRL));
716 outb(bval, ALI_REG(codec, ALI_SPDIF_CTRL));
718 snd_ali_detect_spdif_rate(codec);
720 bval = inb(ALI_REG(codec, ALI_SPDIF_CS + 3));
733 static void snd_ali_enable_spdif_in(struct snd_ali *codec)
737 dwVal = inl(ALI_REG(codec, ALI_GLOBAL_CONTROL));
739 outl(dwVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
741 dwVal = inb(ALI_REG(codec, ALI_SPDIF_CTRL));
743 outb(dwVal, ALI_REG(codec, ALI_SPDIF_CTRL));
745 snd_ali_enable_special_channel(codec, ALI_SPDIF_IN_CHANNEL);
748 static void snd_ali_disable_spdif_in(struct snd_ali *codec)
752 dwVal = inl(ALI_REG(codec, ALI_GLOBAL_CONTROL));
754 outl(dwVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
756 snd_ali_disable_special_channel(codec, ALI_SPDIF_IN_CHANNEL);
760 static void snd_ali_set_spdif_out_rate(struct snd_ali *codec, unsigned int rate)
771 bVal = inb(ALI_REG(codec, ALI_SPDIF_CTRL));
775 outb(bVal, ALI_REG(codec, ALI_SPDIF_CTRL));
776 outb(dwRate | 0x20, ALI_REG(codec, ALI_SPDIF_CS + 2));
779 outb(bVal, ALI_REG(codec, ALI_SPDIF_CTRL));
780 outw(rate | 0x10, ALI_REG(codec, ALI_SPDIF_CS + 2));
783 static void snd_ali_enable_spdif_out(struct snd_ali *codec)
789 pci_dev = codec->pci_m1533;
804 bVal = inb(ALI_REG(codec, ALI_SCTRL));
805 outb(bVal | ALI_SPDIF_OUT_ENABLE, ALI_REG(codec, ALI_SCTRL));
807 bVal = inb(ALI_REG(codec, ALI_SPDIF_CTRL));
808 outb(bVal & ALI_SPDIF_OUT_CH_STATUS, ALI_REG(codec, ALI_SPDIF_CTRL));
810 wVal = inw(ALI_REG(codec, ALI_GLOBAL_CONTROL));
812 outw(wVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
813 snd_ali_disable_special_channel(codec, ALI_SPDIF_OUT_CHANNEL);
816 static void snd_ali_enable_spdif_chnout(struct snd_ali *codec)
820 wVal = inw(ALI_REG(codec, ALI_GLOBAL_CONTROL));
822 outw(wVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
824 wVal = inw(ALI_REG(codec, ALI_SPDIF_CS));
829 outw(wVal, ALI_REG(codec, ALI_SPDIF_CS));
831 snd_ali_enable_special_channel(codec, ALI_SPDIF_OUT_CHANNEL);
834 static void snd_ali_disable_spdif_chnout(struct snd_ali *codec)
838 wVal = inw(ALI_REG(codec, ALI_GLOBAL_CONTROL));
840 outw(wVal, ALI_REG(codec, ALI_GLOBAL_CONTROL));
842 snd_ali_enable_special_channel(codec, ALI_SPDIF_OUT_CHANNEL);
845 static void snd_ali_disable_spdif_out(struct snd_ali *codec)
849 bVal = inb(ALI_REG(codec, ALI_SCTRL));
850 outb(bVal & ~ALI_SPDIF_OUT_ENABLE, ALI_REG(codec, ALI_SCTRL));
852 snd_ali_disable_spdif_chnout(codec);
855 static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
865 pchregs = &(codec->chregs);
874 pvoice = &codec->synth.voices[channel];
878 spin_lock(&codec->reg_lock);
883 outb((u8)(pvoice->number), ALI_REG(codec, ALI_GC_CIR));
884 temp = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
885 cspf = (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask;
890 spin_unlock(&codec->reg_lock);
892 spin_lock(&codec->reg_lock);
894 snd_ali_stop_voice(codec, channel);
895 snd_ali_disable_voice_irq(codec, channel);
897 } else if (codec->synth.voices[channel].synth) {
899 } else if (codec->synth.voices[channel].midi) {
903 snd_ali_stop_voice(codec, channel);
904 snd_ali_disable_voice_irq(codec, channel);
906 spin_unlock(&codec->reg_lock);
907 outl(mask,ALI_REG(codec,pchregs->regs.aint));
913 struct snd_ali *codec = dev_id;
918 if (codec == NULL || !codec->hw_initialized)
921 audio_int = inl(ALI_REG(codec, ALI_MISCINT));
925 pchregs = &(codec->chregs);
928 pchregs->data.aint = inl(ALI_REG(codec, pchregs->regs.aint));
930 snd_ali_update_ptr(codec, channel);
933 ALI_REG(codec, ALI_MISCINT));
939 static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec,
947 spin_lock_irq(&codec->voice_alloc);
949 idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) :
950 snd_ali_find_free_channel(codec,rec);
953 spin_unlock_irq(&codec->voice_alloc);
956 pvoice = &(codec->synth.voices[idx]);
957 pvoice->codec = codec;
961 spin_unlock_irq(&codec->voice_alloc);
964 spin_unlock_irq(&codec->voice_alloc);
969 static void snd_ali_free_voice(struct snd_ali * codec,
978 snd_ali_clear_voices(codec, pvoice->number, pvoice->number);
979 spin_lock_irq(&codec->voice_alloc);
985 snd_ali_free_channel_pcm(codec, pvoice->number);
988 spin_unlock_irq(&codec->voice_alloc);
994 static void snd_ali_clear_voices(struct snd_ali *codec,
1001 snd_ali_stop_voice(codec, i);
1002 snd_ali_disable_voice_irq(codec, i);
1006 static void snd_ali_write_voice_regs(struct snd_ali *codec,
1021 outb((unsigned char)(Channel & 0x001f), ALI_REG(codec, ALI_GC_CIR));
1032 outb(Channel, ALI_REG(codec, ALI_GC_CIR));
1034 outl(ctlcmds[0], ALI_REG(codec, ALI_CSO_ALPHA_FMS));
1035 outl(ctlcmds[1], ALI_REG(codec, ALI_LBA));
1036 outl(ctlcmds[2], ALI_REG(codec, ALI_ESO_DELTA));
1037 outl(ctlcmds[3], ALI_REG(codec, ALI_GVSEL_PAN_VOC_CTRL_EC));
1039 outl(0x30000000, ALI_REG(codec, ALI_EBUF1)); /* Still Mode */
1040 outl(0x30000000, ALI_REG(codec, ALI_EBUF2)); /* Still Mode */
1101 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1123 if ((struct snd_ali *) snd_pcm_substream_chip(s) == codec) {
1147 spin_lock(&codec->reg_lock);
1149 outl(what, ALI_REG(codec, ALI_STOP));
1150 val = inl(ALI_REG(codec, ALI_AINTEN));
1155 outl(val, ALI_REG(codec, ALI_AINTEN));
1157 outl(what, ALI_REG(codec, ALI_START));
1159 spin_unlock(&codec->reg_lock);
1167 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1183 evoice = snd_ali_alloc_voice(codec,
1193 snd_ali_free_voice(codec, evoice);
1203 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1210 snd_ali_free_voice(codec, evoice);
1230 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1246 spin_lock_irq(&codec->reg_lock);
1253 snd_ali_disable_special_channel(codec, pvoice->number);
1254 else if (codec->spdif_support &&
1255 (inl(ALI_REG(codec, ALI_GLOBAL_CONTROL)) &
1258 snd_ali_set_spdif_out_rate(codec, runtime->rate);
1286 snd_ali_write_voice_regs(codec,
1302 snd_ali_write_voice_regs(codec,
1315 spin_unlock_irq(&codec->reg_lock);
1322 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1335 spin_lock_irq(&codec->reg_lock);
1339 snd_ali_enable_special_channel(codec,pvoice->number);
1350 spin_unlock_irq(&codec->reg_lock);
1351 if (codec->revision != ALI_5451_V02)
1354 rate = snd_ali_get_spdif_in_rate(codec);
1360 spin_lock_irq(&codec->reg_lock);
1361 bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL));
1363 outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL));
1388 snd_ali_write_voice_regs( codec,
1401 spin_unlock_irq(&codec->reg_lock);
1410 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1415 spin_lock(&codec->reg_lock);
1417 spin_unlock(&codec->reg_lock);
1420 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
1421 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
1422 spin_unlock(&codec->reg_lock);
1431 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1436 spin_lock(&codec->reg_lock);
1438 spin_unlock_irq(&codec->reg_lock);
1441 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
1442 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
1443 spin_unlock(&codec->reg_lock);
1499 struct snd_ali *codec;
1502 codec = pvoice->codec;
1503 snd_ali_free_voice(pvoice->codec, pvoice);
1510 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1514 pvoice = snd_ali_alloc_voice(codec, SNDRV_ALI_VOICE_TYPE_PCM, rec,
1547 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1550 snd_ali_disable_special_channel(codec,pvoice->number);
1676 struct snd_ali *codec = pcm->private_data;
1677 codec->pcm[pcm->device] = NULL;
1681 static int __devinit snd_ali_pcm(struct snd_ali * codec, int device,
1687 err = snd_pcm_new(codec->card, desc->name, device,
1693 pcm->private_data = codec;
1703 snd_dma_pci_data(codec->pci),
1710 codec->pcm[0] = pcm;
1730 static int __devinit snd_ali_build_pcms(struct snd_ali *codec)
1733 for (i = 0; i < codec->num_of_codecs && i < ARRAY_SIZE(ali_pcms); i++) {
1734 err = snd_ali_pcm(codec, i, &ali_pcms[i]);
1752 struct snd_ali *codec = kcontrol->private_data;
1757 spin_lock_irq(&codec->reg_lock);
1760 spdif_enable = (codec->spdif_mask & 0x02) ? 1 : 0;
1763 spdif_enable = ((codec->spdif_mask & 0x02) &&
1764 (codec->spdif_mask & 0x04)) ? 1 : 0;
1767 spdif_enable = (codec->spdif_mask & 0x01) ? 1 : 0;
1773 spin_unlock_irq(&codec->reg_lock);
1780 struct snd_ali *codec = kcontrol->private_data;
1785 spin_lock_irq(&codec->reg_lock);
1788 change = (codec->spdif_mask & 0x02) ? 1 : 0;
1792 codec->spdif_mask |= 0x02;
1793 snd_ali_enable_spdif_out(codec);
1795 codec->spdif_mask &= ~(0x02);
1796 codec->spdif_mask &= ~(0x04);
1797 snd_ali_disable_spdif_out(codec);
1802 change = (codec->spdif_mask & 0x04) ? 1 : 0;
1804 if (change && (codec->spdif_mask & 0x02)) {
1806 codec->spdif_mask |= 0x04;
1807 snd_ali_enable_spdif_chnout(codec);
1809 codec->spdif_mask &= ~(0x04);
1810 snd_ali_disable_spdif_chnout(codec);
1815 change = (codec->spdif_mask & 0x01) ? 1 : 0;
1819 codec->spdif_mask |= 0x01;
1820 snd_ali_enable_spdif_in(codec);
1822 codec->spdif_mask &= ~(0x01);
1823 snd_ali_disable_spdif_in(codec);
1830 spin_unlock_irq(&codec->reg_lock);
1845 static int __devinit snd_ali_mixer(struct snd_ali * codec)
1855 err = snd_ac97_bus(codec->card, 0, &ops, codec, &codec->ac97_bus);
1860 ac97.private_data = codec;
1862 for (i = 0; i < codec->num_of_codecs; i++) {
1864 err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]);
1870 codec->num_of_codecs = 1;
1875 if (codec->spdif_support) {
1877 err = snd_ctl_add(codec->card,
1878 snd_ctl_new1(&snd_ali5451_mixer_spdif[idx], codec));
1987 static int snd_ali_free(struct snd_ali * codec)
1989 if (codec->hw_initialized)
1990 snd_ali_disable_address_interrupt(codec);
1991 if (codec->irq >= 0)
1992 free_irq(codec->irq, codec);
1993 if (codec->port)
1994 pci_release_regions(codec->pci);
1995 pci_disable_device(codec->pci);
1997 kfree(codec->image);
1999 pci_dev_put(codec->pci_m1533);
2000 pci_dev_put(codec->pci_m7101);
2001 kfree(codec);
2005 static int snd_ali_chip_init(struct snd_ali *codec)
2013 if (snd_ali_reset_5451(codec)) {
2018 if (codec->revision == ALI_5451_V02) {
2019 pci_dev = codec->pci_m1533;
2024 pci_dev = codec->pci_m7101;
2030 pci_read_config_dword(codec->pci, 0x44, &legacy);
2033 pci_write_config_dword(codec->pci, 0x44, legacy);
2035 outl(0x80000001, ALI_REG(codec, ALI_GLOBAL_CONTROL));
2036 outl(0x00000000, ALI_REG(codec, ALI_AINTEN));
2037 outl(0xffffffff, ALI_REG(codec, ALI_AINT));
2038 outl(0x00000000, ALI_REG(codec, ALI_VOLUME));
2039 outb(0x10, ALI_REG(codec, ALI_MPUR2));
2041 codec->ac97_ext_id = snd_ali_codec_peek(codec, 0, AC97_EXTENDED_ID);
2042 codec->ac97_ext_status = snd_ali_codec_peek(codec, 0,
2044 if (codec->spdif_support) {
2045 snd_ali_enable_spdif_out(codec);
2046 codec->spdif_mask = 0x00000002;
2049 codec->num_of_codecs = 1;
2051 /* secondary codec - modem */
2052 if (inl(ALI_REG(codec, ALI_SCTRL)) & ALI_SCTRL_CODEC2_READY) {
2053 codec->num_of_codecs++;
2054 outl(inl(ALI_REG(codec, ALI_SCTRL)) |
2057 ALI_REG(codec, ALI_SCTRL));
2069 struct snd_ali *codec = entry->private_data;
2072 snd_iprintf(buf, "%02x: %08x\n", i, inl(ALI_REG(codec, i)));
2075 static void __devinit snd_ali_proc_init(struct snd_ali *codec)
2078 if (!snd_card_proc_new(codec->card, "ali5451", &entry))
2079 snd_info_set_text_ops(entry, codec, snd_ali_proc_read);
2082 static int __devinit snd_ali_resources(struct snd_ali *codec)
2087 err = pci_request_regions(codec->pci, "ALI 5451");
2090 codec->port = pci_resource_start(codec->pci, 0);
2092 if (request_irq(codec->pci->irq, snd_ali_card_interrupt,
2093 IRQF_SHARED, "ALI 5451", codec)) {
2097 codec->irq = codec->pci->irq;
2103 struct snd_ali *codec = device->device_data;
2104 snd_ali_free(codec);
2114 struct snd_ali *codec;
2138 codec = kzalloc(sizeof(*codec), GFP_KERNEL);
2139 if (!codec) {
2144 spin_lock_init(&codec->reg_lock);
2145 spin_lock_init(&codec->voice_alloc);
2147 codec->card = card;
2148 codec->pci = pci;
2149 codec->irq = -1;
2150 codec->revision = pci->revision;
2151 codec->spdif_support = spdif_support;
2166 if (snd_ali_resources(codec)) {
2167 snd_ali_free(codec);
2173 codec->synth.chmap = 0;
2174 codec->synth.chcnt = 0;
2175 codec->spdif_mask = 0;
2176 codec->synth.synthcount = 0;
2178 if (codec->revision == ALI_5451_V02)
2179 codec->chregs.regs.ac97read = ALI_AC97_WRITE;
2181 codec->chregs.regs.ac97read = ALI_AC97_READ;
2182 codec->chregs.regs.ac97write = ALI_AC97_WRITE;
2184 codec->chregs.regs.start = ALI_START;
2185 codec->chregs.regs.stop = ALI_STOP;
2186 codec->chregs.regs.aint = ALI_AINT;
2187 codec->chregs.regs.ainten = ALI_AINTEN;
2189 codec->chregs.data.start = 0x00;
2190 codec->chregs.data.stop = 0x00;
2191 codec->chregs.data.aint = 0x00;
2192 codec->chregs.data.ainten = 0x00;
2195 codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL);
2196 if (!codec->pci_m1533) {
2198 snd_ali_free(codec);
2202 codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL);
2203 if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) {
2205 snd_ali_free(codec);
2210 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops);
2212 snd_ali_free(codec);
2220 codec->synth.voices[i].number = i;
2222 err = snd_ali_chip_init(codec);
2229 codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL);
2230 if (!codec->image)
2234 snd_ali_enable_address_interrupt(codec);
2235 codec->hw_initialized = 1;
2237 *r_ali = codec;
2246 struct snd_ali *codec;
2255 err = snd_ali_create(card, pci, pcm_channels, spdif, &codec);
2258 card->private_data = codec;
2261 err = snd_ali_mixer(codec);
2266 err = snd_ali_build_pcms(codec);
2270 snd_ali_proc_init(codec);
2276 card->shortname, codec->port, codec->irq);