fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / sparc / cs4231.c
index 8804f26..f5956d5 100644 (file)
@@ -8,7 +8,6 @@
  * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -1269,7 +1268,7 @@ static struct snd_pcm_hardware snd_cs4231_playback =
        .channels_min           = 1,
        .channels_max           = 2,
        .buffer_bytes_max       = (32*1024),
-       .period_bytes_min       = 4096,
+       .period_bytes_min       = 64,
        .period_bytes_max       = (32*1024),
        .periods_min            = 1,
        .periods_max            = 1024,
@@ -1289,7 +1288,7 @@ static struct snd_pcm_hardware snd_cs4231_capture =
        .channels_min           = 1,
        .channels_max           = 2,
        .buffer_bytes_max       = (32*1024),
-       .period_bytes_min       = 4096,
+       .period_bytes_min       = 64,
        .period_bytes_max       = (32*1024),
        .periods_min            = 1,
        .periods_max            = 1024,
@@ -1754,7 +1753,7 @@ out_err:
 
 #ifdef SBUS_SUPPORT
 
-static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id)
 {
        unsigned long flags;
        unsigned char status;
@@ -1797,7 +1796,7 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_re
        snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0);
        spin_unlock_irqrestore(&chip->lock, flags);
 
-       return 0;
+       return IRQ_HANDLED;
 }
 
 /*
@@ -1822,7 +1821,6 @@ static int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_
        if (!(csr & test))
                goto out;
        err = -EBUSY;
-       csr = sbus_readl(base->regs + APCCSR);
        test = APC_XINT_CNVA;
        if ( base->dir == APC_PLAY )
                test = APC_XINT_PNVA;
@@ -1863,17 +1861,16 @@ static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
 
        spin_lock_irqsave(&base->lock, flags);
        if (!on) {
-               if (base->dir == APC_PLAY) { 
-                       sbus_writel(0, base->regs + base->dir + APCNVA); 
-                       sbus_writel(1, base->regs + base->dir + APCC); 
-               }
-               else
-               {
-                       sbus_writel(0, base->regs + base->dir + APCNC); 
-                       sbus_writel(0, base->regs + base->dir + APCVA); 
-               } 
+               sbus_writel(0, base->regs + base->dir + APCNC);
+               sbus_writel(0, base->regs + base->dir + APCNVA);
+               sbus_writel(0, base->regs + base->dir + APCC);
+               sbus_writel(0, base->regs + base->dir + APCVA);
+
+               /* ACK any APC interrupts. */
+               csr = sbus_readl(base->regs + APCCSR);
+               sbus_writel(csr, base->regs + APCCSR);
        } 
-       udelay(600); 
+       udelay(1000);
        csr = sbus_readl(base->regs + APCCSR);
        shift = 0;
        if ( base->dir == APC_PLAY )
@@ -2002,10 +1999,9 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
        chip->c_dma.preallocate = sbus_dma_preallocate;
 
        if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
-                       SA_SHIRQ, "cs4231", chip)) {
-               snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %s\n",
-                          dev,
-                          __irq_itoa(sdev->irqs[0]));
+                       IRQF_SHARED, "cs4231", chip)) {
+               snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n",
+                           dev, sdev->irqs[0]);
                snd_cs4231_sbus_free(chip);
                return -EBUSY;
        }
@@ -2038,11 +2034,11 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev)
        if (err)
                return err;
 
-       sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
+       sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d",
                card->shortname,
                rp->flags & 0xffL,
-               rp->start,
-               __irq_itoa(sdev->irqs[0]));
+               (unsigned long long)rp->start,
+               sdev->irqs[0]);
 
        if ((err = snd_cs4231_sbus_create(card, sdev, dev, &cp)) < 0) {
                snd_card_free(card);
@@ -2244,10 +2240,10 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
        if (err)
                return err;
 
-       sprintf(card->longname, "%s at 0x%lx, irq %s",
+       sprintf(card->longname, "%s at 0x%lx, irq %d",
                card->shortname,
                edev->resource[0].start,
-               __irq_itoa(edev->irqs[0]));
+               edev->irqs[0]);
 
        if ((err = snd_cs4231_ebus_create(card, edev, dev, &chip)) < 0) {
                snd_card_free(card);
@@ -2285,15 +2281,14 @@ static int __init cs4231_init(void)
                for_each_ebusdev(edev, ebus) {
                        int match = 0;
 
-                       if (!strcmp(edev->prom_name, "SUNW,CS4231")) {
+                       if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
                                match = 1;
-                       } else if (!strcmp(edev->prom_name, "audio")) {
-                               char compat[16];
+                       } else if (!strcmp(edev->prom_node->name, "audio")) {
+                               char *compat;
 
-                               prom_getstring(edev->prom_node, "compatible",
-                                              compat, sizeof(compat));
-                               compat[15] = '\0';
-                               if (!strcmp(compat, "SUNW,CS4231"))
+                               compat = of_get_property(edev->prom_node,
+                                                        "compatible", NULL);
+                               if (compat && !strcmp(compat, "SUNW,CS4231"))
                                        match = 1;
                        }