ALSA: hda_intel: fix handling of non-completion stream interrupts
[safe/jmp/linux-2.6] / sound / pci / via82xx.c
index 5faa579..7e494b6 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   VT82C686A/B/C, VT8233A/C, VT8235
  *
- *     Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
+ *     Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
  *                        Tjeerd.Mulder <Tjeerd.Mulder@fujitsu-siemens.com>
  *                    2002 Takashi Iwai <tiwai@suse.de>
  *
@@ -46,7 +46,6 @@
  *     - Optimize position calculation for the 823x chips. 
  */
 
-#include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
@@ -68,7 +67,7 @@
 #define POINTER_DEBUG
 #endif
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("VIA VT82xx audio");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}");
@@ -86,6 +85,7 @@ static int joystick;
 static int ac97_clock = 48000;
 static char *ac97_quirk;
 static int dxs_support;
+static int nodelay;
 
 module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge.");
@@ -103,6 +103,8 @@ module_param(ac97_quirk, charp, 0444);
 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
 module_param(dxs_support, int, 0444);
 MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");
+module_param(nodelay, int, 0444);
+MODULE_PARM_DESC(nodelay, "Disable 500ms init delay");
 
 /* just for backward compatibility */
 static int enable;
@@ -314,6 +316,7 @@ struct snd_via_sg_table {
 } ;
 
 #define VIA_TABLE_SIZE 255
+#define VIA_MAX_BUFSIZE        (1<<24)
 
 struct viadev {
        unsigned int reg_offset;
@@ -383,6 +386,7 @@ struct via82xx {
 
        struct snd_pcm *pcms[2];
        struct snd_rawmidi *rmidi;
+       struct snd_kcontrol *dxs_controls[4];
 
        struct snd_ac97_bus *ac97_bus;
        struct snd_ac97 *ac97;
@@ -397,11 +401,11 @@ struct via82xx {
 #endif
 };
 
-static struct pci_device_id snd_via82xx_ids[] = {
+static DEFINE_PCI_DEVICE_TABLE(snd_via82xx_ids) = {
        /* 0x1106, 0x3058 */
-       { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, },     /* 686A */
+       { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C686_5), TYPE_CARD_VIA686, },    /* 686A */
        /* 0x1106, 0x3059 */
-       { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA8233, },      /* VT8233 */
+       { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233_5), TYPE_CARD_VIA8233, },     /* VT8233 */
        { 0, }
 };
 
@@ -421,7 +425,6 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
 {
        unsigned int i, idx, ofs, rest;
        struct via82xx *chip = snd_pcm_substream_chip(substream);
-       struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
 
        if (dev->table.area == NULL) {
                /* the start of each lists must be aligned to 8 bytes,
@@ -450,15 +453,15 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
                do {
                        unsigned int r;
                        unsigned int flag;
+                       unsigned int addr;
 
                        if (idx >= VIA_TABLE_SIZE) {
                                snd_printk(KERN_ERR "via82xx: too much table size!\n");
                                return -EINVAL;
                        }
-                       ((u32 *)dev->table.area)[idx << 1] = cpu_to_le32((u32)snd_pcm_sgbuf_get_addr(sgbuf, ofs));
-                       r = PAGE_SIZE - (ofs % PAGE_SIZE);
-                       if (rest < r)
-                               r = rest;
+                       addr = snd_pcm_sgbuf_get_addr(substream, ofs);
+                       ((u32 *)dev->table.area)[idx << 1] = cpu_to_le32(addr);
+                       r = snd_pcm_sgbuf_get_chunk_size(substream, ofs, rest);
                        rest -= r;
                        if (! rest) {
                                if (i == periods - 1)
@@ -467,7 +470,10 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre
                                        flag = VIA_TBL_BIT_FLAG; /* period boundary */
                        } else
                                flag = 0; /* period continues to the next */
-                       // printk("via: tbl %d: at %d  size %d (rest %d)\n", idx, ofs, r, rest);
+                       /*
+                       printk(KERN_DEBUG "via: tbl %d: at %d  size %d "
+                              "(rest %d)\n", idx, ofs, r, rest);
+                       */
                        ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag);
                        dev->idx_table[idx].offset = ofs;
                        dev->idx_table[idx].size = r;
@@ -547,7 +553,8 @@ static void snd_via82xx_codec_wait(struct snd_ac97 *ac97)
        int err;
        err = snd_via82xx_codec_ready(chip, ac97->num);
        /* here we need to wait fairly for long time.. */
-       msleep(500);
+       if (!nodelay)
+               msleep(500);
 }
 
 static void snd_via82xx_codec_write(struct snd_ac97 *ac97,
@@ -825,7 +832,8 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substr
        struct viadev *viadev = substream->runtime->private_data;
        unsigned int idx, ptr, count, res;
 
-       snd_assert(viadev->tbl_entries, return 0);
+       if (snd_BUG_ON(!viadev->tbl_entries))
+               return 0;
        if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE))
                return 0;
 
