Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / sound / pci / intel8x0m.c
index 67da096..720635f 100644 (file)
@@ -3,7 +3,7 @@
  *
  *     Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
  *
- *   This is modified (by Sasha Khapyorsky <sashak@smlink.com>) version
+ *   This is modified (by Sasha Khapyorsky <sashak@alsa-project.org>) version
  *   of ALSA ICH sound driver intel8x0.c .
  *
  *
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
 #include <sound/info.h>
-#include <sound/control.h>
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
-MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7013; NVidia MCP/2/2S/3 modems");
+MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; "
+                  "SiS 7013; NVidia MCP/2/2S/3 modems");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
                "{Intel,82901AB-ICH0},"
@@ -57,68 +57,24 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
                "{NVidia,NForce3 Modem},"
                "{AMD,AMD768}}");
 
-static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int index = -2; /* Exclude the first card */
+static char *id = SNDRV_DEFAULT_STR1;  /* ID for this card */
+static int ac97_clock = 0;
 
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
 MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 
+/* just for backward compatibility */
+static int enable;
+module_param(enable, bool, 0444);
+
 /*
  *  Direct registers
  */
-
-#ifndef PCI_DEVICE_ID_INTEL_82801_6
-#define PCI_DEVICE_ID_INTEL_82801_6     0x2416
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82901_6
-#define PCI_DEVICE_ID_INTEL_82901_6     0x2426
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82801BA_6
-#define PCI_DEVICE_ID_INTEL_82801BA_6   0x2446
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_440MX_6
-#define PCI_DEVICE_ID_INTEL_440MX_6     0x7196
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH3_6
-#define PCI_DEVICE_ID_INTEL_ICH3_6     0x2486
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH4_6
-#define PCI_DEVICE_ID_INTEL_ICH4_6     0x24c6
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH5_6
-#define PCI_DEVICE_ID_INTEL_ICH5_6     0x24d6
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH6_6
-#define PCI_DEVICE_ID_INTEL_ICH6_6     0x266d
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH7_6
-#define PCI_DEVICE_ID_INTEL_ICH7_6     0x27dd
-#endif
-#ifndef PCI_DEVICE_ID_SI_7013
-#define PCI_DEVICE_ID_SI_7013          0x7013
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP_MODEM 0x01c1
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM        0x0069
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM        0x00d9
-#endif
-
-
 enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
 
 #define ICHREG(x) ICH_REG_##x
@@ -208,14 +164,14 @@ DEFINE_REGSET(OFF, 0);            /* offset */
 enum { ICHD_MDMIN, ICHD_MDMOUT, ICHD_MDMLAST = ICHD_MDMOUT };
 enum { ALID_MDMIN, ALID_MDMOUT, ALID_MDMLAST = ALID_MDMOUT };
 
-#define get_ichdev(substream) (ichdev_t *)(substream->runtime->private_data)
+#define get_ichdev(substream) (substream->runtime->private_data)
 
