Re: i810 audio patch

Doug Ledford
2001-12-04T23:09:36Z

> Nathan Bryant wrote:
>
>> this may be due to an output underrun... or i suppose lost interrupt
>> is also possible.
>>
>> i think it might be wise to use
>> get_available_read_data/get_free_write_space from i810_poll instead of
>> dmabuf->count directly. i'll try this and see if it works...
>
>
> No good. I tried the following, thinking that the underrun handling in
> get_free_write_space would help, but it does the same thing.
>
> What interrupt do we get upon underrun, are we dropping the
> dmabuf->enable or DAC_RUNNING state when that happens?

Yes, on underrun the DAC is stopped and dmabuf->enable is cleared.
That's clearly a bug in this case. However, it should only cause your
problem if you are in fact getting an underrun. Anyway, here's a
proposed fix you can try to see if that's what's causing the problem:

> --
>
> static unsigned int i810_poll(struct file *file, struct
> poll_table_struct *wait){
> struct i810_state *state = (struct i810_state *)file->private_data;
> struct dmabuf *dmabuf = &state->dmabuf;
> unsigned long flags;
> unsigned int mask = 0;
> int count;
>
> if(!dmabuf->ready)
> return 0;
> poll_wait(file, &dmabuf->wait, wait);
> spin_lock_irqsave(&state->card->lock, flags);
> if (file->f_mode & FMODE_READ && dmabuf->enable & ADC_RUNNING) {

if (file->f_mode & FMODE_READ && ((dmabuf->enable & ADC_RUNNING)
|| (dmabuf->trigger &
PCM_ENABLE_INPUT))) {

> count = i810_get_available_read_data(state);
> if (count >= (signed)dmabuf->userfragsize)
> mask |= POLLIN | POLLRDNORM;
> }
> if (file->f_mode & FMODE_WRITE && dmabuf->enable & DAC_RUNNING) {

if (file->f_mode & FMODE_WRITE &&((dmabuf->enable & DAC_RUNNING)
|| (dmabuf->trigger &
PCM_ENABLE_OUTPUT))) {

> count = i810_get_free_write_space(state);
> if (count >= (signed)dmabuf->userfragsize)
> mask |= POLLOUT | POLLWRNORM;
> }
> spin_unlock_irqrestore(&state->card->lock, flags);
> return mask;
> }
>

--

Doug Ledford <dledford@redhat.com> http://people.redhat.com/dledford
Please check my web site for aic7xxx updates/answers before
e-mailing me about problems