@@ -856,7 +864,8 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(struct snd_pcm_substream *subst
        unsigned int idx, count, res;
        int status;
        
-       snd_assert(viadev->tbl_entries, return 0);
+       if (snd_BUG_ON(!viadev->tbl_entries))
+               return 0;
 
        spin_lock(&chip->reg_lock);
        count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT));
@@ -1038,7 +1047,7 @@ static int snd_via8233_playback_prepare(struct snd_pcm_substream *substream)
        else
                rbits = (0x100000 / 48000) * runtime->rate +
                        ((0x100000 % 48000) * runtime->rate) / 48000;
-       snd_assert((rbits & ~0xfffff) == 0, return -EINVAL);
+       snd_BUG_ON(rbits & ~0xfffff);
        snd_via82xx_channel_reset(chip, viadev);
        snd_via82xx_set_table_ptr(chip, viadev);
        outb(chip->playback_volume[viadev->reg_offset / 0x10][0],
@@ -1145,9 +1154,9 @@ static struct snd_pcm_hardware snd_via82xx_hw =
        .rate_max =             48000,
        .channels_min =         1,
        .channels_max =         2,
-       .buffer_bytes_max =     128 * 1024,
+       .buffer_bytes_max =     VIA_MAX_BUFSIZE,
        .period_bytes_min =     32,
-       .period_bytes_max =     128 * 1024,
+       .period_bytes_max =     VIA_MAX_BUFSIZE / 2,
        .periods_min =          2,
        .periods_max =          VIA_TABLE_SIZE / 2,
        .fifo_size =            0,
@@ -1208,9 +1217,9 @@ static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev,
 
 
 /*
- * open callback for playback on via686 and via823x DSX
+ * open callback for playback on via686
  */
-static int snd_via82xx_playback_open(struct snd_pcm_substream *substream)
+static int snd_via686_playback_open(struct snd_pcm_substream *substream)
 {
        struct via82xx *chip = snd_pcm_substream_chip(substream);
        struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number];
@@ -1222,6 +1231,32 @@ static int snd_via82xx_playback_open(struct snd_pcm_substream *substream)
 }
 
 /*
+ * open callback for playback on via823x DXS
+ */
+static int snd_via8233_playback_open(struct snd_pcm_substream *substream)
+{
+       struct via82xx *chip = snd_pcm_substream_chip(substream);
+       struct viadev *viadev;
+       unsigned int stream;
+       int err;
+
+       viadev = &chip->devs[chip->playback_devno + substream->number];
+       if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0)
+               return err;
+       stream = viadev->reg_offset / 0x10;
+       if (chip->dxs_controls[stream]) {
+               chip->playback_volume[stream][0] = 0;
+               chip->playback_volume[stream][1] = 0;
+               chip->dxs_controls[stream]->vd[0].access &=
+                       ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+               snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
+                              SNDRV_CTL_EVENT_MASK_INFO,
+                              &chip->dxs_controls[stream]->id);
+       }
+       return 0;
+}
+
+/*
  * open callback for playback on via823x multi-channel
  */
 static int snd_via8233_multi_open(struct snd_pcm_substream *substream)
