]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/au88x0/au88x0_core.c
ALSA: Clean up SG-buffer helper functions and macros
[linux-2.6-omap-h63xx.git] / sound / pci / au88x0 / au88x0_core.c
index 4347e6abc1d5402765ebb6bf93b8243801efbfe0..b070e57145143e6cb0703f338d9bf5db7dd3cffc 100644 (file)
@@ -427,7 +427,7 @@ static void vortex_mixer_init(vortex_t * vortex)
 
        /* Set clipping ceiling (this may be all wrong). */
        /*
-       for (x = 0; x > 0x80; x++) {
+       for (x = 0; x < 0x80; x++) {
                hwwrite(vortex->mmio, VORTEX_MIXER_CLIP + (x << 2), 0x3ffff);
        }
        */
@@ -1097,19 +1097,12 @@ static void vortex_adbdma_setstartbuffer(vortex_t * vortex, int adbdma, int sb)
 
 static void
 vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
-                        struct snd_sg_buf * sgbuf, int psize, int count)
+                        int psize, int count)
 {
        stream_t *dma = &vortex->dma_adb[adbdma];
 
-       if (sgbuf == NULL) {
-               printk(KERN_INFO "vortex: FATAL: sgbuf is NULL!\n");
-               return;
-       }
-       //printk(KERN_INFO "vortex: page count = %d, tblcount = %d\n", count, sgbuf->tblsize);
-
        dma->period_bytes = psize;
        dma->nr_periods = count;
-       dma->sgbuf = sgbuf;
 
        dma->cfg0 = 0;
        dma->cfg1 = 0;
@@ -1120,26 +1113,26 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
                dma->cfg1 |= 0x88000000 | 0x44000000 | 0x30000000 | (psize - 1);
                hwwrite(vortex->mmio,
                        VORTEX_ADBDMA_BUFBASE + (adbdma << 4) + 0xc,
-                       snd_sgbuf_get_addr(sgbuf, psize * 3));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize * 3));
                /* 3 pages */
        case 3:
                dma->cfg0 |= 0x12000000;
                dma->cfg1 |= 0x80000000 | 0x40000000 | ((psize - 1) << 0xc);
                hwwrite(vortex->mmio,
                        VORTEX_ADBDMA_BUFBASE + (adbdma << 4) + 0x8,
-                       snd_sgbuf_get_addr(sgbuf, psize * 2));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize * 2));
                /* 2 pages */
        case 2:
                dma->cfg0 |= 0x88000000 | 0x44000000 | 0x10000000 | (psize - 1);
                hwwrite(vortex->mmio,
                        VORTEX_ADBDMA_BUFBASE + (adbdma << 4) + 0x4,
-                       snd_sgbuf_get_addr(sgbuf, psize));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize));
                /* 1 page */
        case 1:
                dma->cfg0 |= 0x80000000 | 0x40000000 | ((psize - 1) << 0xc);
                hwwrite(vortex->mmio,
                        VORTEX_ADBDMA_BUFBASE + (adbdma << 4),
-                       snd_sgbuf_get_addr(sgbuf, 0));
+                       snd_pcm_sgbuf_get_addr(dma->substream, 0));
                break;
        }
        //printk("vortex: cfg0 = 0x%x\nvortex: cfg1=0x%x\n", dma->cfg0, dma->cfg1);
@@ -1205,7 +1198,7 @@ static int vortex_adbdma_bufshift(vortex_t * vortex, int adbdma)
                        //hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFBASE+(((adbdma << 2)+pp) << 2), dma->table[p].addr);
                        hwwrite(vortex->mmio,
                                VORTEX_ADBDMA_BUFBASE + (((adbdma << 2) + pp) << 2),
-                               snd_sgbuf_get_addr(dma->sgbuf,
+                               snd_pcm_sgbuf_get_addr(dma->substream,
                                dma->period_bytes * p));
                        /* Force write thru cache. */
                        hwread(vortex->mmio, VORTEX_ADBDMA_BUFBASE +
@@ -1244,7 +1237,10 @@ static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) {
                        if (pp >= 4)
                                pp -= 4;
                }
-               hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFBASE+(((adbdma << 2)+pp) << 2), snd_sgbuf_get_addr(dma->sgbuf, dma->period_bytes * p));
+               hwwrite(vortex->mmio,
+                       VORTEX_ADBDMA_BUFBASE + (((adbdma << 2) + pp) << 2),
+                       snd_pcm_sgbuf_get_addr(dma->substream,
+                                              dma->period_bytes * p));
                /* Force write thru cache. */
                hwread(vortex->mmio, VORTEX_ADBDMA_BUFBASE + (((adbdma << 2)+pp) << 2));
        }
