]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/hda/hda_intel.c
Merge /spare/repo/linux-2.6/
[linux-2.6-omap-h63xx.git] / sound / pci / hda / hda_intel.c
index cbc9ca73c2abde64d1a52524d32893ef08c18c52..15107df1f490808ebc52dfc5e1a977ee7dc83d08 100644 (file)
@@ -51,6 +51,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 static char *model[SNDRV_CARDS];
+static int position_fix[SNDRV_CARDS];
 
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel HD audio interface.");
@@ -60,12 +61,19 @@ module_param_array(enable, bool, NULL, 0444);
 MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
 module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
+module_param_array(position_fix, int, NULL, 0444);
+MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF).");
 
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
                         "{Intel, ICH6M},"
                         "{Intel, ICH7},"
-                        "{Intel, ESB2}}");
+                        "{Intel, ESB2},"
+                        "{ATI, SB450},"
+                        "{VIA, VT8251},"
+                        "{VIA, VT8237A},"
+                        "{SiS, SIS966},"
+                        "{ULI, M5461}}");
 MODULE_DESCRIPTION("Intel HDA driver");
 
 #define SFX    "hda-intel: "
@@ -135,9 +143,24 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
  */
 
 /* max number of SDs */
-#define MAX_ICH6_DEV           8
+/* ICH, ATI and VIA have 4 playback and 4 capture */
+#define ICH6_CAPTURE_INDEX     0
+#define ICH6_NUM_CAPTURE       4
+#define ICH6_PLAYBACK_INDEX    4
+#define ICH6_NUM_PLAYBACK      4
+
+/* ULI has 6 playback and 5 capture */
+#define ULI_CAPTURE_INDEX      0
+#define ULI_NUM_CAPTURE                5
+#define ULI_PLAYBACK_INDEX     5
+#define ULI_NUM_PLAYBACK       6
+
+/* this number is statically defined for simplicity */
+#define MAX_AZX_DEV            16
+
 /* max number of fragments - we may use more if allocating more pages for BDL */
-#define AZX_MAX_FRAG           (PAGE_SIZE / (MAX_ICH6_DEV * 16))
+#define BDL_SIZE               PAGE_ALIGN(8192)
+#define AZX_MAX_FRAG           (BDL_SIZE / (MAX_AZX_DEV * 16))
 /* max buffer size - no h/w limit, you can increase as you like */
 #define AZX_MAX_BUF_SIZE       (1024*1024*1024)
 /* max number of PCM devics per card */
@@ -150,7 +173,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 
 /* STATESTS int mask: SD2,SD1,SD0 */
 #define STATESTS_INT_MASK      0x07
-#define AZX_MAX_CODECS         3
+#define AZX_MAX_CODECS         4
 
 /* SD_CTL bits */
 #define SD_CTL_STREAM_RESET    0x01    /* stream reset bit */
@@ -172,6 +195,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define ICH6_INT_CTRL_EN       0x40000000      /* controller interrupt enable bit */
 #define ICH6_INT_GLOBAL_EN     0x80000000      /* global interrupt enable bit */
 
+/* GCTL unsolicited response enable bit */
+#define ICH6_GCTL_UREN         (1<<8)
+
 /* GCTL reset bit */
 #define ICH6_GCTL_RESET                (1<<0)
 
@@ -183,6 +209,17 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define ICH6_MAX_CORB_ENTRIES  256
 #define ICH6_MAX_RIRB_ENTRIES  256
 
+/* position fix mode */
+enum {
+       POS_FIX_FIFO,
+       POS_FIX_NONE,
+       POS_FIX_POSBUF
+};
+
+/* Defines for ATI HD Audio support in SB450 south bridge */
+#define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR   0x42
+#define ATI_SB450_HDAUDIO_ENABLE_SNOOP      0x02
+
 
 /*
  * Use CORB/RIRB for communication from/to codecs.
@@ -190,12 +227,6 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
  */
 #define USE_CORB_RIRB
 
