ALSA: firewire-lib: flush completed packets when reading PCM position
[firefly-linux-kernel-4.4.55.git] / sound / firewire / amdtp.h
index 537a9cb83581b1b469b83914f39d3158413beb4f..3f13ff63c5d245072e9671f029665903ee4c12d6 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef SOUND_FIREWIRE_AMDTP_H_INCLUDED
 #define SOUND_FIREWIRE_AMDTP_H_INCLUDED
 
+#include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include "packets-buffer.h"
@@ -55,6 +56,7 @@ struct amdtp_out_stream {
        struct iso_packets_buffer buffer;
 
        struct snd_pcm_substream *pcm;
+       struct tasklet_struct period_tasklet;
 
        int packet_index;
        unsigned int data_block_counter;
@@ -81,6 +83,8 @@ 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);
 
 /**
@@ -122,18 +126,6 @@ static inline bool amdtp_out_streaming_error(struct amdtp_out_stream *s)
        return s->packet_index < 0;
 }
 
-/**
- * amdtp_out_stream_pcm_prepare - prepare PCM device for running
- * @s: the AMDTP output stream
- *
- * This function should be called from the PCM device's .prepare callback.
- */
-static inline void amdtp_out_stream_pcm_prepare(struct amdtp_out_stream *s)
-{
-       s->pcm_buffer_pointer = 0;
-       s->pcm_period_pointer = 0;
-}
-
 /**
  * amdtp_out_stream_pcm_trigger - start/stop playback from a PCM device
  * @s: the AMDTP output stream
@@ -149,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;