Messages in this thread Patch in this message | | | Date | Sun, 23 Nov 2003 10:51:01 +1100 | Subject | [I810_AUDIO] 7/x: Fix OSS fragments | From | Herbert Xu <> |
| |
This patch makes userfragsize do what it's meant to do: do not start DAC/ADC until a full fragment is available. -- Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt Index: kernel-source-2.4/drivers/sound/i810_audio.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/drivers/sound/i810_audio.c,v retrieving revision 1.14 diff -u -r1.14 i810_audio.c --- kernel-source-2.4/drivers/sound/i810_audio.c 22 Nov 2003 08:39:42 -0000 1.14 +++ kernel-source-2.4/drivers/sound/i810_audio.c 22 Nov 2003 10:00:30 -0000 @@ -1438,6 +1438,7 @@ unsigned long flags; unsigned int swptr; int cnt; + int pending; DECLARE_WAITQUEUE(waita, current); #ifdef DEBUG2 @@ -1463,6 +1464,8 @@ return -EFAULT; ret = 0; + pending = 0; + add_wait_queue(&dmabuf->wait, &waita); while (count > 0) { set_current_state(TASK_INTERRUPTIBLE); @@ -1556,7 +1559,7 @@ continue; } dmabuf->swptr = swptr; - dmabuf->count -= cnt; + pending = dmabuf->count -= cnt; spin_unlock_irqrestore(&card->lock, flags); count -= cnt; @@ -1564,7 +1567,9 @@ ret += cnt; } done: - i810_update_lvi(state,1); + pending = dmabuf->dmasize - pending; + if (dmabuf->enable || pending >= dmabuf->userfragsize) + i810_update_lvi(state, 1); set_current_state(TASK_RUNNING); remove_wait_queue(&dmabuf->wait, &waita); @@ -1581,6 +1586,7 @@ ssize_t ret; unsigned long flags; unsigned int swptr = 0; + int pending; int cnt; DECLARE_WAITQUEUE(waita, current); @@ -1606,6 +1612,8 @@ return -EFAULT; ret = 0; + pending = 0; + add_wait_queue(&dmabuf->wait, &waita); while (count > 0) { set_current_state(TASK_INTERRUPTIBLE); @@ -1698,7 +1706,7 @@ } dmabuf->swptr = swptr; - dmabuf->count += cnt; + pending = dmabuf->count += cnt; count -= cnt; buffer += cnt; @@ -1706,7 +1714,8 @@ spin_unlock_irqrestore(&state->card->lock, flags); } ret: - i810_update_lvi(state,0); + if (dmabuf->enable || pending >= dmabuf->userfragsize) + i810_update_lvi(state, 0); set_current_state(TASK_RUNNING); remove_wait_queue(&dmabuf->wait, &waita); | |