-typedef struct {
+struct ichdev {
        unsigned int ichd;                      /* ich device number */
        unsigned long reg_offset;               /* offset to bmaddr */
        u32 *bdbar;                             /* CPU address (32bit) */
        unsigned int bdbar_addr;                /* PCI bus address (32bit) */
-       snd_pcm_substream_t *substream;
+       struct snd_pcm_substream *substream;
        unsigned int physbuf;                   /* physical address (32bit) */
         unsigned int size;
         unsigned int fragsize;
@@ -232,12 +188,10 @@ typedef struct {
        unsigned int roff_picb;
        unsigned int int_sta_mask;              /* interrupt status mask */
        unsigned int ali_slot;                  /* ALI DMA slot */
-       ac97_t *ac97;
-} ichdev_t;
-
-typedef struct _snd_intel8x0m intel8x0_t;
+       struct snd_ac97 *ac97;
+};
 
-struct _snd_intel8x0m {
+struct intel8x0m {
        unsigned int device_type;
 
        int irq;
@@ -250,16 +204,16 @@ struct _snd_intel8x0m {
        void __iomem *remap_bmaddr;
 
        struct pci_dev *pci;
-       snd_card_t *card;
+       struct snd_card *card;
 
        int pcm_devs;
-       snd_pcm_t *pcm[2];
-       ichdev_t ichd[2];
+       struct snd_pcm *pcm[2];
+       struct ichdev ichd[2];
 
        unsigned int in_ac97_init: 1;
 
-       ac97_bus_t *ac97_bus;
-       ac97_t *ac97;
+       struct snd_ac97_bus *ac97_bus;
+       struct snd_ac97 *ac97;
 
        spinlock_t reg_lock;
        
@@ -270,7 +224,7 @@ struct _snd_intel8x0m {
        unsigned int pcm_pos_shift;
 };
 
-static struct pci_device_id snd_intel8x0m_ids[] = {
+static struct pci_device_id snd_intel8x0m_ids[] __devinitdata = {
        { 0x8086, 0x2416, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */
        { 0x8086, 0x2426, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */
        { 0x8086, 0x2446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */
@@ -292,65 +246,14 @@ static struct pci_device_id snd_intel8x0m_ids[] = {
 #endif
        { 0, }
 };
-static int snd_intel8x0m_switch_default_get(snd_kcontrol_t *kcontrol,
-                                           snd_ctl_elem_value_t *ucontrol);
-static int snd_intel8x0m_switch_default_put(snd_kcontrol_t *kcontrol,
-                                           snd_ctl_elem_value_t *ucontrol);
-static int snd_intel8x0m_switch_default_info(snd_kcontrol_t *kcontrol,
-                                            snd_ctl_elem_info_t *uinfo);
-
-#define PRIVATE_VALUE_INITIALIZER(r,m) (((r) & 0xffff) << 16 | ((m) & 0xffff))
-#define PRIVATE_VALUE_MASK(control) ((control)->private_value & 0xffff)
-#define PRIVATE_VALUE_REG(control) (((control)->private_value >> 16) & 0xffff)
-
-static snd_kcontrol_new_t snd_intel8x0m_mixer_switches[] __devinitdata = {
-  { .name  = "Off-hook Switch",
-    .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-    .info  = snd_intel8x0m_switch_default_info,
-    .get   = snd_intel8x0m_switch_default_get,
-    .put   = snd_intel8x0m_switch_default_put,
-    .private_value = PRIVATE_VALUE_INITIALIZER(AC97_GPIO_STATUS,AC97_GPIO_LINE1_OH)
-  }
-};
 
 MODULE_DEVICE_TABLE(pci, snd_intel8x0m_ids);
 
-static int snd_intel8x0m_switch_default_info(snd_kcontrol_t *kcontrol,
-                                            snd_ctl_elem_info_t *uinfo)
-{
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
-       uinfo->count = 1;
-       uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 1;
-       return 0;
-}
-
-static int snd_intel8x0m_switch_default_get(snd_kcontrol_t *kcontrol,
-                                           snd_ctl_elem_value_t *ucontrol)
-{
-       unsigned short mask = PRIVATE_VALUE_MASK(kcontrol);
-       unsigned short reg = PRIVATE_VALUE_REG(kcontrol);
-       intel8x0_t *chip = snd_kcontrol_chip(kcontrol);
-       unsigned int status;
-       status = snd_ac97_read(chip->ac97, reg) & mask ? 1 : 0;
-       ucontrol->value.integer.value[0] = status;
-       return 0;
-}
-static int snd_intel8x0m_switch_default_put(snd_kcontrol_t *kcontrol,
-                                           snd_ctl_elem_value_t *ucontrol)
-{
-       unsigned short mask = PRIVATE_VALUE_MASK(kcontrol);
-       unsigned short reg = PRIVATE_VALUE_REG(kcontrol);
-       intel8x0_t *chip = snd_kcontrol_chip(kcontrol);
-       unsigned short new_status = ucontrol->value.integer.value[0] ? mask : ~mask;
-       return snd_ac97_update_bits(chip->ac97, reg,
-                                   mask, new_status);
-}
 /*
  *  Lowlevel I/O - busmaster
  */
 
-static u8 igetbyte(intel8x0_t *chip, u32 offset)
+static u8 igetbyte(struct intel8x0m *chip, u32 offset)
 {
        if (chip->bm_mmio)
                return readb(chip->remap_bmaddr + offset);
@@ -358,7 +261,7 @@ static u8 igetbyte(intel8x0_t *chip, u32 offset)
                return inb(chip->bmaddr + offset);
 }
 
-static u16 igetword(intel8x0_t *chip, u32 offset)
+static u16 igetword(struct intel8x0m *chip, u32 offset)
 {
        if (chip->bm_mmio)
                return readw(chip->remap_bmaddr + offset);
@@ -366,7 +269,7 @@ static u16 igetword(intel8x0_t *chip, u32 offset)
                return inw(chip->bmaddr + offset);
 }
 
-static u32 igetdword(intel8x0_t *chip, u32 offset)
+static u32 igetdword(struct intel8x0m *chip, u32 offset)
 {
        if (chip->bm_mmio)
                return readl(chip->remap_bmaddr + offset);
@@ -374,7 +277,7 @@ static u32 igetdword(intel8x0_t *chip, u32 offset)
                return inl(chip->bmaddr + offset);
 }
 
-static void iputbyte(intel8x0_t *chip, u32 offset, u8 val)
+static void iputbyte(struct intel8x0m *chip, u32 offset, u8 val)
 {
        if (chip->bm_mmio)
                writeb(val, chip->remap_bmaddr + offset);
@@ -382,7 +285,7 @@ static void iputbyte(intel8x0_t *chip, u32 offset, u8 val)
                outb(val, chip->bmaddr + offset);
 }
 
-static void iputword(intel8x0_t *chip, u32 offset, u16 val)
+static void iputword(struct intel8x0m *chip, u32 offset, u16 val)
 {
        if (chip->bm_mmio)
                writew(val, chip->remap_bmaddr + offset);
@@ -390,7 +293,7 @@ static void iputword(intel8x0_t *chip, u32 offset, u16 val)
                outw(val, chip->bmaddr + offset);
 }
 
-static void iputdword(intel8x0_t *chip, u32 offset, u32 val)
+static void iputdword(struct intel8x0m *chip, u32 offset, u32 val)
 {
        if (chip->bm_mmio)
                writel(val, chip->remap_bmaddr + offset);
@@ -402,7 +305,7 @@ static void iputdword(intel8x0_t *chip, u32 offset, u32 val)
  *  Lowlevel I/O - AC'97 registers
  */
 
-static u16 iagetword(intel8x0_t *chip, u32 offset)
+static u16 iagetword(struct intel8x0m *chip, u32 offset)
 {
        if (chip->mmio)
                return readw(chip->remap_addr + offset);
@@ -410,7 +313,7 @@ static u16 iagetword(intel8x0_t *chip, u32 offset)
                return inw(chip->addr + offset);
 }
 
-static void iaputword(intel8x0_t *chip, u32 offset, u16 val)
+static void iaputword(struct intel8x0m *chip, u32 offset, u16 val)
 {
        if (chip->mmio)
                writew(val, chip->remap_addr + offset);
@@ -427,7 +330,7 @@ static void iaputword(intel8x0_t *chip, u32 offset, u16 val)
  */
 
 /* return the GLOB_STA bit for the corresponding codec */
-static unsigned int get_ich_codec_bit(intel8x0_t *chip, unsigned int codec)
+static unsigned int get_ich_codec_bit(struct intel8x0m *chip, unsigned int codec)
 {
        static unsigned int codec_bit[3] = {
                ICH_PCR, ICH_SCR, ICH_TCR
@@ -436,7 +339,7 @@ static unsigned int get_ich_codec_bit(intel8x0_t *chip, unsigned int codec)
        return codec_bit[codec];
 }
 
-static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec)
+static int snd_intel8x0m_codec_semaphore(struct intel8x0m *chip, unsigned int codec)
 {
        int time;
        
@@ -459,47 +362,50 @@ static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec)
        /* access to some forbidden (non existant) ac97 registers will not
         * reset the semaphore. So even if you don't get the semaphore, still
         * continue the access. We don't need the semaphore anyway. */
-       snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n",
+       snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n",
                        igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA)));
        iagetword(chip, 0);     /* clear semaphore flag */
        /* I don't care about the semaphore */
        return -EBUSY;
 }
  
-static void snd_intel8x0_codec_write(ac97_t *ac97,
+static void snd_intel8x0_codec_write(struct snd_ac97 *ac97,
                                     unsigned short reg,
                                     unsigned short val)
 {
-       intel8x0_t *chip = ac97->private_data;
+       struct intel8x0m *chip = ac97->private_data;
        
        if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
                if (! chip->in_ac97_init)
-                       snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
+                       snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
        }
        iaputword(chip, reg + ac97->num * 0x80, val);
 }
 
-static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
+static unsigned short snd_intel8x0_codec_read(struct snd_ac97 *ac97,
                                              unsigned short reg)
 {
-       intel8x0_t *chip = ac97->private_data;
+       struct intel8x0m *chip = ac97->private_data;
        unsigned short res;
        unsigned int tmp;
 
        if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) {
                if (! chip->in_ac97_init)
-                       snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
+                       snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg);
                res = 0xffff;
        } else {
                res = iagetword(chip, reg + ac97->num * 0x80);
                if ((tmp = igetdword(chip, ICHREG(GLOB_STA))) & ICH_RCS) {
                        /* reset RCS and preserve other R/WC bits */
-                       iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI));
+                       iputdword(chip, ICHREG(GLOB_STA),
+                                 tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI));
                        if (! chip->in_ac97_init)
-                               snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg);
+                               snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg);
                        res = 0xffff;
                }
        }
+       if (reg == AC97_GPIO_STATUS)
+               iagetword(chip, 0); /* clear semaphore */
        return res;
 }
 
