diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-26 23:34:06 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-26 23:34:06 +0200 |
commit | 81f726b2b4cb699d2fcf7fd1b4f383650bba4a22 (patch) | |
tree | 48685a0ed6e4019788880c145fc2ac7d72d5844b | |
parent | 7265a09524fdac42b776d01f474a9eb16805ee59 (diff) |
audioac97: remove i/o bar magic, fix ac97mixreset busywait-forever timeout
the standard is i/o bar 0 is the mixer and bar 1 is status/control.
the magic with the bar sizes made it fail in qemu. so removing it
for now as all devices seen so far comply to the standard.
if we ever see a sis7012 where this might be swaped uncomment the i=0;
the busywait timeout is too long in ac97mixreset() because rd/wr
have a timeout on ther own. just remove the busy looping and do
a one second delay after mixer reset. (tested with t23)
-rw-r--r-- | sys/src/9/pc/audioac97.c | 19 | ||||
-rw-r--r-- | sys/src/9/pc/audioac97mix.c | 12 |
2 files changed, 11 insertions, 20 deletions
diff --git a/sys/src/9/pc/audioac97.c b/sys/src/9/pc/audioac97.c index 08c0f62f2..a9a1e7db1 100644 --- a/sys/src/9/pc/audioac97.c +++ b/sys/src/9/pc/audioac97.c @@ -471,15 +471,16 @@ Found: adev->ctlr = ctlr; ctlr->adev = adev; + if((p->mem[0].bar & 1) == 0 || (p->mem[1].bar & 1) == 0){ + print("ac97: not i/o regions 0x%04lux 0x%04lux\n", p->mem[0].bar, p->mem[1].bar); + return -1; + } + i = 1; - if(p->mem[0].size == 64) - i = 0; - else if(p->mem[1].size == 64) - i = 1; - else if(p->mem[0].size == 256) /* sis7012 */ - i = 1; - else if(p->mem[1].size == 256) - i = 0; + if(p->vid == 0x1039 && p->did == 0x7012){ + ctlr->sis7012 = 1; + //i = 0; i/o bars swaped? + } ctlr->port = p->mem[i].bar & ~3; if(ioalloc(ctlr->port, p->mem[i].size, 0, "ac97") < 0){ print("ac97: ioalloc failed for port 0x%04lux\n", ctlr->port); @@ -495,8 +496,6 @@ Found: irq = p->intl; tbdf = p->tbdf; - if(p->vid == 0x1039 && p->did == 0x7012) - ctlr->sis7012 = 1; print("#A%d: ac97 port 0x%04lux mixport 0x%04lux irq %d\n", adev->ctlrno, ctlr->port, ctlr->mixport, irq); diff --git a/sys/src/9/pc/audioac97mix.c b/sys/src/9/pc/audioac97mix.c index b596dab30..5194cccbc 100644 --- a/sys/src/9/pc/audioac97mix.c +++ b/sys/src/9/pc/audioac97mix.c @@ -7,8 +7,6 @@ #include "../port/error.h" #include "../port/audioif.h" -enum { Maxbusywait = 500000 }; - enum { Reset = 0x0, Capmic = 0x1, @@ -236,7 +234,6 @@ ac97mixreset(Audio *adev, void (*wr)(Audio*,int,ushort), ushort (*rr)(Audio*,int { Mixer *m; ushort t; - int i; m = malloc(sizeof(Mixer)); if(m == nil){ @@ -247,14 +244,9 @@ ac97mixreset(Audio *adev, void (*wr)(Audio*,int,ushort), ushort (*rr)(Audio*,int m->rr = rr; m->wr(adev, Reset, 0); m->wr(adev, Powerdowncsr, 0); - + delay(1000); t = (Adcpower | Dacpower | Anlpower | Refpower); - for(i = 0; i < Maxbusywait; i++){ - if((m->rr(adev, Powerdowncsr) & t) == t) - break; - microdelay(1); - } - if(i == Maxbusywait) + if((m->rr(adev, Powerdowncsr) & t) != t) print("#A%d: ac97 exhausted waiting powerup\n", adev->ctlrno); t = m->rr(adev, Extid); |