diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2004-05-10 19:59:23 -0400 |
---|---|---|
committer | David S. Miller <davem@nuts.davemloft.net> | 2004-05-10 19:59:23 -0400 |
commit | 011fba7bca5108e12613915f46e43a45eb0ae9ca (patch) | |
tree | 6e16e46a6aa328261b5c03620eac69ffe92caef1 /sound | |
parent | 37b57f6c246889f173c23c99aa3960a781a20d06 (diff) | |
download | history-011fba7bca5108e12613915f46e43a45eb0ae9ca.tar.gz |
[sound/oss i810] fix OSS fragments
This patch makes userfragsize do what it's meant to do: do not start
DAC/ADC until a full fragment is available.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/oss/i810_audio.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index 5abf226e8773f2..cd2380b8fad22b 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c @@ -1449,6 +1449,7 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t * unsigned long flags; unsigned int swptr; int cnt; + int pending; DECLARE_WAITQUEUE(waita, current); #ifdef DEBUG2 @@ -1474,6 +1475,8 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t * return -EFAULT; ret = 0; + pending = 0; + add_wait_queue(&dmabuf->wait, &waita); while (count > 0) { set_current_state(TASK_INTERRUPTIBLE); @@ -1567,7 +1570,7 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t * continue; } dmabuf->swptr = swptr; - dmabuf->count -= cnt; + pending = dmabuf->count -= cnt; spin_unlock_irqrestore(&card->lock, flags); count -= cnt; @@ -1575,7 +1578,9 @@ static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t * 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); @@ -1592,6 +1597,7 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l ssize_t ret; unsigned long flags; unsigned int swptr = 0; + int pending; int cnt; DECLARE_WAITQUEUE(waita, current); @@ -1617,6 +1623,8 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l return -EFAULT; ret = 0; + pending = 0; + add_wait_queue(&dmabuf->wait, &waita); while (count > 0) { set_current_state(TASK_INTERRUPTIBLE); @@ -1709,7 +1717,7 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l } dmabuf->swptr = swptr; - dmabuf->count += cnt; + pending = dmabuf->count += cnt; count -= cnt; buffer += cnt; @@ -1717,7 +1725,8 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l 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); |