@@ -1294,10 +1329,26 @@ static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
+static int snd_via8233_playback_close(struct snd_pcm_substream *substream)
+{
+       struct via82xx *chip = snd_pcm_substream_chip(substream);
+       struct viadev *viadev = substream->runtime->private_data;
+       unsigned int stream;
+
+       stream = viadev->reg_offset / 0x10;
+       if (chip->dxs_controls[stream]) {
+               chip->dxs_controls[stream]->vd[0].access |=
+                       SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+               snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO,
+                              &chip->dxs_controls[stream]->id);
+       }
+       return snd_via82xx_pcm_close(substream);
+}
+
 
 /* via686 playback callbacks */
 static struct snd_pcm_ops snd_via686_playback_ops = {
-       .open =         snd_via82xx_playback_open,
+       .open =         snd_via686_playback_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_via82xx_hw_params,
@@ -1323,8 +1374,8 @@ static struct snd_pcm_ops snd_via686_capture_ops = {
 
 /* via823x DSX playback callbacks */
 static struct snd_pcm_ops snd_via8233_playback_ops = {
-       .open =         snd_via82xx_playback_open,
-       .close =        snd_via82xx_pcm_close,
+       .open =         snd_via8233_playback_open,
+       .close =        snd_via8233_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_via82xx_hw_params,
        .hw_free =      snd_via82xx_hw_free,
@@ -1399,10 +1450,9 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip)
        /* capture */
        init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1);
 
-       if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-                                                        snd_dma_pci_data(chip->pci),
-                                                        64*1024, 128*1024)) < 0)
-               return err;
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+                                             snd_dma_pci_data(chip->pci),
+                                             64*1024, VIA_MAX_BUFSIZE);
 
        /* PCM #1:  multi-channel playback and 2nd capture */
        err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm);
@@ -1418,11 +1468,9 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip)
        /* set up capture */
        init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 7, 1);
 
-       if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-                                                        snd_dma_pci_data(chip->pci),
-                                                        64*1024, 128*1024)) < 0)
-               return err;
-
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+                                             snd_dma_pci_data(chip->pci),
+                                             64*1024, VIA_MAX_BUFSIZE);
        return 0;
 }
 
@@ -1454,10 +1502,9 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip)
        /* capture */
        init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1);
 
-       if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-                                                        snd_dma_pci_data(chip->pci),
-                                                        64*1024, 128*1024)) < 0)
-               return err;
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+                                             snd_dma_pci_data(chip->pci),
+                                             64*1024, VIA_MAX_BUFSIZE);
 
        /* SPDIF supported? */
        if (! ac97_can_spdif(chip->ac97))
@@ -1474,11 +1521,9 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip)
        /* set up playback */
        init_viadev(chip, chip->playback_devno, 0x30, 3, 0);
 
-       if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-                                                        snd_dma_pci_data(chip->pci),
-                                                        64*1024, 128*1024)) < 0)
-               return err;
-
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+                                             snd_dma_pci_data(chip->pci),
+                                             64*1024, VIA_MAX_BUFSIZE);
        return 0;
 }
 
@@ -1506,11 +1551,9 @@ static int __devinit snd_via686_pcm_new(struct via82xx *chip)
        init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0, 0);
        init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1);
 
-       if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-                                                        snd_dma_pci_data(chip->pci),
-                                                        64*1024, 128*1024)) < 0)
-               return err;
-
+       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
+                                             snd_dma_pci_data(chip->pci),
+                                             64*1024, VIA_MAX_BUFSIZE);
        return 0;
 }
 
@@ -1626,7 +1669,7 @@ static int snd_via8233_dxs_volume_get(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
 {
        struct via82xx *chip = snd_kcontrol_chip(kcontrol);
-       unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id);
+       unsigned int idx = kcontrol->id.subdevice;
 
        ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0];
        ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1];
@@ -1646,7 +1689,7 @@ static int snd_via8233_dxs_volume_put(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_value *ucontrol)
 {
        struct via82xx *chip = snd_kcontrol_chip(kcontrol);
-       unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id);
+       unsigned int idx = kcontrol->id.subdevice;
        unsigned long port = chip->port + 0x10 * idx;
        unsigned char val;
        int i, change = 0;
@@ -1691,7 +1734,7 @@ static int snd_via8233_pcmdxs_volume_put(struct snd_kcontrol *kcontrol,
        return change;
 }
 
