diff options
author | ariff <ariff@FreeBSD.org> | 2007-06-14 11:11:06 +0000 |
---|---|---|
committer | ariff <ariff@FreeBSD.org> | 2007-06-14 11:11:06 +0000 |
commit | 034f58f66350dc0b5d62b6d590c60842bed6935a (patch) | |
tree | d94fe7061912d599f0f3e3651958d5402a809918 | |
parent | 14575cd8bb52c826f5ac679e0170d0aa7fe27fad (diff) | |
download | FreeBSD-src-034f58f66350dc0b5d62b6d590c60842bed6935a.zip FreeBSD-src-034f58f66350dc0b5d62b6d590c60842bed6935a.tar.gz |
Don't push too hard waiting/looping for codec detection interrupt.
Let the interrupt do the job waking us up.
-rw-r--r-- | sys/dev/sound/pci/atiixp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/sound/pci/atiixp.c b/sys/dev/sound/pci/atiixp.c index 1b325ef..58d99ae 100644 --- a/sys/dev/sound/pci/atiixp.c +++ b/sys/dev/sound/pci/atiixp.c @@ -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"); |