1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Don't push too hard waiting/looping for codec detection interrupt.

Let the interrupt do the job waking us up.
This commit is contained in:
Ariff Abdullah 2007-06-14 11:11:06 +00:00
parent 553dc5c78c
commit 79b783c721
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170720

View File

@ -899,6 +899,7 @@ atiixp_intr(void *p)
enable = atiixp_rd(sc, ATI_REG_IER);
enable &= ~detected_codecs;
atiixp_wr(sc, ATI_REG_IER, enable);
wakeup(sc);
}
/* acknowledge */
@ -1005,18 +1006,20 @@ atiixp_chip_post_init(void *arg)
polling = sc->polling;
sc->polling = 0;
/* wait for the interrupts to happen */
timeout = 100;
do {
msleep(sc, sc->lock, PWAIT, "ixpslp", 1);
if (sc->codec_not_ready_bits)
break;
} while (--timeout);
timeout = 10;
if (sc->codec_not_ready_bits == 0) {
/* wait for the interrupts to happen */
do {
msleep(sc, sc->lock, PWAIT, "ixpslp", max(hz / 10, 1));
if (sc->codec_not_ready_bits != 0)
break;
} while (--timeout);
}
sc->polling = polling;
atiixp_disable_interrupts(sc);
if (timeout == 0) {
if (sc->codec_not_ready_bits == 0 && timeout == 0) {
device_printf(sc->dev,
"WARNING: timeout during codec detection; "
"codecs might be present but haven't interrupted\n");