-static const DECLARE_TLV_DB_SCALE(db_scale_dxs, -9450, 150, 1);
+static const DECLARE_TLV_DB_SCALE(db_scale_dxs, -4650, 150, 1);
 
 static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = {
        .name = "PCM Playback Volume",
@@ -1705,11 +1748,13 @@ static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata =
 };
 
 static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = {
-       .name = "VIA DXS Playback Volume",
-       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-       .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
-                  SNDRV_CTL_ELEM_ACCESS_TLV_READ),
-       .count = 4,
+       .iface = SNDRV_CTL_ELEM_IFACE_PCM,
+       .device = 0,
+       /* .subdevice set later */
+       .name = "PCM Playback Volume",
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+                 SNDRV_CTL_ELEM_ACCESS_INACTIVE,
        .info = snd_via8233_dxs_volume_info,
        .get = snd_via8233_dxs_volume_get,
        .put = snd_via8233_dxs_volume_put,
@@ -1746,6 +1791,12 @@ static struct ac97_quirk ac97_quirks[] = {
                .type = AC97_TUNE_HP_ONLY
        },
        {
+               .subvendor = 0x110a,
+               .subdevice = 0x0079,
+               .name = "Fujitsu Siemens D1289",
+               .type = AC97_TUNE_HP_ONLY
+       },
+       {
                .subvendor = 0x1019,
                .subdevice = 0x0a81,
                .name = "ECS K7VTA3",
@@ -1758,6 +1809,12 @@ static struct ac97_quirk ac97_quirks[] = {
                .type = AC97_TUNE_HP_ONLY
        },
        {
+               .subvendor = 0x1019,
+               .subdevice = 0x1841,
+               .name = "ECS K7VTA3",
+               .type = AC97_TUNE_HP_ONLY
+       },
+       {
                .subvendor = 0x1849,
                .subdevice = 0x3059,
                .name = "ASRock K7VM2",
@@ -1793,6 +1850,12 @@ static struct ac97_quirk ac97_quirks[] = {
                .name = "m680x",
                .type = AC97_TUNE_HP_ONLY, /* http://launchpad.net/bugs/38546 */
        },
+       {
+               .subvendor = 0x1297,
+               .subdevice = 0xa232,
+               .name = "Shuttle AK32VN",
+               .type = AC97_TUNE_HP_ONLY
+       },
        { } /* terminator */
 };
 
@@ -1924,10 +1987,19 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip)
                }
                else /* Using DXS when PCM emulation is enabled is really weird */
                {
-                       /* Standalone DXS controls */
-                       err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip));
-                       if (err < 0)
-                               return err;
+                       for (i = 0; i < 4; ++i) {
+                               struct snd_kcontrol *kctl;
+
+                               kctl = snd_ctl_new1(
+                                       &snd_via8233_dxs_volume_control, chip);
+                               if (!kctl)
+                                       return -ENOMEM;
+                               kctl->id.subdevice = i;
+                               err = snd_ctl_add(chip->card, kctl);
+                               if (err < 0)
+                                       return err;
+                               chip->dxs_controls[i] = kctl;
+                       }
                }
        }
        /* select spdif data slot 10/11 */
@@ -2090,7 +2162,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
                pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval);
                if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */
                        break;
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
 
        if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)
@@ -2109,7 +2181,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
                        chip->ac97_secondary = 1;
                        goto __ac97_ok2;
                }
-               schedule_timeout(1);
+               schedule_timeout_uninterruptible(1);
        } while (time_before(jiffies, end_time));
        /* This is ok, the most of motherboards have only one codec */
 
@@ -2231,10 +2303,10 @@ static int snd_via82xx_free(struct via82xx *chip)
        /* disable interrupts */
        for (i = 0; i < chip->num_devs; i++)
                snd_via82xx_channel_reset(chip, &chip->devs[i]);
-       synchronize_irq(chip->irq);
-      __end_hw:
+
        if (chip->irq >= 0)
                free_irq(chip->irq, chip);
+ __end_hw:
        release_and_free_resource(chip->mpu_res);
        pci_release_regions(chip->pci);
 