@@ -507,7 +413,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97,
 /*
  * DMA I/O
  */
-static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev) 
+static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ichdev) 
 {
        int idx;
        u32 *bdbar = ichdev->bdbar;
@@ -554,7 +460,7 @@ static void snd_intel8x0_setup_periods(intel8x0_t *chip, ichdev_t *ichdev)
  *  Interrupt handler
  */
 
-static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
+static inline void snd_intel8x0_update(struct intel8x0m *chip, struct ichdev *ichdev)
 {
        unsigned long port = ichdev->reg_offset;
        int civ, i, step;
@@ -583,8 +489,15 @@ static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
        for (i = 0; i < step; i++) {
                ichdev->lvi_frag++;
                ichdev->lvi_frag %= ichdev->frags;
-               ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1);
-       // printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), inl(port + 4), inb(port + ICH_REG_OFF_CR));
+               ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf +
+                                                            ichdev->lvi_frag *
+                                                            ichdev->fragsize1);
+#if 0
+               printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n",
+                      ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2],
+                      ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port),
+                      inl(port + 4), inb(port + ICH_REG_OFF_CR));
+#endif
                if (--ichdev->ack == 0) {
                        ichdev->ack = ichdev->ack_reload;
                        ack = 1;
@@ -600,8 +513,8 @@ static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
 
 static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-       intel8x0_t *chip = dev_id;
-       ichdev_t *ichdev;
+       struct intel8x0m *chip = dev_id;
+       struct ichdev *ichdev;
        unsigned int status;
        unsigned int i;
 
@@ -635,10 +548,10 @@ static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs
  *  PCM part
  */
 
-static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
+static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
-       ichdev_t *ichdev = get_ichdev(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
+       struct ichdev *ichdev = get_ichdev(substream);
        unsigned char val = 0;
        unsigned long port = ichdev->reg_offset;
 
@@ -670,21 +583,21 @@ static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
        return 0;
 }
 
-static int snd_intel8x0_hw_params(snd_pcm_substream_t * substream,
-                                 snd_pcm_hw_params_t * hw_params)
+static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,
+                                 struct snd_pcm_hw_params *hw_params)
 {
        return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 }
 