-/*
- * Define this if use the position buffer instead of reading SD_LPIB
- * It's not used as default since SD_LPIB seems to give more accurate position
- */
-/* #define USE_POSBUF */
-
 /*
  */
 
@@ -243,6 +274,14 @@ struct snd_azx {
        snd_card_t *card;
        struct pci_dev *pci;
 
+       /* chip type specific */
+       int driver_type;
+       int playback_streams;
+       int playback_index_offset;
+       int capture_streams;
+       int capture_index_offset;
+       int num_streams;
+
        /* pci resources */
        unsigned long addr;
        void __iomem *remap_addr;
@@ -252,8 +291,8 @@ struct snd_azx {
        spinlock_t reg_lock;
        struct semaphore open_mutex;
 
-       /* streams */
-       azx_dev_t azx_dev[MAX_ICH6_DEV];
+       /* streams (x num_streams) */
+       azx_dev_t *azx_dev;
 
        /* PCM */
        unsigned int pcm_devs;
@@ -271,6 +310,27 @@ struct snd_azx {
        struct snd_dma_buffer bdl;
        struct snd_dma_buffer rb;
        struct snd_dma_buffer posbuf;
+
+       /* flags */
+       int position_fix;
+       unsigned int initialized: 1;
+};
+
+/* driver types */
+enum {
+       AZX_DRIVER_ICH,
+       AZX_DRIVER_ATI,
+       AZX_DRIVER_VIA,
+       AZX_DRIVER_SIS,
+       AZX_DRIVER_ULI,
+};
+
+static char *driver_short_names[] __devinitdata = {
+       [AZX_DRIVER_ICH] = "HDA Intel",
+       [AZX_DRIVER_ATI] = "HDA ATI SB",
+       [AZX_DRIVER_VIA] = "HDA VIA VT82xx",
+       [AZX_DRIVER_SIS] = "HDA SIS966",
+       [AZX_DRIVER_ULI] = "HDA ULI M5461"
 };
 
 /*
@@ -341,6 +401,8 @@ static void azx_init_cmd_io(azx_t *chip)
        azx_writel(chip, CORBLBASE, (u32)chip->corb.addr);
        azx_writel(chip, CORBUBASE, upper_32bit(chip->corb.addr));
 
+       /* set the corb size to 256 entries (ULI requires explicitly) */
+       azx_writeb(chip, CORBSIZE, 0x02);
        /* set the corb write pointer to 0 */
        azx_writew(chip, CORBWP, 0);
        /* reset the corb hw read pointer */
@@ -354,6 +416,8 @@ static void azx_init_cmd_io(azx_t *chip)
        azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr);
        azx_writel(chip, RIRBUBASE, upper_32bit(chip->rirb.addr));
 
+       /* set the rirb size to 256 entries (ULI requires explicitly) */
+       azx_writeb(chip, RIRBSIZE, 0x02);
        /* reset the rirb hw write pointer */
        azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR);
        /* set N=1, get RIRB response interrupt for new entry */
@@ -546,6 +610,9 @@ static int azx_reset(azx_t *chip)
                return -EBUSY;
        }
 