@@ -2355,21 +2427,22 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = {
        SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K),
        SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA),
        SND_PCI_QUIRK(0x1019, 0x0a85, "ECS L7VMM2", VIA_DXS_NO_VRA),
-       SND_PCI_QUIRK(0x1019, 0, "ESC K8", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x1019, "ESC K8", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x1019, 0xaa01, "ESC K8T890-A", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x1025, 0x0033, "Acer Inspire 1353LM", VIA_DXS_NO_VRA),
        SND_PCI_QUIRK(0x1025, 0x0046, "Acer Aspire 1524 WLMi", VIA_DXS_SRC),
-       SND_PCI_QUIRK(0x1043, 0, "ASUS A7/A8", VIA_DXS_NO_VRA),
-       SND_PCI_QUIRK(0x1071, 0, "Diverse Notebook", VIA_DXS_NO_VRA),
+       SND_PCI_QUIRK_VENDOR(0x1043, "ASUS A7/A8", VIA_DXS_NO_VRA),
+       SND_PCI_QUIRK_VENDOR(0x1071, "Diverse Notebook", VIA_DXS_NO_VRA),
        SND_PCI_QUIRK(0x10cf, 0x118e, "FSC Laptop", VIA_DXS_ENABLE),
-       SND_PCI_QUIRK(0x1106, 0, "ASRock", VIA_DXS_SRC),
-       SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_ENABLE),
-       SND_PCI_QUIRK(0x1297, 0xc160, "Shuttle Sk41G", VIA_DXS_ENABLE),
+       SND_PCI_QUIRK_VENDOR(0x1106, "ASRock", VIA_DXS_SRC),
+       SND_PCI_QUIRK(0x1297, 0xa231, "Shuttle AK31v2", VIA_DXS_SRC),
+       SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_SRC),
+       SND_PCI_QUIRK(0x1297, 0xc160, "Shuttle Sk41G", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte GA-7VAXP", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x1462, 0x3800, "MSI KT266", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x1462, 0x7120, "MSI KT4V", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x1462, 0x7142, "MSI K8MM-V", VIA_DXS_ENABLE),
-       SND_PCI_QUIRK(0x1462, 0, "MSI Mobo", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x1462, "MSI Mobo", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x147b, 0x1401, "ABIT KD7(-RAID)", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x147b, 0x1411, "ABIT VA-20", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x147b, 0x1413, "ABIT KV8 Pro", VIA_DXS_ENABLE),
@@ -2383,11 +2456,11 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = {
        SND_PCI_QUIRK(0x161f, 0x2032, "m680x machines", VIA_DXS_48K),
        SND_PCI_QUIRK(0x1631, 0xe004, "PB EasyNote 3174", VIA_DXS_ENABLE),
        SND_PCI_QUIRK(0x1695, 0x3005, "EPoX EP-8K9A", VIA_DXS_ENABLE),
-       SND_PCI_QUIRK(0x1695, 0, "EPoX mobo", VIA_DXS_SRC),
-       SND_PCI_QUIRK(0x16f3, 0, "Jetway K8", VIA_DXS_SRC),
-       SND_PCI_QUIRK(0x1734, 0, "FSC Laptop", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x1695, "EPoX mobo", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x16f3, "Jetway K8", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x1734, "FSC Laptop", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x1849, 0x3059, "ASRock K7VM2", VIA_DXS_NO_VRA),
-       SND_PCI_QUIRK(0x1849, 0, "ASRock mobo", VIA_DXS_SRC),
+       SND_PCI_QUIRK_VENDOR(0x1849, "ASRock mobo", VIA_DXS_SRC),
        SND_PCI_QUIRK(0x1919, 0x200a, "Soltek SL-K8",  VIA_DXS_NO_VRA),
        SND_PCI_QUIRK(0x4005, 0x4710, "MSI K7T266", VIA_DXS_SRC),
        { } /* terminator */
@@ -2427,9 +2500,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
        unsigned int i;
        int err;
 
-       card = snd_card_new(index, id, THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index, id, THIS_MODULE, 0, &card);
+       if (err < 0)
+               return err;
 
        card_type = pci_id->driver_data;
        switch (card_type) {