-static int snd_intel8x0_hw_free(snd_pcm_substream_t * substream)
+static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
 {
        return snd_pcm_lib_free_pages(substream);
 }
 
-static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substream)
+static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
-       ichdev_t *ichdev = get_ichdev(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
+       struct ichdev *ichdev = get_ichdev(substream);
        size_t ptr1, ptr;
 
        ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift;
@@ -698,26 +611,11 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substrea
        return bytes_to_frames(substream->runtime, ptr);
 }
 
-static int snd_intel8x0m_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
-{
-       /* hook off/on on start/stop */
-       /* Moved this to mixer control */
-       switch (cmd) {
-       case SNDRV_PCM_TRIGGER_START:
-               break;
-       case SNDRV_PCM_TRIGGER_STOP:
-               break;
-       default:
-               return -EINVAL;
-       }
-       return snd_intel8x0_pcm_trigger(substream,cmd);
-}
-
-static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream)
+static int snd_intel8x0m_pcm_prepare(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
-       ichdev_t *ichdev = get_ichdev(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct ichdev *ichdev = get_ichdev(substream);
 
        ichdev->physbuf = runtime->dma_addr;
        ichdev->size = snd_pcm_lib_buffer_bytes(substream);
@@ -728,7 +626,7 @@ static int snd_intel8x0m_pcm_prepare(snd_pcm_substream_t * substream)
        return 0;
 }
 
-static snd_pcm_hardware_t snd_intel8x0m_stream =
+static struct snd_pcm_hardware snd_intel8x0m_stream =
 {
        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -750,92 +648,94 @@ static snd_pcm_hardware_t snd_intel8x0m_stream =
 };
 
 
-static int snd_intel8x0m_pcm_open(snd_pcm_substream_t * substream, ichdev_t *ichdev)
+static int snd_intel8x0m_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev)
 {
        static unsigned int rates[] = { 8000,  9600, 12000, 16000 };
-       static snd_pcm_hw_constraint_list_t hw_constraints_rates = {
+       static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
                .count = ARRAY_SIZE(rates),
                .list = rates,
                .mask = 0,
        };
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_pcm_runtime *runtime = substream->runtime;
        int err;
 
        ichdev->substream = substream;
        runtime->hw = snd_intel8x0m_stream;
-       err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
+       err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
+                                        &hw_constraints_rates);
        if ( err < 0 )
                return err;
        runtime->private_data = ichdev;
        return 0;
 }
 
