]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/pci/au88x0/au88x0_core.c
Merge git://git.infradead.org/users/dwmw2/mtd-2.6.38
[mv-sheeva.git] / sound / pci / au88x0 / au88x0_core.c
index 3906f5afe27a3a9b27c9f0bf90e36108664d4925..16c0bdfbb16481148acfeb4845cbfcc020e5b6ab 100644 (file)
@@ -1252,11 +1252,19 @@ static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) {
 static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma)
 {
        stream_t *dma = &vortex->dma_adb[adbdma];
-       int temp;
+       int temp, page, delta;
 
        temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2));
-       temp = (dma->period_virt * dma->period_bytes) + (temp & POS_MASK);
-       return (temp);
+       page = (temp & ADB_SUBBUF_MASK) >> ADB_SUBBUF_SHIFT;
+       if (dma->nr_periods >= 4)
+               delta = (page - dma->period_real) & 3;
+       else {
+               delta = (page - dma->period_real);
+               if (delta < 0)
+                       delta += dma->nr_periods;
+       }
+       return (dma->period_virt + delta) * dma->period_bytes
+               + (temp & (dma->period_bytes - 1));
 }
 
 static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma)
@@ -1504,8 +1512,7 @@ static int inline vortex_wtdma_getlinearpos(vortex_t * vortex, int wtdma)
        int temp;
 
        temp = hwread(vortex->mmio, VORTEX_WTDMA_STAT + (wtdma << 2));
-       //temp = (temp & POS_MASK) + (((temp>>WT_SUBBUF_SHIFT) & WT_SUBBUF_MASK)*(dma->cfg0&POS_MASK));
-       temp = (temp & POS_MASK) + ((dma->period_virt) * (dma->period_bytes));
+       temp = (dma->period_virt * dma->period_bytes) + (temp & (dma->period_bytes - 1));
        return temp;
 }
 
@@ -2441,7 +2448,8 @@ static irqreturn_t vortex_interrupt(int irq, void *dev_id)
                spin_lock(&vortex->lock);
                for (i = 0; i < NR_ADB; i++) {
                        if (vortex->dma_adb[i].fifo_status == FIFO_START) {
-                               if (vortex_adbdma_bufshift(vortex, i)) ;
+                               if (!vortex_adbdma_bufshift(vortex, i))
+                                       continue;
                                spin_unlock(&vortex->lock);
                                snd_pcm_period_elapsed(vortex->dma_adb[i].
                                                       substream);