]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ALSA: firewire-lib: flush completed packets when reading PCM position
authorClemens Ladisch <clemens@ladisch.de>
Sun, 13 May 2012 16:49:14 +0000 (18:49 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 14 May 2012 08:43:36 +0000 (10:43 +0200)
By flushing all completed but not yet reported packets before reading
the PCM hardware position, the granularity of the pointer is improved
from the interrupt interval to the packet size.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp.c
sound/firewire/amdtp.h

index 3284ee9c1ecac7b86ec33a2d0953b886e3c4d4a1..c2685fbd73666635e579e3a5d5bc58fbc68795f0 100644 (file)
@@ -531,6 +531,20 @@ err_unlock:
 }
 EXPORT_SYMBOL(amdtp_out_stream_start);
 
+/**
+ * amdtp_out_stream_pcm_pointer - get the PCM buffer position
+ * @s: the AMDTP output stream that transports the PCM data
+ *
+ * Returns the current buffer position, in frames.
+ */
+unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s)
+{
+       fw_iso_context_flush_completions(s->context);
+
+       return ACCESS_ONCE(s->pcm_buffer_pointer);
+}
+EXPORT_SYMBOL(amdtp_out_stream_pcm_pointer);
+
 /**
  * amdtp_out_stream_update - update the stream after a bus reset
  * @s: the AMDTP output stream
index 4987f826f9f3f318dc5dd98ce4318539f0599053..3f13ff63c5d245072e9671f029665903ee4c12d6 100644 (file)
@@ -84,6 +84,7 @@ void amdtp_out_stream_stop(struct amdtp_out_stream *s);
 void amdtp_out_stream_set_pcm_format(struct amdtp_out_stream *s,
                                     snd_pcm_format_t format);
 void amdtp_out_stream_pcm_prepare(struct amdtp_out_stream *s);
+unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s);
 void amdtp_out_stream_pcm_abort(struct amdtp_out_stream *s);
 
 /**
@@ -140,18 +141,6 @@ static inline void amdtp_out_stream_pcm_trigger(struct amdtp_out_stream *s,
        ACCESS_ONCE(s->pcm) = pcm;
 }
 
-/**
- * amdtp_out_stream_pcm_pointer - get the PCM buffer position
- * @s: the AMDTP output stream that transports the PCM data
- *
- * Returns the current buffer position, in frames.
- */
-static inline unsigned long
-amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s)
-{
-       return ACCESS_ONCE(s->pcm_buffer_pointer);
-}
-
 static inline bool cip_sfc_is_base_44100(enum cip_sfc sfc)
 {
        return sfc & 1;