-static int snd_intel8x0m_playback_open(snd_pcm_substream_t * substream)
+static int snd_intel8x0m_playback_open(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
 
        return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMOUT]);
 }
 
-static int snd_intel8x0m_playback_close(snd_pcm_substream_t * substream)
+static int snd_intel8x0m_playback_close(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
 
        chip->ichd[ICHD_MDMOUT].substream = NULL;
        return 0;
 }
 
-static int snd_intel8x0m_capture_open(snd_pcm_substream_t * substream)
+static int snd_intel8x0m_capture_open(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
 
        return snd_intel8x0m_pcm_open(substream, &chip->ichd[ICHD_MDMIN]);
 }
 
-static int snd_intel8x0m_capture_close(snd_pcm_substream_t * substream)
+static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream)
 {
-       intel8x0_t *chip = snd_pcm_substream_chip(substream);
+       struct intel8x0m *chip = snd_pcm_substream_chip(substream);
 
        chip->ichd[ICHD_MDMIN].substream = NULL;
        return 0;
 }
 
 
-static snd_pcm_ops_t snd_intel8x0m_playback_ops = {
+static struct snd_pcm_ops snd_intel8x0m_playback_ops = {
        .open =         snd_intel8x0m_playback_open,
        .close =        snd_intel8x0m_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0m_pcm_prepare,
-       .trigger =      snd_intel8x0m_pcm_trigger,
+       .trigger =      snd_intel8x0_pcm_trigger,
        .pointer =      snd_intel8x0_pcm_pointer,
 };
 
-static snd_pcm_ops_t snd_intel8x0m_capture_ops = {
+static struct snd_pcm_ops snd_intel8x0m_capture_ops = {
        .open =         snd_intel8x0m_capture_open,
        .close =        snd_intel8x0m_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0m_pcm_prepare,
-       .trigger =      snd_intel8x0m_pcm_trigger,
+       .trigger =      snd_intel8x0_pcm_trigger,
        .pointer =      snd_intel8x0_pcm_pointer,
 };
 
 
 struct ich_pcm_table {
        char *suffix;
-       snd_pcm_ops_t *playback_ops;
-       snd_pcm_ops_t *capture_ops;
+       struct snd_pcm_ops *playback_ops;
+       struct snd_pcm_ops *capture_ops;
        size_t prealloc_size;
        size_t prealloc_max_size;
        int ac97_idx;
 };
 
-static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_pcm_table *rec)
+static int __devinit snd_intel8x0_pcm1(struct intel8x0m *chip, int device,
+                                      struct ich_pcm_table *rec)
 {
-       snd_pcm_t *pcm;
+       struct snd_pcm *pcm;
        int err;
        char name[32];
 
@@ -856,6 +756,7 @@ static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_
 
        pcm->private_data = chip;
        pcm->info_flags = 0;
+       pcm->dev_class = SNDRV_PCM_CLASS_MODEM;
        if (rec->suffix)
                sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix);
        else
@@ -880,7 +781,7 @@ static struct ich_pcm_table intel_pcms[] __devinitdata = {
        },
 };
 
-static int __devinit snd_intel8x0_pcm(intel8x0_t *chip)
+static int __devinit snd_intel8x0_pcm(struct intel8x0m *chip)
 {
        int i, tblsize, device, err;
        struct ich_pcm_table *tbl, *rec;
@@ -927,28 +828,27 @@ static int __devinit snd_intel8x0_pcm(intel8x0_t *chip)
  *  Mixer part
  */
 
-static void snd_intel8x0_mixer_free_ac97_bus(ac97_bus_t *bus)
+static void snd_intel8x0_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
 {
-       intel8x0_t *chip = bus->private_data;
+       struct intel8x0m *chip = bus->private_data;
        chip->ac97_bus = NULL;
 }
 
-static void snd_intel8x0_mixer_free_ac97(ac97_t *ac97)
+static void snd_intel8x0_mixer_free_ac97(struct snd_ac97 *ac97)
 {
-       intel8x0_t *chip = ac97->private_data;
+       struct intel8x0m *chip = ac97->private_data;
        chip->ac97 = NULL;
 }
 
 
-static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
+static int __devinit snd_intel8x0_mixer(struct intel8x0m *chip, int ac97_clock)
 {
-       ac97_bus_t *pbus;
-       ac97_template_t ac97;
-       ac97_t *x97;
+       struct snd_ac97_bus *pbus;
+       struct snd_ac97_template ac97;
+       struct snd_ac97 *x97;
        int err;
        unsigned int glob_sta = 0;
-       unsigned int idx;
-       static ac97_bus_ops_t ops = {
+       static struct snd_ac97_bus_ops ops = {
                .write = snd_intel8x0_codec_write,
                .read = snd_intel8x0_codec_read,
        };
@@ -965,7 +865,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
        if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0)
                goto __err;
        pbus->private_free = snd_intel8x0_mixer_free_ac97_bus;
-       pbus->shared_type = AC97_SHARED_TYPE_ICH;       /* shared with audio driver */
        if (ac97_clock >= 8000 && ac97_clock <= 48000)
                pbus->clock = ac97_clock;
        chip->ac97_bus = pbus;
@@ -983,10 +882,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
                chip->ichd[ICHD_MDMIN].ac97 = x97;
                chip->ichd[ICHD_MDMOUT].ac97 = x97;
        }
-       for (idx = 0; idx < ARRAY_SIZE(snd_intel8x0m_mixer_switches); idx++) {
-               if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_intel8x0m_mixer_switches[idx], chip))) < 0)
-                       goto __err;
-       }
 
        chip->in_ac97_init = 0;
        return 0;