+       /* Accept unsolicited responses */
+       azx_writel(chip, GCTL, azx_readl(chip, GCTL) | ICH6_GCTL_UREN);
+
        /* detect codecs */
        if (! chip->codec_mask) {
                chip->codec_mask = azx_readw(chip, STATESTS);
@@ -574,7 +641,7 @@ static void azx_int_disable(azx_t *chip)
        int i;
 
        /* disable interrupts in stream descriptor */
-       for (i = 0; i < MAX_ICH6_DEV; i++) {
+       for (i = 0; i < chip->num_streams; i++) {
                azx_dev_t *azx_dev = &chip->azx_dev[i];
                azx_sd_writeb(azx_dev, SD_CTL,
                              azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK);
@@ -594,7 +661,7 @@ static void azx_int_clear(azx_t *chip)
        int i;
 
        /* clear stream status */
-       for (i = 0; i < MAX_ICH6_DEV; i++) {
+       for (i = 0; i < chip->num_streams; i++) {
                azx_dev_t *azx_dev = &chip->azx_dev[i];
                azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
        }
@@ -638,7 +705,7 @@ static void azx_stream_stop(azx_t *chip, azx_dev_t *azx_dev)
  */
 static void azx_init_chip(azx_t *chip)
 {
-       unsigned char tcsel_reg;
+       unsigned char tcsel_reg, ati_misc_cntl2;
 
        /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
         * TCSEL == Traffic Class Select Register, which sets PCI express QOS
@@ -657,11 +724,19 @@ static void azx_init_chip(azx_t *chip)
        /* initialize the codec command I/O */
        azx_init_cmd_io(chip);
 
-#ifdef USE_POSBUF
-       /* program the position buffer */
-       azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
-       azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
-#endif
+       if (chip->position_fix == POS_FIX_POSBUF) {
+               /* program the position buffer */
+               azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
+               azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
+       }
+
+       /* For ATI SB450 azalia HD audio, we need to enable snoop */
+       if (chip->driver_type == AZX_DRIVER_ATI) {
+               pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 
+                                    &ati_misc_cntl2);
+               pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 
+                                     (ati_misc_cntl2 & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP);
+       }
 }
 
 
@@ -683,7 +758,7 @@ static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs)
                return IRQ_NONE;
        }
        
-       for (i = 0; i < MAX_ICH6_DEV; i++) {
+       for (i = 0; i < chip->num_streams; i++) {
                azx_dev = &chip->azx_dev[i];
                if (status & azx_dev->sd_int_sta_mask) {
                        azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
@@ -791,11 +866,12 @@ static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev)
        /* upper BDL address */
        azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr));
 
-#ifdef USE_POSBUF
-       /* enable the position buffer */
-       if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
-               azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
-#endif
+       if (chip->position_fix == POS_FIX_POSBUF) {
+               /* enable the position buffer */
+               if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
+                       azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
+       }
+
        /* set the interrupt enable bits in the descriptor control register */
        azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK);
 
@@ -847,9 +923,15 @@ static int __devinit azx_codec_create(azx_t *chip, const char *model)
 /* assign a stream for the PCM */
 static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream)
 {
-       int dev, i;
-       dev = stream == SNDRV_PCM_STREAM_PLAYBACK ? 4 : 0;
-       for (i = 0; i < 4; i++, dev++)
+       int dev, i, nums;
+       if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+               dev = chip->playback_index_offset;
+               nums = chip->playback_streams;
+       } else {
+               dev = chip->capture_index_offset;
+               nums = chip->capture_streams;
+       }
+       for (i = 0; i < nums; i++, dev++)
                if (! chip->azx_dev[dev].opened) {
                        chip->azx_dev[dev].opened = 1;
                        return &chip->azx_dev[dev];
@@ -867,8 +949,8 @@ static snd_pcm_hardware_t azx_pcm_hw = {
        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
                                 SNDRV_PCM_INFO_MMAP_VALID |
-                                SNDRV_PCM_INFO_PAUSE |
-                                SNDRV_PCM_INFO_RESUME),
+                                SNDRV_PCM_INFO_PAUSE /*|*/
+                                /*SNDRV_PCM_INFO_RESUME*/),
        .formats =              SNDRV_PCM_FMTBIT_S16_LE,
        .rates =                SNDRV_PCM_RATE_48000,
        .rate_min =             48000,
@@ -1017,6 +1099,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
                azx_dev->running = 1;
                break;
        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+       case SNDRV_PCM_TRIGGER_SUSPEND:
        case SNDRV_PCM_TRIGGER_STOP:
                azx_stream_stop(chip, azx_dev);
                azx_dev->running = 0;
@@ -1026,6 +1109,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
        }
        spin_unlock(&chip->reg_lock);
        if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH ||
+           cmd == SNDRV_PCM_TRIGGER_SUSPEND ||
            cmd == SNDRV_PCM_TRIGGER_STOP) {
                int timeout = 5000;
                while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout)
