TEST of patch proposed for i810 audio
maybe this patch will solve your problem, samir, maybe it won't; regardless, it should fix at least one corner case and is either obviously correct or start_*c is not ;-)
patch is against doug's 0.12.
drivers/sound/i810_audio.c renamed from i810_audio.c.12 +3 -3
@@ -952,12 +952,12 @@* the CIV value to the next sg segment to be played so that when * we call start_{dac,adc}, things will operate properly */ -if (!dmabuf->enable && dmabuf->trigger) { -if (rec && dmabuf->count != dmabuf->dmasize) { +if (!dmabuf->enable && dmabuf->trigger && dmabuf->ready) { +if (rec && dmabuf->count < dmabuf->dmasize) {outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_adc (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ; - }else if (dmabuf->count) { + }else if (!rec && dmabuf->count) {outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_dac (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ;
Quoted 4 lines · Nathan Bryant
maybe this patch will solve your problem, samir, maybe it won't; regardless, it should fix at least one corner case and is either obviously correct or start_*c is not ;-)
patch is against doug's 0.12.
[snip]
attached is a slightly more anal retentive version of my previous patch. as in the previous patch, the goal is to make update_lvi completely self-contained, ie resistant to changes in higher-level code, ie not deadlock even if somebody really sets it up with bad state, also eliminates one if/then/else thinko in 0.12 that could theoretically cause dac to be started when you're trying to record, which would cause a deadlock.
drivers/sound/i810_audio.c renamed from i810_audio.c.12 +7 -3
@@ -952,12 +952,16 @@* the CIV value to the next sg segment to be played so that when * we call start_{dac,adc}, things will operate properly */ -if (!dmabuf->enable && dmabuf->trigger) { -if (rec && dmabuf->count != dmabuf->dmasize) { +if (!dmabuf->enable && dmabuf->ready) { +if (rec && dmabuf->count < dmabuf->dmasize && + (dmabuf->trigger &PCM_ENABLE_INPUT )) + {outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_adc (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ; - }else if (dmabuf->count) { + }else if (!rec && dmabuf->count && + (dmabuf->trigger &PCM_ENABLE_OUTPUT )) + {outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_dac (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ;
Quoted 28 lines · Nathan Bryant
Quoted 4 lines · Nathan Bryant
maybe this patch will solve your problem, samir, maybe it won't; regardless, it should fix at least one corner case and is either obviously correct or start_*c is not ;-)
patch is against doug's 0.12.
[snip]
attached is a slightly more anal retentive version of my previous patch. as in the previous patch, the goal is to make
update_lvicompletely self-contained, ie resistant to changes in higher-level code, ie not deadlock even if somebody really sets it up with bad state, also eliminates one if/then/else thinko in 0.12 that could theoretically cause dac to be started when you're trying to record, which would cause a deadlock.------------------------------------------------------------------------
drivers/sound/i810_audio.c renamed from i810_audio.c.12 +4
-2@@ -952,12 +952,16 @@* the CIV value to the next sg segment to be played so that when * we call start_{dac,adc}, things will operate properly */ -if (!dmabuf->enable && dmabuf->trigger) { -if (rec && dmabuf->count != dmabuf->dmasize) { +if (!dmabuf->enable && dmabuf->ready) { +if (rec && dmabuf->count < dmabuf->dmasize && + (dmabuf->trigger &PCM_ENABLE_INPUT )) + {
drivers/sound/i810_audio.c line 967
Quoted 10 lines
drivers/sound/i810_audio.c renamed from i810_audio.c.12 +3
-1outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_adc (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ; - }else if (dmabuf->count) { + }else if (!rec && dmabuf->count && + (dmabuf->trigger &PCM_ENABLE_OUTPUT )) + {outb ((inb (port+OFF_CIV )+1 )&31 , port+OFF_LVI );__start_dac (state);while ( !(inb (port +OFF_CR ) & ((1 <<4 ) | (1 <<2 ))) ) ;
This looks fine to me. I've added it to my 0.12 driver, bumped the number to 0.13, put it up on my web site (http://people.redhat.com/dledford/i810_audio.c.gz) and if that solves people's problems then that's what I'll send to Marcello in a day or so.
Thanks Nathan, I've been to busy to look into it the last little bit :-(
Signature · 3 lines
Doug Ledford <[email protected]> http://people.redhat.com/dledford Please check my web site for aic7xxx updates/answers before e-mailing me about problems