@@ -994,7 +889,8 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
  __err:
        /* clear the cold-reset bit for the next chance */
        if (chip->device_type != DEVICE_ALI)
-               iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
+               iputdword(chip, ICHREG(GLOB_CNT),
+                         igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
        return err;
 }
 
@@ -1003,12 +899,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock)
  *
  */
 
-#define do_delay(chip) do {\
-       set_current_state(TASK_UNINTERRUPTIBLE);\
-       schedule_timeout(1);\
-} while (0)
-
-static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
+static int snd_intel8x0m_ich_chip_init(struct intel8x0m *chip, int probing)
 {
        unsigned long end_time;
        unsigned int cnt, status, nstatus;
@@ -1029,9 +920,10 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
        do {
                if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0)
                        goto __ok;
-               do_delay(chip);
+               schedule_timeout_uninterruptible(1);
        } while (time_after_eq(end_time, jiffies));
-       snd_printk("AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT)));
+       snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n",
+                  igetdword(chip, ICHREG(GLOB_CNT)));
        return -EIO;
 
       __ok:
@@ -1042,14 +934,16 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
                 */
                end_time = jiffies + HZ;
                do {
-                       status = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
+                       status = igetdword(chip, ICHREG(GLOB_STA)) &
+                               (ICH_PCR | ICH_SCR | ICH_TCR);
                        if (status)
                                break;
-                       do_delay(chip);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
                if (! status) {
                        /* no codec is found */
-                       snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n", igetdword(chip, ICHREG(GLOB_STA)));
+                       snd_printk(KERN_ERR "codec_ready: codec is not ready [0x%x]\n",
+                                  igetdword(chip, ICHREG(GLOB_STA)));
                        return -EIO;
                }
 
@@ -1059,7 +953,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
                /* wait for other codecs ready status. */
                end_time = jiffies + HZ / 4;
                while (status != nstatus && time_after_eq(end_time, jiffies)) {
-                       do_delay(chip);
+                       schedule_timeout_uninterruptible(1);
                        status |= igetdword(chip, ICHREG(GLOB_STA)) & nstatus;
                }
 
@@ -1071,10 +965,11 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
                /* wait until all the probed codecs are ready */
                end_time = jiffies + HZ;
                do {
-                       nstatus = igetdword(chip, ICHREG(GLOB_STA)) & (ICH_PCR | ICH_SCR | ICH_TCR);
+                       nstatus = igetdword(chip, ICHREG(GLOB_STA)) &
+                               (ICH_PCR | ICH_SCR | ICH_TCR);
                        if (status == nstatus)
                                break;
-                       do_delay(chip);
+                       schedule_timeout_uninterruptible(1);
                } while (time_after_eq(end_time, jiffies));
        }
 
@@ -1086,7 +981,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing)
        return 0;
 }
 
-static int snd_intel8x0_chip_init(intel8x0_t *chip, int probing)
+static int snd_intel8x0_chip_init(struct intel8x0m *chip, int probing)
 {
        unsigned int i;
        int err;
@@ -1107,7 +1002,7 @@ static int snd_intel8x0_chip_init(intel8x0_t *chip, int probing)
        return 0;
 }
 
