Re: Longstanding bug in ac97/intel8x0 resume/init

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Weiner
Date: Sunday, July 6, 2008 - 4:17 pm

Hi Takashi,

Takashi Iwai <tiwai@suse.de> writes:


Okay, I redid the test with something (pretty stupid) like this:

--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -28,6 +28,7 @@
 #include <linux/pci.h>
 #include <linux/moduleparam.h>
 #include <linux/mutex.h>
+#include <linux/kallsyms.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/tlv.h>
@@ -2456,8 +2457,23 @@ static void snd_ac97_restore_status(struct snd_ac97 *ac97)
                 * are accessed..!
                 */
                if (test_bit(i, ac97->reg_accessed)) {
+                       printk("restoring register %d\n", i);
                        snd_ac97_write(ac97, i, ac97->regs[i]);
-                       snd_ac97_read(ac97, i);
+                       msleep(800);
+                       if (snd_ac97_read(ac97, i) != ac97->regs[i]) {
+                               printk("double write register %d\n", i);
+                               snd_ac97_write(ac97, i, ac97->regs[i]);
+                       }
+                       msleep(800);
+                       if (snd_ac97_read(ac97, i) != ac97->regs[i]) {
+                               printk("triple write register %d\n", i);
+                               snd_ac97_write(ac97, i, ac97->regs[i]);
+                       }
+                       msleep(800);
+                       if (snd_ac97_read(ac97, i) != ac97->regs[i]) {
+                               printk("quadruple write register %d\n", i);
+                               snd_ac97_write(ac97, i, ac97->regs[i]);
+                       }
                }
        }
 }

This makes the device resume properly, but the delays are insanely long
and still sometimes it comes to the third write!

I suspect that this issue is not a problem in the writeback code but in
the init/exit code of the driver (either intel8x0 or ac97 itself, no
idea).

Because the following behaviour can be seen:

  1. modprobe snd-intel8x0: everything fine.
  2. rmmod snd-intel8x0: everything fine.
  3. modprobe snd-intel8x0:
     ACPI: PCI Interrupt 0000:00:1f.5[B] -> Link [LNKB] -> GSI 11 (level, low) -> IRQ 11
     PCI: Setting latency timer of device 0000:00:1f.5 to 64
     ALSA sound/pci/ac97/ac97_codec.c:2054: AC'97 0 does not respond - RESET
     ACPI: PCI interrupt for device 0000:00:1f.5 disabled
     Intel ICH: probe of 0000:00:1f.5 failed with error -13
  2. rmmod snd-intel8x0: everything fine.
  3. modprobe snd-intel8x0: everything fine

So I suspect that the device is not shut down properly on
deactivation/suspension.

Therefor this module reloading fails and the resume tries to writeback
registers on the not-properly-initialized hardware.  The delays appear
way too long for me to be expectable from this hardware if it is
properly initialized, no?

May this be a possible?

If you need any more information, please say so.  This bug is really
annoying :/

	Hannes
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Longstanding bug in ac97/intel8x0 resume/init, Johannes Weiner, (Tue Jun 3, 4:31 pm)
Re: Longstanding bug in ac97/intel8x0 resume/init, Johannes Weiner, (Sun Jun 29, 3:35 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Mathieu Chouquet-Str ..., (Mon Jun 30, 11:58 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Takashi Iwai, (Tue Jul 1, 6:42 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Takashi Iwai, (Tue Jul 1, 6:43 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Johannes Weiner, (Tue Jul 1, 7:37 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Takashi Iwai, (Tue Jul 1, 7:46 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Johannes Weiner, (Tue Jul 1, 8:12 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Takashi Iwai, (Tue Jul 1, 8:16 am)
Re: Longstanding bug in ac97/intel8x0 resume/init, Johannes Weiner, (Sun Jul 6, 4:17 pm)
Re: Longstanding bug in ac97/intel8x0 resume/init, Takashi Iwai, (Wed Jul 9, 11:39 am)