]> git.hungrycats.org Git - linux/commitdiff
ALSA CVS update
authorJaroslav Kysela <perex@suse.cz>
Thu, 25 Sep 2003 17:19:15 +0000 (19:19 +0200)
committerJaroslav Kysela <perex@suse.cz>
Thu, 25 Sep 2003 17:19:15 +0000 (19:19 +0200)
D:2003/09/10 17:26:26
C:ICE1724 driver
A:Takashi Iwai <tiwai@suse.de>
F:pci/ice1712/ice1724.c:1.16->1.17
L:use SIZE register to get the current DMA position.
L:this register seems more reliable than BASE register.

sound/pci/ice1712/ice1724.c

index 0fc548dff5f0a3d1b6e2bd6c0c1089269bab3a76..82c798438ef3625654b1b6f2636535fa9658856d 100644 (file)
@@ -482,8 +482,6 @@ static int snd_vt1724_playback_pro_prepare(snd_pcm_substream_t * substream)
        return 0;
 }
 
-#define CHECK_INVALID_PTR
-
 static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * substream)
 {
        ice1712_t *ice = snd_pcm_substream_chip(substream);
@@ -491,20 +489,28 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * s
 
        if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & VT1724_PDMA0_START))
                return 0;
+#if 0 /* read PLAYBACK_ADDR */
        ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR));
-#ifdef CHECK_INVALID_PTR
        if (ptr < substream->runtime->dma_addr) {
                snd_printd("ice1724: invalid negative ptr\n");
                return 0;
        }
-#endif
        ptr -= substream->runtime->dma_addr;
        ptr = bytes_to_frames(substream->runtime, ptr);
-#ifdef CHECK_INVALID_PTR
        if (ptr >= substream->runtime->buffer_size) {
                snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->period_size);
                return 0;
        }
+#else /* read PLAYBACK_SIZE */
+       ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff;
+       ptr = (ptr + 1) << 2;
+       ptr = bytes_to_frames(substream->runtime, ptr);
+       if (ptr <= substream->runtime->buffer_size)
+               ptr = substream->runtime->buffer_size - ptr;
+       else {
+               snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size);
+               ptr = 0;
+       }
 #endif
        return ptr;
 }
@@ -536,9 +542,22 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(snd_pcm_substream_t *substream,
 
        if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & reg->start))
                return 0;
+#if 0 /* use ADDR register */
        ptr = inl(ice->profi_port + reg->addr);
        ptr -= substream->runtime->dma_addr;
        return bytes_to_frames(substream->runtime, ptr);
+#else /* use SIZE register */
+       ptr = inw(ice->profi_port + reg->size);
+       ptr = (ptr + 1) << 2;
+       ptr = bytes_to_frames(substream->runtime, ptr);
+       if (ptr <= substream->runtime->buffer_size)
+               ptr = substream->runtime->buffer_size - ptr;
+       else {
+               snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size);
+               ptr = 0;
+       }
+       return ptr;
+#endif
 }
 
 const static struct vt1724_pcm_reg vt1724_capture_pro_reg = {