@@ -1036,16 +1120,20 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
 
 static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
 {
+       struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
+       azx_t *chip = apcm->chip;
        azx_dev_t *azx_dev = get_azx_dev(substream);
        unsigned int pos;
 
-#ifdef USE_POSBUF
-       /* use the position buffer */
-       pos = *azx_dev->posbuf;
-#else
-       /* read LPIB */
-       pos = azx_sd_readl(azx_dev, SD_LPIB) + azx_dev->fifo_size;
-#endif
+       if (chip->position_fix == POS_FIX_POSBUF) {
+               /* use the position buffer */
+               pos = *azx_dev->posbuf;
+       } else {
+               /* read LPIB */
+               pos = azx_sd_readl(azx_dev, SD_LPIB);
+               if (chip->position_fix == POS_FIX_FIFO)
+                       pos += azx_dev->fifo_size;
+       }
        if (pos >= azx_dev->bufsize)
                pos = 0;
        return bytes_to_frames(substream->runtime, pos);
@@ -1100,6 +1188,7 @@ static int __devinit create_codec_pcm(azx_t *chip, struct hda_codec *codec,
                                              snd_dma_pci_data(chip->pci),
                                              1024 * 64, 1024 * 128);
        chip->pcm[pcm_dev] = pcm;
+       chip->pcm_devs = pcm_dev + 1;
 
        return 0;
 }
@@ -1150,14 +1239,13 @@ static int __devinit azx_init_stream(azx_t *chip)
        /* initialize each stream (aka device)
         * assign the starting bdl address to each stream (device) and initialize
         */
-       for (i = 0; i < MAX_ICH6_DEV; i++) {
+       for (i = 0; i < chip->num_streams; i++) {
                unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4);
                azx_dev_t *azx_dev = &chip->azx_dev[i];
                azx_dev->bdl = (u32 *)(chip->bdl.area + off);
                azx_dev->bdl_addr = chip->bdl.addr + off;
-#ifdef USE_POSBUF
-               azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
-#endif
+               if (chip->position_fix == POS_FIX_POSBUF)
+                       azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
                /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
                azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80);
                /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */
@@ -1207,10 +1295,10 @@ static int azx_resume(snd_card_t *card)
  */
 static int azx_free(azx_t *chip)
 {
-       if (chip->remap_addr) {
+       if (chip->initialized) {
                int i;
 
-               for (i = 0; i < MAX_ICH6_DEV; i++)
+               for (i = 0; i < chip->num_streams; i++)
                        azx_stream_stop(chip, &chip->azx_dev[i]);
 
                /* disable interrupts */
@@ -1226,10 +1314,10 @@ static int azx_free(azx_t *chip)
 
                /* wait a little for interrupts to finish */
                msleep(1);
-
-               iounmap(chip->remap_addr);
        }
 
+       if (chip->remap_addr)
+               iounmap(chip->remap_addr);
        if (chip->irq >= 0)
                free_irq(chip->irq, (void*)chip);
 
@@ -1237,12 +1325,11 @@ static int azx_free(azx_t *chip)
                snd_dma_free_pages(&chip->bdl);
        if (chip->rb.area)
                snd_dma_free_pages(&chip->rb);
-#ifdef USE_POSBUF
        if (chip->posbuf.area)
                snd_dma_free_pages(&chip->posbuf);
-#endif
        pci_release_regions(chip->pci);
        pci_disable_device(chip->pci);
+       kfree(chip->azx_dev);
        kfree(chip);
 
        return 0;
@@ -1256,7 +1343,9 @@ static int azx_dev_free(snd_device_t *device)
 /*
  * constructor
  */
-static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, azx_t **rchip)
+static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
+                               int posfix, int driver_type,
+                               azx_t **rchip)
 {
        azx_t *chip;
        int err = 0;
@@ -1282,6 +1371,19 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, azx_t **r
        chip->card = card;
        chip->pci = pci;
        chip->irq = -1;
+       chip->driver_type = driver_type;
+
+       chip->position_fix = posfix;
+
+#if BITS_PER_LONG != 64
+       /* Fix up base address on ULI M5461 */
+       if (chip->driver_type == AZX_DRIVER_ULI) {
+               u16 tmp3;
+               pci_read_config_word(pci, 0x40, &tmp3);
+               pci_write_config_word(pci, 0x40, tmp3 | 0x10);
+               pci_write_config_dword(pci, PCI_BASE_ADDRESS_1, 0);
+       }
+#endif
 
        if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) {
                kfree(chip);
@@ -1308,20 +1410,41 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, azx_t **r
        pci_set_master(pci);
        synchronize_irq(chip->irq);
 
+       switch (chip->driver_type) {
+       case AZX_DRIVER_ULI:
+               chip->playback_streams = ULI_NUM_PLAYBACK;
+               chip->capture_streams = ULI_NUM_CAPTURE;
+               chip->playback_index_offset = ULI_PLAYBACK_INDEX;
+               chip->capture_index_offset = ULI_CAPTURE_INDEX;
+               break;
+       default:
+               chip->playback_streams = ICH6_NUM_PLAYBACK;
+               chip->capture_streams = ICH6_NUM_CAPTURE;
+               chip->playback_index_offset = ICH6_PLAYBACK_INDEX;
+               chip->capture_index_offset = ICH6_CAPTURE_INDEX;
+               break;
+       }
+       chip->num_streams = chip->playback_streams + chip->capture_streams;
+       chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), GFP_KERNEL);
+       if (! chip->azx_dev) {
+               snd_printk(KERN_ERR "cannot malloc azx_dev\n");
+               goto errout;
+       }
+
        /* allocate memory for the BDL for each stream */
        if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
