Commit 5cd2ad81f912c8535491f541108b655f4552dff9
Committed by
Takashi Iwai
1 parent
88a8516a21
Exists in
master
and in
20 other branches
ALSA: intel8x0m: wait a bit before warm reset check
At every resume a laptop I use prints this message (at KERN_ERR level): ALSA sound/pci/intel8x0m.c:904: AC'97 warm reset still in progress? [0x2] The thing to note here is that 0x2 corresponds to ICH_AC97COLD. Ie, what seems to be happening is that the register involved indicated a warm reset for some time (as the ICH_AC97WARM bit was set) but by the time the warning is printed, and that same register is checked again, that bit is already cleared and only the ICH_AC97COLD bit is still set. It turns out a warm reset needs some time to settle, but it is currently checked right away. The test therefore fails the first time it is done and schedule_timeout_uninterruptible() will be called. Once we return from that jiffies is already (far) past end_time on this laptop, so we exit the loop, print a warning, and exit the function while the warm reset actually succeeded. A way to fix this is to call usleep_range() after writing to the register involved. A handful of tests suggest 500 usecs is a safe value. (This might punish the "finish cold reset" case, but on this laptop such a cold reset apparently never happens, so I can't say for sure.) While we're at it drop the extra single tick from end_time, as it looks rather silly. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
sound/pci/intel8x0m.c
... | ... | @@ -894,7 +894,8 @@ |
894 | 894 | /* finish cold or do warm reset */ |
895 | 895 | cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; |
896 | 896 | iputdword(chip, ICHREG(GLOB_CNT), cnt); |
897 | - end_time = (jiffies + (HZ / 4)) + 1; | |
897 | + usleep_range(500, 1000); /* give warm reset some time */ | |
898 | + end_time = jiffies + HZ / 4; | |
898 | 899 | do { |
899 | 900 | if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) |
900 | 901 | goto __ok; |