[ALSA] [snd-hda-intel] fix sound on some Asus W6A chips
[sfrench/cifs-2.6.git] / sound / pci / intel8x0.c
index 5634bc349257021d83cc2aefed9ccb740256e55a..72dbaedcbdf579ee92ea0d7c8efa352ad2920687 100644 (file)
@@ -413,7 +413,7 @@ struct intel8x0 {
        u32 int_sta_mask;               /* interrupt status mask */
 };
 
-static struct pci_device_id snd_intel8x0_ids[] __devinitdata = {
+static struct pci_device_id snd_intel8x0_ids[] = {
        { 0x8086, 0x2415, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801AA */
        { 0x8086, 0x2425, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82901AB */
        { 0x8086, 0x2445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */
@@ -1955,6 +1955,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
                .name = "AMD64 Mobo",   /* ALC650 */
                .type = AC97_TUNE_HP_ONLY
        },
+       {
+               .subvendor = 0x10f1,
+               .subdevice = 0x2895,
+               .name = "Tyan Thunder K8WE",
+               .type = AC97_TUNE_HP_ONLY
+       },
        {
                .subvendor = 0x110a,
                .subdevice = 0x0056,
@@ -2245,6 +2251,16 @@ static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing)
        /* ACLink on, 2 channels */
        cnt = igetdword(chip, ICHREG(GLOB_CNT));
        cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK);
+#ifdef CONFIG_SND_AC97_POWER_SAVE
+       /* do cold reset - the full ac97 powerdown may leave the controller
+        * in a warm state but actually it cannot communicate with the codec.
+        */
+       iputdword(chip, ICHREG(GLOB_CNT), cnt & ~ICH_AC97COLD);
+       cnt = igetdword(chip, ICHREG(GLOB_CNT));
+       udelay(10);
+       iputdword(chip, ICHREG(GLOB_CNT), cnt | ICH_AC97COLD);
+       msleep(1);
+#else
        /* finish cold or do warm reset */
        cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM;
        iputdword(chip, ICHREG(GLOB_CNT), cnt);
@@ -2259,6 +2275,7 @@ static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing)
        return -EIO;
 
       __ok:
+#endif
        if (probing) {
                /* wait for any codec ready status.
                 * Once it becomes ready it should remain ready
@@ -2479,7 +2496,7 @@ static int intel8x0_resume(struct pci_dev *pci)
                    card->shortname, chip);
        chip->irq = pci->irq;
        synchronize_irq(chip->irq);
-       snd_intel8x0_chip_init(chip, 1);
+       snd_intel8x0_chip_init(chip, 0);
 
        /* re-initialize mixer stuff */
        if (chip->device_type == DEVICE_INTEL_ICH4) {
@@ -2609,6 +2626,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip)
                /* not 48000Hz, tuning the clock.. */
                chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos;
        printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock);
+       snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0);
 }
 
 #ifdef CONFIG_PROC_FS