Commit f6e398f2 authored by Jean-Paul Saman's avatar Jean-Paul Saman

davinci oss: improve stability for audio driver

Blocking read and write do not deadlock the OSS audio driver anymore. Still needs testing with O_NONBLOCK.
parent a1d2027b
......@@ -468,6 +468,7 @@ void audio_prime_rx(audio_state_t * state)
}
atomic_set(&is->pending_frags, is->nbfrags);
complete(&is->wfc); /* wake listeners */
init_completion(&is->wfc);
is->wfc.done = 0;
......@@ -686,8 +687,9 @@ void audio_reset(audio_stream_t * s)
s->usr_head = s->dma_head;
atomic_set(&s->pending_frags, 0);
complete(&s->wfc); /* wake listeners */
init_completion(&s->wfc);
s->wfc.done = s->nbfrags;
s->wfc.done = 0; //s->nbfrags;
}
AUDIO_QUEUE_INIT(s);
......
......@@ -618,7 +618,7 @@ audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
DPRINTK("AudioRead - No Memory\n");
return -ENOMEM;
}
audio_prime_rx(state);
else audio_prime_rx(state);
}
while (count > 0) {
......@@ -756,7 +756,7 @@ audio_poll(struct file *file, struct poll_table_struct *wait)
if (atomic_read(&is->active) == 0) {
if (!is->buffers && audio_setup_buf(is))
return -ENOMEM;
audio_prime_rx(state);
else audio_prime_rx(state);
}
poll_wait(file, &is->wq, wait);
}
......@@ -900,7 +900,7 @@ audio_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
FN_OUT(13);
return -ENOMEM;
}
audio_prime_rx(state);
else audio_prime_rx(state);
}
atomic_set(&is->stopped, 0);
audio_process_dma(is);
......@@ -919,6 +919,7 @@ audio_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
if (os->mapped && !atomic_read(&os->pending_frags)) {
atomic_set(&os->pending_frags, os->nbfrags);
mutex_lock(&state->mutex);
complete(&os->wfc); /* wake listeners */
init_completion(&os->wfc);
os->wfc.done = 0;
mutex_unlock(&state->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment