Index: cmpci.c =================================================================== RCS file: /home/cltien/cvs/cmpci/cmpci.c,v retrieving revision 6.72 retrieving revision 6.75 diff -a -u -r6.72 -r6.75 --- linux-2.4.25/drivers/sound/cmpci.c 2 Apr 2004 04:17:24 -0000 6.72 +++ linux-2.4.25new/drivers/sound/cmpci.c 4 Apr 2004 00:24:21 -0000 6.75 @@ -452,21 +452,9 @@ static LIST_HEAD(devs); -#ifdef CONFIG_SOUND_CMPCI_MIDI -static int mpuio = CONFIG_SOUND_CMPCI_MPUIO; -#else -static int mpuio; -#endif -#ifdef CONFIG_SOUND_CMPCI_FM -static int fmio = CONFIG_SOUND_CMPCI_FMIO; -#else -static int fmio; -#endif -#ifdef CONFIG_SOUND_CMPCI_JOYSTICK -static int joystick = 1; -#else -static int joystick; -#endif +static int mpuio = 0; +static int fmio = 0; +static int joystick = 0; static int spdif_inverse = 0; static int spdif_loop = 0; static int spdif_out = 0; @@ -1470,26 +1458,7 @@ /* update ADC pointer */ if (s->dma_adc.ready) { if (s->status & DO_DUAL_DAC) { - hwptr = get_dmaadc(s) % s->dma_adc.dmasize; - diff = (s->dma_adc.dmasize + hwptr - s->dma_adc.hwptr) % s->dma_adc.dmasize; - s->dma_adc.hwptr = hwptr; - s->dma_adc.total_bytes += diff; - if (s->dma_adc.mapped) { - s->dma_adc.count += diff; - if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) - wake_up(&s->dma_adc.wait); - } else { - s->dma_adc.count -= diff; - if (s->dma_adc.count <= 0) { - pause_adc(s); - s->dma_adc.error++; - } else if (s->dma_adc.count <= (signed)s->dma_adc.fragsize && !s->dma_adc.endcleared) { - clear_advance(s); - s->dma_adc.endcleared = 1; - } - if (s->dma_adc.count + (signed)s->dma_adc.fragsize <= (signed)s->dma_adc.dmasize) - wake_up(&s->dma_adc.wait); - } + /* the dac part will finish for this */ } else { hwptr = get_dmaadc(s) % s->dma_adc.dmasize; diff = (s->dma_adc.dmasize + hwptr - s->dma_adc.hwptr) % s->dma_adc.dmasize; @@ -1512,18 +1481,28 @@ diff = (s->dma_dac.dmasize + hwptr - s->dma_dac.hwptr) % s->dma_dac.dmasize; s->dma_dac.hwptr = hwptr; s->dma_dac.total_bytes += diff; + if (s->status & DO_DUAL_DAC) { + s->dma_adc.hwptr = hwptr; + s->dma_adc.total_bytes += diff; + } if (s->dma_dac.mapped) { s->dma_dac.count += diff; + if (s->status & DO_DUAL_DAC) + s->dma_adc.count += diff; if (s->dma_dac.count >= (signed)s->dma_dac.fragsize) wake_up(&s->dma_dac.wait); } else { s->dma_dac.count -= diff; + if (s->status & DO_DUAL_DAC) + s->dma_adc.count -= diff; if (s->dma_dac.count <= 0) { pause_dac(s); s->dma_dac.error++; } else if (s->dma_dac.count <= (signed)s->dma_dac.fragsize && !s->dma_dac.endcleared) { clear_advance(s); s->dma_dac.endcleared = 1; + if (s->status & DO_DUAL_DAC) + s->dma_adc.endcleared = 1; } if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize) wake_up(&s->dma_dac.wait); @@ -1566,9 +1545,6 @@ static const char invalid_magic[] = KERN_CRIT "cmpci: invalid magic value\n"; -#ifdef CONFIG_SOUND_CMPCI /* support multiple chips */ -#define VALIDATE_STATE(s) -#else #define VALIDATE_STATE(s) \ ({ \ if (!(s) || (s)->magic != CM_MAGIC) { \ @@ -1576,7 +1552,6 @@ return -ENXIO; \ } \ }) -#endif /* --------------------------------------------------------------------- */ @@ -3343,7 +3318,7 @@ static int __init init_cmpci(void) { - printk(KERN_INFO "cmpci: version $Revision: 6.72 $ time " __TIME__ " " __DATE__ "\n"); + printk(KERN_INFO "cmpci: version $Revision: 6.75 $ time " __TIME__ " " __DATE__ "\n"); return pci_module_init(&cm_driver); }