-                                      PAGE_SIZE, &chip->bdl)) < 0) {
+                                      BDL_SIZE, &chip->bdl)) < 0) {
                snd_printk(KERN_ERR SFX "cannot allocate BDL\n");
                goto errout;
        }
-#ifdef USE_POSBUF
-       /* allocate memory for the position buffer */
-       if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
-                                      MAX_ICH6_DEV * 8, &chip->posbuf)) < 0) {
-               snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
-               goto errout;
+       if (chip->position_fix == POS_FIX_POSBUF) {
+               /* allocate memory for the position buffer */
+               if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
+                                              chip->num_streams * 8, &chip->posbuf)) < 0) {
+                       snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
+                       goto errout;
+               }
        }
-#endif
        /* allocate CORB/RIRB */
        if ((err = azx_alloc_cmd_io(chip)) < 0)
                goto errout;
@@ -1332,6 +1455,8 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, azx_t **r
        /* initialize chip */
        azx_init_chip(chip);
 
+       chip->initialized = 1;
+
        /* codec detection */
        if (! chip->codec_mask) {
                snd_printk(KERN_ERR SFX "no codecs found!\n");
@@ -1344,6 +1469,10 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, azx_t **r
                goto errout;
        }
 
+       strcpy(card->driver, "HDA-Intel");
+       strcpy(card->shortname, driver_short_names[chip->driver_type]);
+       sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq);
+
        *rchip = chip;
        return 0;
 
@@ -1372,15 +1501,12 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *
                return -ENOMEM;
        }
 
-       if ((err = azx_create(card, pci, &chip)) < 0) {
+       if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data,
+                             &chip)) < 0) {
                snd_card_free(card);
                return err;
        }
 
-       strcpy(card->driver, "HDA-Intel");
-       strcpy(card->shortname, "HDA Intel");
-       sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq);
-
        /* create codec instances */
        if ((err = azx_codec_create(chip, model[dev])) < 0) {
                snd_card_free(card);
@@ -1421,9 +1547,13 @@ static void __devexit azx_remove(struct pci_dev *pci)
 
 /* PCI IDs */
 static struct pci_device_id azx_ids[] = {
-       { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH6 */
-       { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH7 */
-       { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ESB2 */
+       { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */
+       { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */
+       { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */
+       { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */
+       { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */
+       { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */
+       { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, azx_ids);