diff options
author | Raymond Yau <superquad.vortex2@gmail.com> | 2011-02-14 07:33:24 +0800 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-02-14 17:13:20 +0100 |
commit | 5e5677f239ba69fc718ec9a87ac4ba035dafe2c0 (patch) | |
tree | daab07aee2d37b1ccdeaa889c075175ec766828d /sound | |
parent | 61461241187c9903382f98620b26b201df521c82 (diff) | |
download | linux-5e5677f239ba69fc718ec9a87ac4ba035dafe2c0.tar.gz linux-5e5677f239ba69fc718ec9a87ac4ba035dafe2c0.tar.bz2 linux-5e5677f239ba69fc718ec9a87ac4ba035dafe2c0.zip |
ALSA: au88x0 - Modify pointer callback to give accurate playback position
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/au88x0/au88x0_core.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index 23f49f356e0f..16c0bdfbb164 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -1252,11 +1252,19 @@ static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) { static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma) { stream_t *dma = &vortex->dma_adb[adbdma]; - int temp; + int temp, page, delta; temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2)); - temp = (dma->period_virt * dma->period_bytes) + (temp & (dma->period_bytes - 1)); - return temp; + page = (temp & ADB_SUBBUF_MASK) >> ADB_SUBBUF_SHIFT; + if (dma->nr_periods >= 4) + delta = (page - dma->period_real) & 3; + else { + delta = (page - dma->period_real); + if (delta < 0) + delta += dma->nr_periods; + } + return (dma->period_virt + delta) * dma->period_bytes + + (temp & (dma->period_bytes - 1)); } static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma) |