fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / au88x0 / au88x0_core.c
index 772bc61..4a336ea 100644 (file)
@@ -376,7 +376,7 @@ vortex_mixer_delWTD(vortex_t * vortex, unsigned char mix, unsigned char ch)
 
 static void vortex_mixer_init(vortex_t * vortex)
 {
-       unsigned long addr;
+       u32 addr;
        int x;
 
        // FIXME: get rid of this crap.
@@ -639,7 +639,7 @@ static void vortex_src_setupchannel(vortex_t * card, unsigned char src,
 
 static void vortex_srcblock_init(vortex_t * vortex)
 {
-       unsigned long addr;
+       u32 addr;
        int x;
        hwwrite(vortex->mmio, VORTEX_SRC_SOURCESIZE, 0x1ff);
        /*
@@ -1035,7 +1035,7 @@ vortex_fifo_setwtctrl(vortex_t * vortex, int fifo, int ctrl, int priority,
 static void vortex_fifo_init(vortex_t * vortex)
 {
        int x;
-       unsigned long addr;
+       u32 addr;
 
        /* ADB DMA channels fifos. */
        addr = VORTEX_FIFO_ADBCTRL + ((NR_ADB - 1) * 4);
@@ -1054,7 +1054,7 @@ static void vortex_fifo_init(vortex_t * vortex)
                hwwrite(vortex->mmio, addr, FIFO_U0);
                if (hwread(vortex->mmio, addr) != FIFO_U0)
                        printk(KERN_ERR
-                              "bad wt fifo reset (0x%08lx, 0x%08x)!\n",
+                              "bad wt fifo reset (0x%08x, 0x%08x)!\n",
                               addr, hwread(vortex->mmio, addr));
                vortex_fifo_clearwtdata(vortex, x, FIFO_SIZE);
                addr -= 4;
@@ -1097,7 +1097,7 @@ static void vortex_adbdma_setstartbuffer(vortex_t * vortex, int adbdma, int sb)
 
 static void
 vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
-                        snd_pcm_sgbuf_t * sgbuf, int psize, int count)
+                        struct snd_sg_buf * sgbuf, int psize, int count)
 {
        stream_t *dma = &vortex->dma_adb[adbdma];
 
@@ -1152,7 +1152,7 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
 
 static void
 vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir,
-                     int fmt, int d, unsigned long offset)
+                     int fmt, int d, u32 offset)
 {
        stream_t *dma = &vortex->dma_adb[adbdma];
 
@@ -1367,7 +1367,7 @@ static void vortex_wtdma_setstartbuffer(vortex_t * vortex, int wtdma, int sb)
 
 static void
 vortex_wtdma_setbuffers(vortex_t * vortex, int wtdma,
-                       snd_pcm_sgbuf_t * sgbuf, int psize, int count)
+                       struct snd_sg_buf * sgbuf, int psize, int count)
 {
        stream_t *dma = &vortex->dma_wt[wtdma];
 
@@ -1411,7 +1411,7 @@ vortex_wtdma_setbuffers(vortex_t * vortex, int wtdma,
 
 static void
 vortex_wtdma_setmode(vortex_t * vortex, int wtdma, int ie, int fmt, int d,
-                    /*int e, */ unsigned long offset)
+                    /*int e, */ u32 offset)
 {
        stream_t *dma = &vortex->dma_wt[wtdma];
 
@@ -2033,7 +2033,7 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype)
                        }
                }
        }
-       printk("vortex: FATAL: ResManager: resource type %d exhausted.\n", restype);
+       printk(KERN_ERR "vortex: FATAL: ResManager: resource type %d exhausted.\n", restype);
        return -ENOMEM;
 }
 
@@ -2165,7 +2165,7 @@ vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch, int dir, int type)
                                memset(stream->resources, 0,
                                       sizeof(unsigned char) *
                                       VORTEX_RESOURCE_LAST);
-                               printk("vortex: out of A3D sources. Sorry\n");
+                               printk(KERN_ERR "vortex: out of A3D sources. Sorry\n");
                                return -EBUSY;
                        }
                        /* (De)Initialize A3D hardware source. */
@@ -2385,7 +2385,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;
@@ -2462,7 +2462,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;
        }
 
@@ -2480,7 +2480,8 @@ static void vortex_codec_init(vortex_t * vortex)
        int i;
 
        for (i = 0; i < 32; i++) {
-               hwwrite(vortex->mmio, (VORTEX_CODEC_CHN + (i << 2)), 0);
+               /* the windows driver writes -i, so we write -i */
+               hwwrite(vortex->mmio, (VORTEX_CODEC_CHN + (i << 2)), -i);
                msleep(2);
        }
        if (0) {
@@ -2502,7 +2503,7 @@ static void vortex_codec_init(vortex_t * vortex)
                hwwrite(vortex->mmio, VORTEX_CODEC_CTRL, 0x00e8);
        }
        for (i = 0; i < 32; i++) {
-               hwwrite(vortex->mmio, (VORTEX_CODEC_CHN + (i << 2)), 0);
+               hwwrite(vortex->mmio, (VORTEX_CODEC_CHN + (i << 2)), -i);
                msleep(5);
        }
        hwwrite(vortex->mmio, VORTEX_CODEC_CTRL, 0xe8);
@@ -2513,7 +2514,7 @@ static void vortex_codec_init(vortex_t * vortex)
 }
 
 static void
-vortex_codec_write(ac97_t * codec, unsigned short addr, unsigned short data)
+vortex_codec_write(struct snd_ac97 * codec, unsigned short addr, unsigned short data)
 {
 
        vortex_t *card = (vortex_t *) codec->private_data;
@@ -2531,13 +2532,14 @@ vortex_codec_write(ac97_t * codec, unsigned short addr, unsigned short data)
        hwwrite(card->mmio, VORTEX_CODEC_IO,
                ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK) |
                ((data << VORTEX_CODEC_DATSHIFT) & VORTEX_CODEC_DATMASK) |
-               VORTEX_CODEC_WRITE);
+               VORTEX_CODEC_WRITE |
+               (codec->num << VORTEX_CODEC_ID_SHIFT) );
 
        /* Flush Caches. */
        hwread(card->mmio, VORTEX_CODEC_IO);
 }
 
-static unsigned short vortex_codec_read(ac97_t * codec, unsigned short addr)
+static unsigned short vortex_codec_read(struct snd_ac97 * codec, unsigned short addr)
 {
 
        vortex_t *card = (vortex_t *) codec->private_data;
@@ -2553,7 +2555,8 @@ static unsigned short vortex_codec_read(ac97_t * codec, unsigned short addr)
                }
        }
        /* set up read address */
-       read_addr = ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK);
+       read_addr = ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK) |
+               (codec->num << VORTEX_CODEC_ID_SHIFT) ;
        hwwrite(card->mmio, VORTEX_CODEC_IO, read_addr);
 
        /* wait for address */
@@ -2655,7 +2658,7 @@ static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode)
 
 /* Initialization */
 
-static int vortex_core_init(vortex_t * vortex)
+static int __devinit vortex_core_init(vortex_t * vortex)
 {
 
        printk(KERN_INFO "Vortex: init.... ");
@@ -2687,7 +2690,7 @@ static int 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);
@@ -2715,7 +2718,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);