diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-03-23 08:14:02 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-23 08:14:02 -0400 |
commit | 3372dbdd8ca11f51be8c6a30b2bc79eb04c4a902 (patch) | |
tree | d4499bf5a5665b4820ffaf96bce55bf6b895195e /include/sound/pcm.h | |
parent | bc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff) | |
parent | 967b1307b69b8ada8b331e01046ad1ef83742e99 (diff) |
Merge branch 'for-next' into topic/hda-core
Diffstat (limited to 'include/sound/pcm.h')
-rw-r--r-- | include/sound/pcm.h | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index c0ddb7e69c28..0cb7f3f5df7b 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -60,6 +60,9 @@ struct snd_pcm_hardware { | |||
60 | 60 | ||
61 | struct snd_pcm_substream; | 61 | struct snd_pcm_substream; |
62 | 62 | ||
63 | struct snd_pcm_audio_tstamp_config; /* definitions further down */ | ||
64 | struct snd_pcm_audio_tstamp_report; | ||
65 | |||
63 | struct snd_pcm_ops { | 66 | struct snd_pcm_ops { |
64 | int (*open)(struct snd_pcm_substream *substream); | 67 | int (*open)(struct snd_pcm_substream *substream); |
65 | int (*close)(struct snd_pcm_substream *substream); | 68 | int (*close)(struct snd_pcm_substream *substream); |
@@ -71,8 +74,10 @@ struct snd_pcm_ops { | |||
71 | int (*prepare)(struct snd_pcm_substream *substream); | 74 | int (*prepare)(struct snd_pcm_substream *substream); |
72 | int (*trigger)(struct snd_pcm_substream *substream, int cmd); | 75 | int (*trigger)(struct snd_pcm_substream *substream, int cmd); |
73 | snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); | 76 | snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); |
74 | int (*wall_clock)(struct snd_pcm_substream *substream, | 77 | int (*get_time_info)(struct snd_pcm_substream *substream, |
75 | struct timespec *audio_ts); | 78 | struct timespec *system_ts, struct timespec *audio_ts, |
79 | struct snd_pcm_audio_tstamp_config *audio_tstamp_config, | ||
80 | struct snd_pcm_audio_tstamp_report *audio_tstamp_report); | ||
76 | int (*copy)(struct snd_pcm_substream *substream, int channel, | 81 | int (*copy)(struct snd_pcm_substream *substream, int channel, |
77 | snd_pcm_uframes_t pos, | 82 | snd_pcm_uframes_t pos, |
78 | void __user *buf, snd_pcm_uframes_t count); | 83 | void __user *buf, snd_pcm_uframes_t count); |
@@ -281,6 +286,58 @@ struct snd_pcm_hw_constraint_ranges { | |||
281 | 286 | ||
282 | struct snd_pcm_hwptr_log; | 287 | struct snd_pcm_hwptr_log; |
283 | 288 | ||
289 | /* | ||
290 | * userspace-provided audio timestamp config to kernel, | ||
291 | * structure is for internal use only and filled with dedicated unpack routine | ||
292 | */ | ||
293 | struct snd_pcm_audio_tstamp_config { | ||
294 | /* 5 of max 16 bits used */ | ||
295 | u32 type_requested:4; | ||
296 | u32 report_delay:1; /* add total delay to A/D or D/A */ | ||
297 | }; | ||
298 | |||
299 | static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data, | ||
300 | struct snd_pcm_audio_tstamp_config *config) | ||
301 | { | ||
302 | config->type_requested = data & 0xF; | ||
303 | config->report_delay = (data >> 4) & 1; | ||
304 | } | ||
305 | |||
306 | /* | ||
307 | * kernel-provided audio timestamp report to user-space | ||
308 | * structure is for internal use only and read by dedicated pack routine | ||
309 | */ | ||
310 | struct snd_pcm_audio_tstamp_report { | ||
311 | /* 6 of max 16 bits used for bit-fields */ | ||
312 | |||
313 | /* for backwards compatibility */ | ||
314 | u32 valid:1; | ||
315 | |||
316 | /* actual type if hardware could not support requested timestamp */ | ||
317 | u32 actual_type:4; | ||
318 | |||
319 | /* accuracy represented in ns units */ | ||
320 | u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */ | ||
321 | u32 accuracy; /* up to 4.29s, will be packed in separate field */ | ||
322 | }; | ||
323 | |||
324 | static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy, | ||
325 | const struct snd_pcm_audio_tstamp_report *report) | ||
326 | { | ||
327 | u32 tmp; | ||
328 | |||
329 | tmp = report->accuracy_report; | ||
330 | tmp <<= 4; | ||
331 | tmp |= report->actual_type; | ||
332 | tmp <<= 1; | ||
333 | tmp |= report->valid; | ||
334 | |||
335 | *data &= 0xffff; /* zero-clear MSBs */ | ||
336 | *data |= (tmp << 16); | ||
337 | *accuracy = report->accuracy; | ||
338 | } | ||
339 | |||
340 | |||
284 | struct snd_pcm_runtime { | 341 | struct snd_pcm_runtime { |
285 | /* -- Status -- */ | 342 | /* -- Status -- */ |
286 | struct snd_pcm_substream *trigger_master; | 343 | struct snd_pcm_substream *trigger_master; |
@@ -361,6 +418,11 @@ struct snd_pcm_runtime { | |||
361 | 418 | ||
362 | struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ | 419 | struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ |
363 | 420 | ||
421 | /* -- audio timestamp config -- */ | ||
422 | struct snd_pcm_audio_tstamp_config audio_tstamp_config; | ||
423 | struct snd_pcm_audio_tstamp_report audio_tstamp_report; | ||
424 | struct timespec driver_tstamp; | ||
425 | |||
364 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) | 426 | #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) |
365 | /* -- OSS things -- */ | 427 | /* -- OSS things -- */ |
366 | struct snd_pcm_oss_runtime oss; | 428 | struct snd_pcm_oss_runtime oss; |