@@ -1367,13 +1363,12 @@ static void vortex_wtdma_setstartbuffer(vortex_t * vortex, int wtdma, int sb)
 
 static void
 vortex_wtdma_setbuffers(vortex_t * vortex, int wtdma,
-                       struct snd_sg_buf * sgbuf, int psize, int count)
+                       int psize, int count)
 {
        stream_t *dma = &vortex->dma_wt[wtdma];
 
        dma->period_bytes = psize;
        dma->nr_periods = count;
-       dma->sgbuf = sgbuf;
 
        dma->cfg0 = 0;
        dma->cfg1 = 0;
@@ -1383,23 +1378,23 @@ vortex_wtdma_setbuffers(vortex_t * vortex, int wtdma,
        case 4:
                dma->cfg1 |= 0x88000000 | 0x44000000 | 0x30000000 | (psize-1);
                hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4) + 0xc,
-                       snd_sgbuf_get_addr(sgbuf, psize * 3));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize * 3));
                /* 3 pages */
        case 3:
                dma->cfg0 |= 0x12000000;
                dma->cfg1 |= 0x80000000 | 0x40000000 | ((psize-1) << 0xc);
                hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4)  + 0x8,
-                       snd_sgbuf_get_addr(sgbuf, psize * 2));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize * 2));
                /* 2 pages */
        case 2:
                dma->cfg0 |= 0x88000000 | 0x44000000 | 0x10000000 | (psize-1);
                hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4) + 0x4,
-                       snd_sgbuf_get_addr(sgbuf, psize));
+                       snd_pcm_sgbuf_get_addr(dma->substream, psize));
                /* 1 page */
        case 1:
                dma->cfg0 |= 0x80000000 | 0x40000000 | ((psize-1) << 0xc);
                hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4),
-                       snd_sgbuf_get_addr(sgbuf, 0));
+                       snd_pcm_sgbuf_get_addr(dma->substream, 0));
                break;
        }
        hwwrite(vortex->mmio, VORTEX_WTDMA_BUFCFG0 + (wtdma << 3), dma->cfg0);
@@ -1465,7 +1460,8 @@ static int vortex_wtdma_bufshift(vortex_t * vortex, int wtdma)
                        hwwrite(vortex->mmio,
                                VORTEX_WTDMA_BUFBASE +
                                (((wtdma << 2) + pp) << 2),
-                               snd_sgbuf_get_addr(dma->sgbuf, dma->period_bytes * p));
+                               snd_pcm_sgbuf_get_addr(dma->substream,
+                                                      dma->period_bytes * p));
                        /* Force write thru cache. */
                        hwread(vortex->mmio, VORTEX_WTDMA_BUFBASE +
                               (((wtdma << 2) + pp) << 2));
@@ -2385,7 +2381,7 @@ static void vortex_disable_int(vortex_t * card)
                hwread(card->mmio, VORTEX_CTRL) & ~CTRL_IRQ_ENABLE);
 }
 
-static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t vortex_interrupt(int irq, void *dev_id)
 {
        vortex_t *vortex = dev_id;
        int i, handled;
@@ -2395,7 +2391,7 @@ static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        if (!(hwread(vortex->mmio, VORTEX_STAT) & 0x1))
                return IRQ_NONE;
 
-       // This is the Interrrupt Enable flag we set before (consistency check).
+       // This is the Interrupt Enable flag we set before (consistency check).
        if (!(hwread(vortex->mmio, VORTEX_CTRL) & CTRL_IRQ_ENABLE))
                return IRQ_NONE;
 
@@ -2462,7 +2458,7 @@ static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        }
        if (source & IRQ_MIDI) {
                snd_mpu401_uart_interrupt(vortex->irq,
-                                         vortex->rmidi->private_data, regs);
+                                         vortex->rmidi->private_data);
                handled = 1;
        }
 
@@ -2690,7 +2686,7 @@ static int __devinit vortex_core_init(vortex_t * vortex)
 #ifndef CHIP_AU8820
        vortex_eq_init(vortex);
        vortex_spdif_init(vortex, 48000, 1);
-       vortex_Vort3D(vortex, 1);
+       vortex_Vort3D_enable(vortex);
 #endif
 #ifndef CHIP_AU8810
        vortex_wt_init(vortex);
@@ -2718,7 +2714,7 @@ static int vortex_core_shutdown(vortex_t * vortex)
        printk(KERN_INFO "Vortex: shutdown...");
 #ifndef CHIP_AU8820
        vortex_eq_free(vortex);
-       vortex_Vort3D(vortex, 0);
+       vortex_Vort3D_disable(vortex);
 #endif
        //vortex_disable_timer_int(vortex);
        vortex_disable_int(vortex);