-static int snd_intel8x0_free(intel8x0_t *chip)
+static int snd_intel8x0_free(struct intel8x0m *chip)
 {
        unsigned int i;
 
@@ -1129,7 +1024,7 @@ static int snd_intel8x0_free(intel8x0_t *chip)
        if (chip->remap_bmaddr)
                iounmap(chip->remap_bmaddr);
        if (chip->irq >= 0)
-               free_irq(chip->irq, (void *)chip);
+               free_irq(chip->irq, chip);
        pci_release_regions(chip->pci);
        pci_disable_device(chip->pci);
        kfree(chip);
@@ -1140,43 +1035,50 @@ static int snd_intel8x0_free(intel8x0_t *chip)
 /*
  * power management
  */
-static int intel8x0m_suspend(snd_card_t *card, pm_message_t state)
+static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
 {
-       intel8x0_t *chip = card->pm_private_data;
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct intel8x0m *chip = card->private_data;
        int i;
 
+       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
        for (i = 0; i < chip->pcm_devs; i++)
                snd_pcm_suspend_all(chip->pcm[i]);
-       if (chip->ac97)
-               snd_ac97_suspend(chip->ac97);
-       pci_disable_device(chip->pci);
+       snd_ac97_suspend(chip->ac97);
+       pci_disable_device(pci);
+       pci_save_state(pci);
        return 0;
 }
 
-static int intel8x0m_resume(snd_card_t *card)
+static int intel8x0m_resume(struct pci_dev *pci)
 {
-       intel8x0_t *chip = card->pm_private_data;
-       pci_enable_device(chip->pci);
-       pci_set_master(chip->pci);
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct intel8x0m *chip = card->private_data;
+
+       pci_restore_state(pci);
+       pci_enable_device(pci);
+       pci_set_master(pci);
        snd_intel8x0_chip_init(chip, 0);
-       if (chip->ac97)
-               snd_ac97_resume(chip->ac97);
+       snd_ac97_resume(chip->ac97);
 
+       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
 #endif /* CONFIG_PM */
 
-static void snd_intel8x0m_proc_read(snd_info_entry_t * entry,
-                                  snd_info_buffer_t * buffer)
+#ifdef CONFIG_PROC_FS
+static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
+                                  struct snd_info_buffer *buffer)
 {
-       intel8x0_t *chip = entry->private_data;
+       struct intel8x0m *chip = entry->private_data;
        unsigned int tmp;
 
        snd_iprintf(buffer, "Intel8x0m\n\n");
        if (chip->device_type == DEVICE_ALI)
                return;
        tmp = igetdword(chip, ICHREG(GLOB_STA));
-       snd_iprintf(buffer, "Global control        : 0x%08x\n", igetdword(chip, ICHREG(GLOB_CNT)));
+       snd_iprintf(buffer, "Global control        : 0x%08x\n",
+                   igetdword(chip, ICHREG(GLOB_CNT)));
        snd_iprintf(buffer, "Global status         : 0x%08x\n", tmp);
        snd_iprintf(buffer, "AC'97 codecs ready    :%s%s%s%s\n",
                        tmp & ICH_PCR ? " primary" : "",
@@ -1185,17 +1087,21 @@ static void snd_intel8x0m_proc_read(snd_info_entry_t * entry,
                        (tmp & (ICH_PCR | ICH_SCR | ICH_TCR)) == 0 ? " none" : "");
 }
 
-static void __devinit snd_intel8x0m_proc_init(intel8x0_t * chip)
+static void __devinit snd_intel8x0m_proc_init(struct intel8x0m * chip)
 {
-       snd_info_entry_t *entry;
+       struct snd_info_entry *entry;
 
        if (! snd_card_proc_new(chip->card, "intel8x0m", &entry))
                snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0m_proc_read);
 }
+#else /* !CONFIG_PROC_FS */
+#define snd_intel8x0m_proc_init(chip)
+#endif /* CONFIG_PROC_FS */
+
 
-static int snd_intel8x0_dev_free(snd_device_t *device)
+static int snd_intel8x0_dev_free(struct snd_device *device)
 {
-       intel8x0_t *chip = device->device_data;
+       struct intel8x0m *chip = device->device_data;
        return snd_intel8x0_free(chip);
 }
 
@@ -1204,17 +1110,17 @@ struct ich_reg_info {
        unsigned int offset;
 };
 
-static int __devinit snd_intel8x0m_create(snd_card_t * card,
+static int __devinit snd_intel8x0m_create(struct snd_card *card,
                                         struct pci_dev *pci,
                                         unsigned long device_type,
-                                        intel8x0_t ** r_intel8x0)
+                                        struct intel8x0m ** r_intel8x0)
 {
-       intel8x0_t *chip;
+       struct intel8x0m *chip;
        int err;
        unsigned int i;
        unsigned int int_sta_masks;
-       ichdev_t *ichdev;
-       static snd_device_ops_t ops = {
+       struct ichdev *ichdev;
+       static struct snd_device_ops ops = {
                .dev_free =     snd_intel8x0_dev_free,
        };
        static struct ich_reg_info intel_regs[2] = {
@@ -1228,7 +1134,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1257,7 +1163,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
                chip->remap_addr = ioremap_nocache(chip->addr,
                                                   pci_resource_len(pci, 2));
                if (chip->remap_addr == NULL) {
-                       snd_printk("AC'97 space ioremap problem\n");
+                       snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
                        snd_intel8x0_free(chip);
                        return -EIO;
                }
@@ -1270,7 +1176,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
                chip->remap_bmaddr = ioremap_nocache(chip->bmaddr,
                                                     pci_resource_len(pci, 3));
                if (chip->remap_bmaddr == NULL) {
-                       snd_printk("Controller space ioremap problem\n");
+                       snd_printk(KERN_ERR "Controller space ioremap problem\n");
                        snd_intel8x0_free(chip);
                        return -EIO;
                }
@@ -1279,8 +1185,9 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
        }
 
  port_inited:
-       if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
-               snd_printk("unable to grab IRQ %d\n", pci->irq);
+       if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ,
+                       card->shortname, chip)) {
+               snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_intel8x0_free(chip);
                return -EBUSY;
        }
@@ -1336,8 +1243,6 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
                return err;
        }
 
