Lines Matching refs:trident

31 #include "trident.h"
34 static int snd_trident_pcm_mixer_build(struct snd_trident *trident,
37 static int snd_trident_pcm_mixer_free(struct snd_trident *trident,
41 static int snd_trident_sis_reset(struct snd_trident *trident);
43 static void snd_trident_clear_voices(struct snd_trident * trident,
45 static int snd_trident_free(struct snd_trident *trident);
53 static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice)
57 dev_dbg(trident->card->dev, "Trident voice %i:\n", voice);
58 outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR));
59 val = inl(TRID_REG(trident, CH_LBA));
60 dev_dbg(trident->card->dev, "LBA: 0x%x\n", val);
61 val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
62 dev_dbg(trident->card->dev, "GVSel: %i\n", val >> 31);
63 dev_dbg(trident->card->dev, "Pan: 0x%x\n", (val >> 24) & 0x7f);
64 dev_dbg(trident->card->dev, "Vol: 0x%x\n", (val >> 16) & 0xff);
65 dev_dbg(trident->card->dev, "CTRL: 0x%x\n", (val >> 12) & 0x0f);
66 dev_dbg(trident->card->dev, "EC: 0x%x\n", val & 0x0fff);
67 if (trident->device != TRIDENT_DEVICE_ID_NX) {
68 val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS));
69 dev_dbg(trident->card->dev, "CSO: 0x%x\n", val >> 16);
70 dev_dbg(trident->card->dev, "Alpha: 0x%x\n", (val >> 4) & 0x0fff);
71 dev_dbg(trident->card->dev, "FMS: 0x%x\n", val & 0x0f);
72 val = inl(TRID_REG(trident, CH_DX_ESO_DELTA));
73 dev_dbg(trident->card->dev, "ESO: 0x%x\n", val >> 16);
74 dev_dbg(trident->card->dev, "Delta: 0x%x\n", val & 0xffff);
75 val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL));
77 val = inl(TRID_REG(trident, CH_NX_DELTA_CSO));
79 dev_dbg(trident->card->dev, "CSO: 0x%x\n", val & 0x00ffffff);
80 val = inl(TRID_REG(trident, CH_NX_DELTA_ESO));
82 dev_dbg(trident->card->dev, "Delta: 0x%x\n", tmp);
83 dev_dbg(trident->card->dev, "ESO: 0x%x\n", val & 0x00ffffff);
84 val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL));
85 dev_dbg(trident->card->dev, "Alpha: 0x%x\n", val >> 20);
86 dev_dbg(trident->card->dev, "FMS: 0x%x\n", (val >> 16) & 0x0f);
88 dev_dbg(trident->card->dev, "FMC: 0x%x\n", (val >> 14) & 3);
89 dev_dbg(trident->card->dev, "RVol: 0x%x\n", (val >> 7) & 0x7f);
90 dev_dbg(trident->card->dev, "CVol: 0x%x\n", val & 0x7f);
111 struct snd_trident *trident = ac97->private_data;
113 spin_lock_irqsave(&trident->reg_lock, flags);
114 if (trident->device == TRIDENT_DEVICE_ID_DX) {
116 outl(data, TRID_REG(trident, DX_ACR1_AC97_R));
118 data = inl(TRID_REG(trident, DX_ACR1_AC97_R));
122 } else if (trident->device == TRIDENT_DEVICE_ID_NX) {
125 outl(data, TRID_REG(trident, treg));
127 data = inl(TRID_REG(trident, treg));
131 } else if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
135 outl(data, TRID_REG(trident, SI_AC97_READ));
137 data = inl(TRID_REG(trident, SI_AC97_READ));
143 if (count == 0 && !trident->ac97_detect) {
144 dev_err(trident->card->dev,
150 spin_unlock_irqrestore(&trident->reg_lock, flags);
174 struct snd_trident *trident = ac97->private_data;
178 spin_lock_irqsave(&trident->reg_lock, flags);
179 if (trident->device == TRIDENT_DEVICE_ID_DX) {
184 if ((inw(TRID_REG(trident, address)) & DX_AC97_BUSY_WRITE) == 0)
189 } else if (trident->device == TRIDENT_DEVICE_ID_NX) {
194 if ((inw(TRID_REG(trident, address)) & NX_AC97_BUSY_WRITE) == 0)
199 } else if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
204 if ((inw(TRID_REG(trident, address)) & (SI_AC97_BUSY_WRITE)) == 0)
217 spin_unlock_irqrestore(&trident->reg_lock, flags);
220 outl(data, TRID_REG(trident, address));
221 spin_unlock_irqrestore(&trident->reg_lock, flags);
225 void snd_trident_enable_eso(struct snd_trident *trident)
232 Parameters: trident - pointer to target device class for 4DWave.
236 static void snd_trident_enable_eso(struct snd_trident * trident)
240 val = inl(TRID_REG(trident, T4D_LFO_GC_CIR));
243 if (trident->device == TRIDENT_DEVICE_ID_SI7018)
245 outl(val, TRID_REG(trident, T4D_LFO_GC_CIR));
249 void snd_trident_disable_eso(struct snd_trident *trident)
257 trident - pointer to target device class for 4DWave.
263 static void snd_trident_disable_eso(struct snd_trident * trident)
267 tmp = inl(TRID_REG(trident, T4D_LFO_GC_CIR));
270 outl(tmp, TRID_REG(trident, T4D_LFO_GC_CIR));
274 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
281 trident - pointer to target device class for 4DWave.
287 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
292 outl(mask, TRID_REG(trident, reg));
298 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
305 trident - pointer to target device class for 4DWave.
311 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
316 outl(mask, TRID_REG(trident, reg));
322 int snd_trident_allocate_pcm_channel(struct snd_trident *trident)
326 Parameters : trident - pointer to target device class for 4DWave.
332 static int snd_trident_allocate_pcm_channel(struct snd_trident * trident)
336 if (trident->ChanPCMcnt >= trident->ChanPCM)
339 if (!(trident->ChanMap[T4D_BANK_B] & (1 << idx))) {
340 trident->ChanMap[T4D_BANK_B] |= 1 << idx;
341 trident->ChanPCMcnt++;
353 Parameters : trident - pointer to target device class for 4DWave.
360 static void snd_trident_free_pcm_channel(struct snd_trident *trident, int channel)
365 if (trident->ChanMap[T4D_BANK_B] & (1 << channel)) {
366 trident->ChanMap[T4D_BANK_B] &= ~(1 << channel);
367 trident->ChanPCMcnt--;
376 Parameters : trident - pointer to target device class for 4DWave.
382 static int snd_trident_allocate_synth_channel(struct snd_trident * trident)
387 if (!(trident->ChanMap[T4D_BANK_A] & (1 << idx))) {
388 trident->ChanMap[T4D_BANK_A] |= 1 << idx;
389 trident->synth.ChanSynthCount++;
401 Parameters : trident - pointer to target device class for 4DWave.
408 static void snd_trident_free_synth_channel(struct snd_trident *trident, int channel)
413 if (trident->ChanMap[T4D_BANK_A] & (1 << channel)) {
414 trident->ChanMap[T4D_BANK_A] &= ~(1 << channel);
415 trident->synth.ChanSynthCount--;
425 Parameters: trident - pointer to target device class for 4DWave.
431 void snd_trident_write_voice_regs(struct snd_trident * trident,
445 switch (trident->device) {
478 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
479 outl(regs[0], TRID_REG(trident, CH_START + 0));
480 outl(regs[1], TRID_REG(trident, CH_START + 4));
481 outl(regs[2], TRID_REG(trident, CH_START + 8));
482 outl(regs[3], TRID_REG(trident, CH_START + 12));
483 outl(regs[4], TRID_REG(trident, CH_START + 16));
486 dev_dbg(trident->card->dev, "written %i channel:\n", voice->number);
487 dev_dbg(trident->card->dev, " regs[0] = 0x%x/0x%x\n",
488 regs[0], inl(TRID_REG(trident, CH_START + 0)));
489 dev_dbg(trident->card->dev, " regs[1] = 0x%x/0x%x\n",
490 regs[1], inl(TRID_REG(trident, CH_START + 4)));
491 dev_dbg(trident->card->dev, " regs[2] = 0x%x/0x%x\n",
492 regs[2], inl(TRID_REG(trident, CH_START + 8)));
493 dev_dbg(trident->card->dev, " regs[3] = 0x%x/0x%x\n",
494 regs[3], inl(TRID_REG(trident, CH_START + 12)));
495 dev_dbg(trident->card->dev, " regs[4] = 0x%x/0x%x\n",
496 regs[4], inl(TRID_REG(trident, CH_START + 16)));
508 Parameters: trident - pointer to target device class for 4DWave.
514 static void snd_trident_write_cso_reg(struct snd_trident * trident,
519 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
520 if (trident->device != TRIDENT_DEVICE_ID_NX) {
521 outw(voice->CSO, TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2);
524 (voice->CSO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_CSO));
534 Parameters: trident - pointer to target device class for 4DWave.
540 static void snd_trident_write_eso_reg(struct snd_trident * trident,
545 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
546 if (trident->device != TRIDENT_DEVICE_ID_NX) {
547 outw(voice->ESO, TRID_REG(trident, CH_DX_ESO_DELTA) + 2);
550 TRID_REG(trident, CH_NX_DELTA_ESO));
560 Parameters: trident - pointer to target device class for 4DWave.
566 static void snd_trident_write_vol_reg(struct snd_trident * trident,
571 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
572 switch (trident->device) {
575 outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2));
578 /* dev_dbg(trident->card->dev, "voice->Vol = 0x%x\n", voice->Vol); */
580 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
591 Parameters: trident - pointer to target device class for 4DWave.
597 static void snd_trident_write_pan_reg(struct snd_trident * trident,
602 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
604 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 3));
613 Parameters: trident - pointer to target device class for 4DWave.
619 static void snd_trident_write_rvol_reg(struct snd_trident * trident,
624 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
627 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ?
637 Parameters: trident - pointer to target device class for 4DWave.
643 static void snd_trident_write_cvol_reg(struct snd_trident * trident,
648 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
651 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ?
660 Parameters: trident - pointer to target device class for 4DWave.
690 Parameters: trident - pointer to target device class for 4DWave.
720 Parameters: trident - pointer to target device class for 4DWave.
742 Parameters: trident - pointer to target device class for 4DWave.
785 struct snd_trident *trident = snd_pcm_substream_chip(substream);
789 if (trident->tlb.entries) {
792 snd_trident_free_pages(trident, voice->memblk);
793 voice->memblk = snd_trident_alloc_pages(trident, substream);
816 struct snd_trident *trident = snd_pcm_substream_chip(substream);
825 evoice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
833 snd_trident_free_voice(trident, evoice);
877 struct snd_trident *trident = snd_pcm_substream_chip(substream);
882 if (trident->tlb.entries) {
884 snd_trident_free_pages(trident, voice->memblk);
889 snd_trident_free_voice(trident, evoice);
908 struct snd_trident *trident = snd_pcm_substream_chip(substream);
912 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[substream->number];
914 spin_lock_irq(&trident->reg_lock);
946 snd_trident_write_voice_regs(trident, voice);
956 evoice->GVSel = trident->device == TRIDENT_DEVICE_ID_SI7018 ? 0 : 1;
969 snd_trident_write_voice_regs(trident, evoice);
975 spin_unlock_irq(&trident->reg_lock);
1011 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1016 spin_lock_irq(&trident->reg_lock);
1019 outb(0, TRID_REG(trident, LEGACY_DMAR15));
1022 outb(0x54, TRID_REG(trident, LEGACY_DMAR11));
1026 outl(voice->LBA, TRID_REG(trident, LEGACY_DMAR0));
1032 outb((ESO_bytes & 0x00ff0000) >> 16, TRID_REG(trident, LEGACY_DMAR6));
1033 outw((ESO_bytes & 0x0000ffff), TRID_REG(trident, LEGACY_DMAR4));
1038 outw(val, TRID_REG(trident, T4D_SBDELTA_DELTA_R));
1047 outl((val << 16) | val, TRID_REG(trident, T4D_SBBL_SBCL));
1051 trident->bDMAStart = 0x19; // 0001 1001b
1054 trident->bDMAStart |= 0x80;
1056 trident->bDMAStart |= 0x20;
1058 trident->bDMAStart |= 0x40;
1083 snd_trident_write_voice_regs(trident, voice);
1085 spin_unlock_irq(&trident->reg_lock);
1120 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1126 snd_trident_free_voice(trident, evoice);
1145 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1150 spin_lock_irq(&trident->reg_lock);
1175 snd_trident_write_voice_regs(trident, voice);
1193 snd_trident_write_voice_regs(trident, evoice);
1199 spin_unlock_irq(&trident->reg_lock);
1216 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1221 spin_lock_irq(&trident->reg_lock);
1250 outb(((voice->number & 0x3f) | 0x80), TRID_REG(trident, T4D_RCI + voice->foldback_chan));
1252 snd_trident_write_voice_regs(trident, voice);
1262 evoice->GVSel = trident->device == TRIDENT_DEVICE_ID_SI7018 ? 0 : 1;
1270 snd_trident_write_voice_regs(trident, evoice);
1276 spin_unlock_irq(&trident->reg_lock);
1295 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1303 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
1310 spin_lock_irq(&trident->reg_lock);
1311 old_bits = trident->spdif_pcm_bits;
1313 trident->spdif_pcm_bits &= ~IEC958_AES0_PRO_FS;
1315 trident->spdif_pcm_bits &= ~(IEC958_AES3_CON_FS << 24);
1317 trident->spdif_pcm_ctrl = 0x3c; // 48000 Hz
1318 trident->spdif_pcm_bits |=
1319 trident->spdif_bits & IEC958_AES0_PROFESSIONAL ?
1324 trident->spdif_pcm_ctrl = 0x3e; // 44100 Hz
1325 trident->spdif_pcm_bits |=
1326 trident->spdif_bits & IEC958_AES0_PROFESSIONAL ?
1331 trident->spdif_pcm_ctrl = 0x3d; // 32000 Hz
1332 trident->spdif_pcm_bits |=
1333 trident->spdif_bits & IEC958_AES0_PROFESSIONAL ?
1337 change = old_bits != trident->spdif_pcm_bits;
1338 spin_unlock_irq(&trident->reg_lock);
1341 snd_ctl_notify(trident->card, SNDRV_CTL_EVENT_MASK_VALUE, &trident->spdif_pcm_ctl->id);
1359 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1363 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[substream->number];
1367 spin_lock_irq(&trident->reg_lock);
1369 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
1407 snd_trident_write_voice_regs(trident, voice);
1409 outw((RESO & 0xffff), TRID_REG(trident, NX_SPESO));
1410 outb((RESO >> 16), TRID_REG(trident, NX_SPESO + 2));
1411 outl((LBAO & 0xfffffffc), TRID_REG(trident, NX_SPLBA));
1412 outw((voice->CSO & 0xffff), TRID_REG(trident, NX_SPCTRL_SPCSO));
1413 outb((voice->CSO >> 16), TRID_REG(trident, NX_SPCTRL_SPCSO + 2));
1416 outb(trident->spdif_pcm_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
1417 outl(trident->spdif_pcm_bits, TRID_REG(trident, NX_SPCSTATUS));
1446 snd_trident_write_voice_regs(trident, voice);
1456 evoice->GVSel = trident->device == TRIDENT_DEVICE_ID_SI7018 ? 0 : 1;
1464 snd_trident_write_voice_regs(trident, evoice);
1470 outl(trident->spdif_pcm_bits, TRID_REG(trident, SI_SPDIF_CS));
1471 temp = inl(TRID_REG(trident, T4D_LFO_GC_CIR));
1473 outl(temp, TRID_REG(trident, T4D_LFO_GC_CIR));
1474 temp = inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL));
1476 outl(temp, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
1479 spin_unlock_irq(&trident->reg_lock);
1500 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1521 spin_lock(&trident->reg_lock);
1522 val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff;
1524 if ((struct snd_trident *) snd_pcm_substream_chip(s) == trident) {
1550 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
1551 outl(trident->spdif_pcm_bits, TRID_REG(trident, NX_SPCSTATUS));
1552 val = trident->spdif_pcm_ctrl;
1555 outb(val, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
1557 outl(trident->spdif_pcm_bits, TRID_REG(trident, SI_SPDIF_CS));
1558 val = inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) | SPDIF_EN;
1559 outl(val, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
1563 outl(what, TRID_REG(trident, T4D_STOP_B));
1564 val = inl(TRID_REG(trident, T4D_AINTEN_B));
1570 outl(val, TRID_REG(trident, T4D_AINTEN_B));
1572 outl(what, TRID_REG(trident, T4D_START_B));
1574 if (capture_flag && trident->device != TRIDENT_DEVICE_ID_SI7018)
1575 outb(trident->bDMAStart, TRID_REG(trident, T4D_SBCTRL_SBE2R_SBDD));
1577 if (capture_flag && trident->device != TRIDENT_DEVICE_ID_SI7018)
1578 outb(0x00, TRID_REG(trident, T4D_SBCTRL_SBE2R_SBDD));
1580 spin_unlock(&trident->reg_lock);
1597 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1605 spin_lock(&trident->reg_lock);
1607 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
1609 if (trident->device != TRIDENT_DEVICE_ID_NX) {
1610 cso = inw(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS + 2));
1612 cso = (unsigned int) inl(TRID_REG(trident, CH_NX_DELTA_CSO)) & 0x00ffffff;
1615 spin_unlock(&trident->reg_lock);
1636 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1644 result = inw(TRID_REG(trident, T4D_SBBL_SBCL));
1666 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1674 result = inl(TRID_REG(trident, NX_SPCTRL_SPCSO)) & 0x00ffffff;
1801 struct snd_trident *trident;
1804 trident = voice->trident;
1805 snd_trident_free_voice(trident, voice);
1811 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1815 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1818 snd_trident_pcm_mixer_build(trident, voice, substream);
1839 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1843 snd_trident_pcm_mixer_free(trident, voice, substream);
1860 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1864 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1869 spin_lock_irq(&trident->reg_lock);
1870 trident->spdif_pcm_bits = trident->spdif_bits;
1871 spin_unlock_irq(&trident->reg_lock);
1875 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
1881 trident->spdif_pcm_ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1882 snd_ctl_notify(trident->card, SNDRV_CTL_EVENT_MASK_VALUE |
1883 SNDRV_CTL_EVENT_MASK_INFO, &trident->spdif_pcm_ctl->id);
1901 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1904 spin_lock_irq(&trident->reg_lock);
1906 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
1907 outb(trident->spdif_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
1908 outl(trident->spdif_bits, TRID_REG(trident, NX_SPCSTATUS));
1910 outl(trident->spdif_bits, TRID_REG(trident, SI_SPDIF_CS));
1911 temp = inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL));
1912 if (trident->spdif_ctrl) {
1917 outl(temp, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
1919 spin_unlock_irq(&trident->reg_lock);
1920 trident->spdif_pcm_ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1921 snd_ctl_notify(trident->card, SNDRV_CTL_EVENT_MASK_VALUE |
1922 SNDRV_CTL_EVENT_MASK_INFO, &trident->spdif_pcm_ctl->id);
1939 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1943 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1983 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1987 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
2010 struct snd_trident *trident = snd_pcm_substream_chip(substream);
2016 spin_lock_irq(&trident->reg_lock);
2017 outb(0x00, TRID_REG(trident, T4D_RCI + voice->foldback_chan));
2018 spin_unlock_irq(&trident->reg_lock);
2111 Parameters: trident - pointer to target device class for 4DWave.
2117 int snd_trident_pcm(struct snd_trident *trident, int device)
2122 if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, trident->ChanPCM, 1, &pcm)) < 0)
2125 pcm->private_data = trident;
2127 if (trident->tlb.entries) {
2133 trident->device != TRIDENT_DEVICE_ID_SI7018 ?
2140 trident->pcm = pcm;
2142 if (trident->tlb.entries) {
2146 &trident->pci->dev,
2150 &trident->pci->dev,
2154 &trident->pci->dev,
2166 Parameters: trident - pointer to target device class for 4DWave.
2172 int snd_trident_foldback_pcm(struct snd_trident *trident, int device)
2179 if (trident->device == TRIDENT_DEVICE_ID_NX)
2181 if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, 0, num_chan, &foldback)) < 0)
2184 foldback->private_data = trident;
2185 if (trident->tlb.entries)
2201 trident->foldback = foldback;
2203 if (trident->tlb.entries)
2205 &trident->pci->dev,
2209 &trident->pci->dev,
2220 Parameters: trident - pointer to target device class for 4DWave-NX.
2226 int snd_trident_spdif_pcm(struct snd_trident *trident, int device)
2231 if ((err = snd_pcm_new(trident->card, "trident_dx_nx IEC958", device, 1, 0, &spdif)) < 0)
2234 spdif->private_data = trident;
2235 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2242 trident->spdif = spdif;
2245 &trident->pci->dev, 64*1024, 128*1024);
2266 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2269 spin_lock_irq(&trident->reg_lock);
2270 val = trident->spdif_ctrl;
2272 spin_unlock_irq(&trident->reg_lock);
2279 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2284 spin_lock_irq(&trident->reg_lock);
2286 change = trident->spdif_ctrl != val;
2287 trident->spdif_ctrl = val;
2288 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2289 if ((inb(TRID_REG(trident, NX_SPCTRL_SPCSO + 3)) & 0x10) == 0) {
2290 outl(trident->spdif_bits, TRID_REG(trident, NX_SPCSTATUS));
2291 outb(trident->spdif_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
2294 if (trident->spdif == NULL) {
2296 outl(trident->spdif_bits, TRID_REG(trident, SI_SPDIF_CS));
2297 temp = inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) & ~SPDIF_EN;
2300 outl(temp, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
2303 spin_unlock_irq(&trident->reg_lock);
2334 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2336 spin_lock_irq(&trident->reg_lock);
2337 ucontrol->value.iec958.status[0] = (trident->spdif_bits >> 0) & 0xff;
2338 ucontrol->value.iec958.status[1] = (trident->spdif_bits >> 8) & 0xff;
2339 ucontrol->value.iec958.status[2] = (trident->spdif_bits >> 16) & 0xff;
2340 ucontrol->value.iec958.status[3] = (trident->spdif_bits >> 24) & 0xff;
2341 spin_unlock_irq(&trident->reg_lock);
2348 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2356 spin_lock_irq(&trident->reg_lock);
2357 change = trident->spdif_bits != val;
2358 trident->spdif_bits = val;
2359 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2360 if ((inb(TRID_REG(trident, NX_SPCTRL_SPCSO + 3)) & 0x10) == 0)
2361 outl(trident->spdif_bits, TRID_REG(trident, NX_SPCSTATUS));
2363 if (trident->spdif == NULL)
2364 outl(trident->spdif_bits, TRID_REG(trident, SI_SPDIF_CS));
2366 spin_unlock_irq(&trident->reg_lock);
2429 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2431 spin_lock_irq(&trident->reg_lock);
2432 ucontrol->value.iec958.status[0] = (trident->spdif_pcm_bits >> 0) & 0xff;
2433 ucontrol->value.iec958.status[1] = (trident->spdif_pcm_bits >> 8) & 0xff;
2434 ucontrol->value.iec958.status[2] = (trident->spdif_pcm_bits >> 16) & 0xff;
2435 ucontrol->value.iec958.status[3] = (trident->spdif_pcm_bits >> 24) & 0xff;
2436 spin_unlock_irq(&trident->reg_lock);
2443 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2451 spin_lock_irq(&trident->reg_lock);
2452 change = trident->spdif_pcm_bits != val;
2453 trident->spdif_pcm_bits = val;
2454 if (trident->spdif != NULL) {
2455 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2456 outl(trident->spdif_pcm_bits, TRID_REG(trident, NX_SPCSTATUS));
2458 outl(trident->spdif_bits, TRID_REG(trident, SI_SPDIF_CS));
2461 spin_unlock_irq(&trident->reg_lock);
2486 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2489 spin_lock_irq(&trident->reg_lock);
2490 val = trident->ac97_ctrl = inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
2492 spin_unlock_irq(&trident->reg_lock);
2499 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2503 spin_lock_irq(&trident->reg_lock);
2504 val = trident->ac97_ctrl = inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
2508 change = val != trident->ac97_ctrl;
2509 trident->ac97_ctrl = val;
2510 outl(trident->ac97_ctrl = val, TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
2511 spin_unlock_irq(&trident->reg_lock);
2544 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2547 val = trident->musicvol_wavevol;
2558 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2562 spin_lock_irq(&trident->reg_lock);
2563 val = trident->musicvol_wavevol;
2567 change = val != trident->musicvol_wavevol;
2568 outl(trident->musicvol_wavevol = val, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
2569 spin_unlock_irq(&trident->reg_lock);
2604 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2610 if (trident->device == TRIDENT_DEVICE_ID_SI7018)
2618 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2619 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2621 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
2632 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2633 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2637 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
2642 spin_lock_irq(&trident->reg_lock);
2646 snd_trident_write_vol_reg(trident, mix->voice, val);
2647 spin_unlock_irq(&trident->reg_lock);
2682 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2683 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2697 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2698 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2706 spin_lock_irq(&trident->reg_lock);
2710 snd_trident_write_pan_reg(trident, mix->voice, val);
2711 spin_unlock_irq(&trident->reg_lock);
2745 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2746 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2755 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2756 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2761 spin_lock_irq(&trident->reg_lock);
2765 snd_trident_write_rvol_reg(trident, mix->voice, val);
2766 spin_unlock_irq(&trident->reg_lock);
2803 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2804 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2813 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2814 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2819 spin_lock_irq(&trident->reg_lock);
2823 snd_trident_write_cvol_reg(trident, mix->voice, val);
2824 spin_unlock_irq(&trident->reg_lock);
2857 static void snd_trident_notify_pcm_change(struct snd_trident *trident,
2861 snd_trident_notify_pcm_change1(trident->card, trident->ctl_vol, num, activate);
2862 snd_trident_notify_pcm_change1(trident->card, trident->ctl_pan, num, activate);
2863 snd_trident_notify_pcm_change1(trident->card, trident->ctl_rvol, num, activate);
2864 snd_trident_notify_pcm_change1(trident->card, trident->ctl_cvol, num, activate);
2867 static int snd_trident_pcm_mixer_build(struct snd_trident *trident,
2873 if (snd_BUG_ON(!trident || !voice || !substream))
2875 tmix = &trident->pcm_mixer[substream->number];
2881 snd_trident_notify_pcm_change(trident, tmix, substream->number, 1);
2885 static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_trident_voice *voice, struct snd_pcm_substream *substream)
2889 if (snd_BUG_ON(!trident || !substream))
2891 tmix = &trident->pcm_mixer[substream->number];
2893 snd_trident_notify_pcm_change(trident, tmix, substream->number, 0);
2902 Parameters: trident - pointer to target device class for 4DWave.
2908 static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
2911 struct snd_card *card = trident->card;
2924 if ((err = snd_ac97_bus(trident->card, 0, &ops, NULL, &trident->ac97_bus)) < 0)
2928 _ac97.private_data = trident;
2929 trident->ac97_detect = 1;
2932 if ((err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97)) < 0) {
2933 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
2934 if ((err = snd_trident_sis_reset(trident)) < 0)
2944 if (trident->device == TRIDENT_DEVICE_ID_SI7018 &&
2945 (inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) & SI_AC97_PRIMARY_READY) != 0) {
2947 err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec);
2949 dev_err(trident->card->dev,
2954 err = snd_ac97_modem(trident->card, &_ac97, &mc97);
2956 dev_err(trident->card->dev,
2962 trident->ac97_detect = 0;
2964 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2965 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_wave_control, trident))) < 0)
2968 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_vol_music_control, trident))) < 0)
2971 outl(trident->musicvol_wavevol = 0x00000000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
2973 outl(trident->musicvol_wavevol = 0xffff0000, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
2979 tmix = &trident->pcm_mixer[idx];
2982 if ((trident->ctl_vol = snd_ctl_new1(&snd_trident_pcm_vol_control, trident)) == NULL)
2984 if ((err = snd_ctl_add(card, trident->ctl_vol)))
2987 if ((trident->ctl_pan = snd_ctl_new1(&snd_trident_pcm_pan_control, trident)) == NULL)
2989 if ((err = snd_ctl_add(card, trident->ctl_pan)))
2992 if ((trident->ctl_rvol = snd_ctl_new1(&snd_trident_pcm_rvol_control, trident)) == NULL)
2994 if ((err = snd_ctl_add(card, trident->ctl_rvol)))
2997 if ((trident->ctl_cvol = snd_ctl_new1(&snd_trident_pcm_cvol_control, trident)) == NULL)
2999 if ((err = snd_ctl_add(card, trident->ctl_cvol)))
3002 if (trident->device == TRIDENT_DEVICE_ID_NX) {
3003 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_trident_ac97_rear_control, trident))) < 0)
3007 if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) {
3009 kctl = snd_ctl_new1(&snd_trident_spdif_control, trident);
3014 if (trident->ac97->ext_id & AC97_EI_SPDIF)
3016 if (trident->ac97_sec && (trident->ac97_sec->ext_id & AC97_EI_SPDIF))
3023 kctl = snd_ctl_new1(&snd_trident_spdif_default, trident);
3033 kctl = snd_ctl_new1(&snd_trident_spdif_mask, trident);
3043 kctl = snd_ctl_new1(&snd_trident_spdif_stream, trident);
3052 trident->spdif_pcm_ctl = kctl;
3180 static int snd_trident_sis_reset(struct snd_trident *trident)
3186 r = trident->in_suspend ? 0 : 2; /* count of retries */
3188 pci_write_config_byte(trident->pci, 0x46, 0x04); /* SOFTWARE RESET */
3190 pci_write_config_byte(trident->pci, 0x46, 0x00);
3193 outb(0x00, TRID_REG(trident, SI_AC97_GPIO));
3196 outl(i, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
3200 outl(i, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
3205 if ((inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) & SI_AC97_PRIMARY_READY) != 0)
3207 do_delay(trident);
3209 dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
3210 inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)));
3214 do_delay(trident);
3221 if ((inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)) & SI_AC97_SECONDARY_READY) != 0)
3223 do_delay(trident);
3226 outl(BANK_B_EN, TRID_REG(trident, T4D_LFO_GC_CIR));
3237 struct snd_trident *trident = entry->private_data;
3240 switch (trident->device) {
3254 snd_iprintf(buffer, "Spurious IRQs : %d\n", trident->spurious_irq_count);
3255 snd_iprintf(buffer, "Spurious IRQ dlta: %d\n", trident->spurious_irq_max_delta);
3256 if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018)
3257 snd_iprintf(buffer, "IEC958 Mixer Out : %s\n", trident->spdif_ctrl == 0x28 ? "on" : "off");
3258 if (trident->device == TRIDENT_DEVICE_ID_NX) {
3259 snd_iprintf(buffer, "Rear Speakers : %s\n", trident->ac97_ctrl & 0x00000010 ? "on" : "off");
3260 if (trident->tlb.entries) {
3262 snd_iprintf(buffer, "Memory Maximum : %d\n", trident->tlb.memhdr->size);
3263 snd_iprintf(buffer, "Memory Used : %d\n", trident->tlb.memhdr->used);
3264 snd_iprintf(buffer, "Memory Free : %d\n", snd_util_mem_avail(trident->tlb.memhdr));
3269 static void snd_trident_proc_init(struct snd_trident *trident)
3271 const char *s = "trident";
3273 if (trident->device == TRIDENT_DEVICE_ID_SI7018)
3275 snd_card_ro_proc_new(trident->card, s, trident, snd_trident_proc_read);
3280 struct snd_trident *trident = device->device_data;
3281 return snd_trident_free(trident);
3290 Parameters: trident - pointer to target device class for 4DWave.
3296 static int snd_trident_tlb_alloc(struct snd_trident *trident)
3303 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &trident->pci->dev,
3304 2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) {
3305 dev_err(trident->card->dev, "unable to allocate TLB buffer\n");
3308 trident->tlb.entries = (__le32 *)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4);
3309 trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer.addr, SNDRV_TRIDENT_MAX_PAGES * 4);
3311 trident->tlb.shadow_entries =
3314 if (!trident->tlb.shadow_entries)
3318 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &trident->pci->dev,
3319 SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) {
3320 dev_err(trident->card->dev, "unable to allocate silent page\n");
3323 memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE);
3325 trident->tlb.entries[i] = cpu_to_le32(trident->tlb.silent_page.addr & ~(SNDRV_TRIDENT_PAGE_SIZE-1));
3326 trident->tlb.shadow_entries[i] = (unsigned long)trident->tlb.silent_page.area;
3330 trident->tlb.memhdr = snd_util_memhdr_new(SNDRV_TRIDENT_PAGE_SIZE * SNDRV_TRIDENT_MAX_PAGES);
3331 if (trident->tlb.memhdr == NULL)
3334 trident->tlb.memhdr->block_extra_size = sizeof(struct snd_trident_memblk_arg);
3342 static void snd_trident_stop_all_voices(struct snd_trident *trident)
3344 outl(0xffffffff, TRID_REG(trident, T4D_STOP_A));
3345 outl(0xffffffff, TRID_REG(trident, T4D_STOP_B));
3346 outl(0, TRID_REG(trident, T4D_AINTEN_A));
3347 outl(0, TRID_REG(trident, T4D_AINTEN_B));
3350 static int snd_trident_4d_dx_init(struct snd_trident *trident)
3352 struct pci_dev *pci = trident->pci;
3365 outl(0x00000001, TRID_REG(trident, DX_ACR2_AC97_COM_STAT));
3367 outl(0x00000000, TRID_REG(trident, DX_ACR2_AC97_COM_STAT));
3369 trident->ac97_ctrl = 0x0000004a;
3370 outl(trident->ac97_ctrl, TRID_REG(trident, DX_ACR2_AC97_COM_STAT));
3374 if ((inl(TRID_REG(trident, DX_ACR2_AC97_COM_STAT)) & 0x0010) != 0)
3376 do_delay(trident);
3378 dev_err(trident->card->dev, "AC'97 codec ready error\n");
3382 snd_trident_stop_all_voices(trident);
3390 static int snd_trident_4d_nx_init(struct snd_trident *trident)
3392 struct pci_dev *pci = trident->pci;
3406 outl(0x00000001, TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
3408 outl(0x00000000, TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
3412 if ((inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT)) & 0x0008) != 0)
3414 do_delay(trident);
3416 dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
3417 inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT)));
3422 trident->ac97_ctrl = 0x00000002;
3423 outl(trident->ac97_ctrl, TRID_REG(trident, NX_ACR0_AC97_COM_STAT));
3425 outl(NX_SB_IRQ_DISABLE, TRID_REG(trident, T4D_MISCINT));
3427 snd_trident_stop_all_voices(trident);
3429 if (trident->tlb.entries != NULL) {
3432 i = trident->tlb.entries_dmaaddr;
3434 outl(i, TRID_REG(trident, NX_TLBC));
3436 outl(0, TRID_REG(trident, NX_TLBC));
3439 outl(trident->spdif_bits, TRID_REG(trident, NX_SPCSTATUS));
3440 outb(trident->spdif_ctrl, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
3448 static int snd_trident_sis_init(struct snd_trident *trident)
3452 if ((err = snd_trident_sis_reset(trident)) < 0)
3455 snd_trident_stop_all_voices(trident);
3458 outl(trident->spdif_bits, TRID_REG(trident, SI_SPDIF_CS));
3486 struct snd_trident *trident;
3508 trident = kzalloc(sizeof(*trident), GFP_KERNEL);
3509 if (trident == NULL) {
3513 trident->device = (pci->vendor << 16) | pci->device;
3514 trident->card = card;
3515 trident->pci = pci;
3516 spin_lock_init(&trident->reg_lock);
3517 spin_lock_init(&trident->event_lock);
3518 spin_lock_init(&trident->voice_alloc);
3523 trident->ChanPCM = pcm_streams;
3526 trident->synth.max_size = max_wavetable_size * 1024;
3527 trident->irq = -1;
3529 trident->midi_port = TRID_REG(trident, T4D_MPU401_BASE);
3533 kfree(trident);
3537 trident->port = pci_resource_start(pci, 0);
3540 KBUILD_MODNAME, trident)) {
3542 snd_trident_free(trident);
3545 trident->irq = pci->irq;
3546 card->sync_irq = trident->irq;
3549 trident->tlb.entries = NULL;
3550 trident->tlb.buffer.area = NULL;
3551 if (trident->device == TRIDENT_DEVICE_ID_NX) {
3552 if ((err = snd_trident_tlb_alloc(trident)) < 0) {
3553 snd_trident_free(trident);
3558 trident->spdif_bits = trident->spdif_pcm_bits = SNDRV_PCM_DEFAULT_CON_SPDIF;
3561 switch (trident->device) {
3563 err = snd_trident_4d_dx_init(trident);
3566 err = snd_trident_4d_nx_init(trident);
3569 err = snd_trident_sis_init(trident);
3576 snd_trident_free(trident);
3580 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
3581 snd_trident_free(trident);
3585 if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0)
3590 voice = &trident->synth.voices[i];
3592 voice->trident = trident;
3596 tmix = &trident->pcm_mixer[i];
3603 snd_trident_enable_eso(trident);
3605 snd_trident_proc_init(trident);
3606 *rtrident = trident;
3616 Parameters: trident - device specific private data for 4DWave card
3622 static int snd_trident_free(struct snd_trident *trident)
3624 snd_trident_free_gameport(trident);
3625 snd_trident_disable_eso(trident);
3627 if (trident->device == TRIDENT_DEVICE_ID_NX)
3628 outb(0x00, TRID_REG(trident, NX_SPCTRL_SPCSO + 3));
3629 else if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
3630 outl(0, TRID_REG(trident, SI_SERIAL_INTF_CTRL));
3632 if (trident->irq >= 0)
3633 free_irq(trident->irq, trident);
3634 if (trident->tlb.buffer.area) {
3635 outl(0, TRID_REG(trident, NX_TLBC));
3636 snd_util_memhdr_free(trident->tlb.memhdr);
3637 if (trident->tlb.silent_page.area)
3638 snd_dma_free_pages(&trident->tlb.silent_page);
3639 vfree(trident->tlb.shadow_entries);
3640 snd_dma_free_pages(&trident->tlb.buffer);
3642 pci_release_regions(trident->pci);
3643 pci_disable_device(trident->pci);
3644 kfree(trident);
3653 Parameters: trident - device specific private data for 4DWave card
3668 struct snd_trident *trident = dev_id;
3673 audio_int = inl(TRID_REG(trident, T4D_MISCINT));
3678 spin_lock(&trident->reg_lock);
3679 stimer = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff;
3680 chn_int = inl(TRID_REG(trident, T4D_AINT_A));
3683 outl(chn_int, TRID_REG(trident, T4D_AINT_A)); /* ack */
3685 chn_int = inl(TRID_REG(trident, T4D_AINT_B));
3692 voice = &trident->synth.voices[channel];
3694 outl(mask, TRID_REG(trident, T4D_STOP_B));
3702 trident->spurious_irq_count++;
3703 if (trident->spurious_irq_max_delta < (unsigned int)delta)
3704 trident->spurious_irq_max_delta = delta;
3710 tmp = inw(TRID_REG(trident, T4D_SBBL_SBCL));
3711 if (trident->bDMAStart & 0x40)
3716 tmp = inl(TRID_REG(trident, NX_SPCTRL_SPCSO)) & 0x00ffffff;
3724 snd_trident_stop_voice(trident, voice->number);
3725 snd_trident_write_eso_reg(trident, voice, tmp);
3726 snd_trident_start_voice(trident, voice->number);
3731 snd_trident_stop_voice(trident, voice->number);
3732 snd_trident_write_cso_reg(trident, voice, voice->isync_mark);
3733 snd_trident_write_eso_reg(trident, voice, voice->ESO);
3734 snd_trident_start_voice(trident, voice->number);
3739 snd_trident_stop_voice(trident, voice->extra->number);
3740 snd_trident_write_cso_reg(trident, voice->extra, 0);
3741 snd_trident_start_voice(trident, voice->extra->number);
3744 spin_unlock(&trident->reg_lock);
3746 spin_lock(&trident->reg_lock);
3748 outl(chn_int, TRID_REG(trident, T4D_AINT_B)); /* ack */
3750 spin_unlock(&trident->reg_lock);
3753 if (trident->rmidi) {
3754 snd_mpu401_uart_interrupt(irq, trident->rmidi->private_data);
3756 inb(TRID_REG(trident, T4D_MPUR0));
3759 // outl((ST_TARGET_REACHED | MIXER_OVERFLOW | MIXER_UNDERFLOW), TRID_REG(trident, T4D_MISCINT));
3763 struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, int client, int port)
3769 spin_lock_irqsave(&trident->voice_alloc, flags);
3771 idx = snd_trident_allocate_pcm_channel(trident);
3773 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3776 pvoice = &trident->synth.voices[idx];
3783 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3787 idx = snd_trident_allocate_synth_channel(trident);
3789 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3792 pvoice = &trident->synth.voices[idx];
3798 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3803 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3809 void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice)
3816 snd_trident_clear_voices(trident, voice->number, voice->number);
3817 spin_lock_irqsave(&trident->voice_alloc, flags);
3822 snd_trident_free_pcm_channel(trident, voice->number);
3824 snd_trident_free_synth_channel(trident, voice->number);
3830 spin_unlock_irqrestore(&trident->voice_alloc, flags);
3837 static void snd_trident_clear_voices(struct snd_trident * trident, unsigned short v_min, unsigned short v_max)
3846 outl(mask[0], TRID_REG(trident, T4D_STOP_A));
3847 val = inl(TRID_REG(trident, T4D_AINTEN_A));
3848 outl(val & ~mask[0], TRID_REG(trident, T4D_AINTEN_A));
3851 outl(mask[1], TRID_REG(trident, T4D_STOP_B));
3852 val = inl(TRID_REG(trident, T4D_AINTEN_B));
3853 outl(val & ~mask[1], TRID_REG(trident, T4D_AINTEN_B));
3861 struct snd_trident *trident = card->private_data;
3863 trident->in_suspend = 1;
3865 snd_ac97_suspend(trident->ac97);
3866 snd_ac97_suspend(trident->ac97_sec);
3873 struct snd_trident *trident = card->private_data;
3875 switch (trident->device) {
3877 snd_trident_4d_dx_init(trident);
3880 snd_trident_4d_nx_init(trident);
3883 snd_trident_sis_init(trident);
3887 snd_ac97_resume(trident->ac97);
3888 snd_ac97_resume(trident->ac97_sec);
3891 outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
3893 snd_trident_enable_eso(trident);
3896 trident->in_suspend = 0;