[alsa-devel] [PATCH v2 2/3] snd_pcm_start_at: Add snd_pcm_ops so that driver can handle start_at requests.

Tim Cussins timcussins at eml.cc
Wed Dec 17 18:29:24 CET 2014


Provide members for starting and cancelling the timer.
Add state to snd_pcm_runtime that tracks current timer: This
allows us to cancel on state-change, or subsequent start_at call.

Signed-off-by: Tim Cussins <timcussins at eml.cc>

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 1e7f74a..e7d5ded 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -73,6 +73,8 @@ struct snd_pcm_ops {
 	snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
 	int (*wall_clock)(struct snd_pcm_substream *substream,
 			  struct timespec *audio_ts);
+	int (*start_at)(struct snd_pcm_substream *substream, int audio_tstamp_type, const struct timespec *ts);
+	int (*start_at_cancel)(struct snd_pcm_substream *substream);
 	int (*copy)(struct snd_pcm_substream *substream, int channel,
 		    snd_pcm_uframes_t pos,
 		    void __user *buf, snd_pcm_uframes_t count);
@@ -364,6 +366,10 @@ struct snd_pcm_runtime {
 #ifdef CONFIG_SND_PCM_XRUN_DEBUG
 	struct snd_pcm_hwptr_log *hwptr_log;
 #endif
+
+	int start_at_timer_running;		/* 0 if no timer is running, 1 if running */
+	int start_at_timer_tstamp_class;	/* tstamp class of current timer */
+	void* start_at_timer_data;		/* data associated with current timer */
 };
 
 struct snd_pcm_group {		/* keep linked substreams */
-- 
2.1.0



More information about the Alsa-devel mailing list