-       snd_card_set_pm_callback(card, intel8x0m_suspend, intel8x0m_resume, chip);
-
        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
                snd_intel8x0_free(chip);
                return err;
@@ -1353,18 +1258,18 @@ static struct shortname_table {
        unsigned int id;
        const char *s;
 } shortnames[] __devinitdata = {
-       { PCI_DEVICE_ID_INTEL_82801_6, "Intel 82801AA-ICH" },
-       { PCI_DEVICE_ID_INTEL_82901_6, "Intel 82901AB-ICH0" },
+       { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" },
+       { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" },
        { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" },
        { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" },
-       { PCI_DEVICE_ID_INTEL_ICH3_6, "Intel 82801CA-ICH3" },
-       { PCI_DEVICE_ID_INTEL_ICH4_6, "Intel 82801DB-ICH4" },
-       { PCI_DEVICE_ID_INTEL_ICH5_6, "Intel ICH5" },
-       { PCI_DEVICE_ID_INTEL_ICH6_6, "Intel ICH6" },
-       { PCI_DEVICE_ID_INTEL_ICH7_6, "Intel ICH7" },
+       { PCI_DEVICE_ID_INTEL_82801CA_6, "Intel 82801CA-ICH3" },
+       { PCI_DEVICE_ID_INTEL_82801DB_6, "Intel 82801DB-ICH4" },
+       { PCI_DEVICE_ID_INTEL_82801EB_6, "Intel ICH5" },
+       { PCI_DEVICE_ID_INTEL_ICH6_17, "Intel ICH6" },
+       { PCI_DEVICE_ID_INTEL_ICH7_19, "Intel ICH7" },
        { 0x7446, "AMD AMD768" },
        { PCI_DEVICE_ID_SI_7013, "SiS SI7013" },
-       { PCI_DEVICE_ID_NVIDIA_MCP_MODEM, "NVidia nForce" },
+       { PCI_DEVICE_ID_NVIDIA_MCP1_MODEM, "NVidia nForce" },
        { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" },
        { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" },
        { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" },
@@ -1378,20 +1283,12 @@ static struct shortname_table {
 static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
                                        const struct pci_device_id *pci_id)
 {
-       static int dev;
-       snd_card_t *card;
-       intel8x0_t *chip;
+       struct snd_card *card;
+       struct intel8x0m *chip;
        int err;
        struct shortname_table *name;
 
-       if (dev >= SNDRV_CARDS)
-               return -ENODEV;
-       if (!enable[dev]) {
-               dev++;
-               return -ENOENT;
-       }
-
-       card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+       card = snd_card_new(index, id, THIS_MODULE, 0);
        if (card == NULL)
                return -ENOMEM;
 
@@ -1409,8 +1306,9 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
                snd_card_free(card);
                return err;
        }
+       card->private_data = chip;
 
-       if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev])) < 0) {
+       if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) {
                snd_card_free(card);
                return err;
        }
@@ -1429,7 +1327,6 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
                return err;
        }
        pci_set_drvdata(pci, card);
-       dev++;
        return 0;
 }
 
@@ -1444,13 +1341,16 @@ static struct pci_driver driver = {
        .id_table = snd_intel8x0m_ids,
        .probe = snd_intel8x0m_probe,
        .remove = __devexit_p(snd_intel8x0m_remove),
-       SND_PCI_PM_CALLBACKS
+#ifdef CONFIG_PM
+       .suspend = intel8x0m_suspend,
+       .resume = intel8x0m_resume,
+#endif
 };
 
 
 static int __init alsa_card_intel8x0m_init(void)
 {
-       return pci_module_init(&driver);
+       return pci_register_driver(&driver);
 }
 
 static void __exit alsa_card_intel8x0m_exit(void)