pcm.h (023265ed75d8792ca1d555430a8985511d3f8788) pcm.h (fcae40c99fb3d09f4407f549a7f17761abe5e1bc)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2#ifndef __SOUND_PCM_H
3#define __SOUND_PCM_H
4
5/*
6 * Digital Audio (PCM) abstract layer
7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
8 * Abramo Bagnara <abramo@alsa-project.org>

--- 48 unchanged lines hidden (view full) ---

57 int (*hw_params)(struct snd_pcm_substream *substream,
58 struct snd_pcm_hw_params *params);
59 int (*hw_free)(struct snd_pcm_substream *substream);
60 int (*prepare)(struct snd_pcm_substream *substream);
61 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
62 int (*sync_stop)(struct snd_pcm_substream *substream);
63 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
64 int (*get_time_info)(struct snd_pcm_substream *substream,
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2#ifndef __SOUND_PCM_H
3#define __SOUND_PCM_H
4
5/*
6 * Digital Audio (PCM) abstract layer
7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
8 * Abramo Bagnara <abramo@alsa-project.org>

--- 48 unchanged lines hidden (view full) ---

57 int (*hw_params)(struct snd_pcm_substream *substream,
58 struct snd_pcm_hw_params *params);
59 int (*hw_free)(struct snd_pcm_substream *substream);
60 int (*prepare)(struct snd_pcm_substream *substream);
61 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
62 int (*sync_stop)(struct snd_pcm_substream *substream);
63 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
64 int (*get_time_info)(struct snd_pcm_substream *substream,
65 struct timespec *system_ts, struct timespec *audio_ts,
65 struct timespec64 *system_ts, struct timespec64 *audio_ts,
66 struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
67 struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
68 int (*fill_silence)(struct snd_pcm_substream *substream, int channel,
69 unsigned long pos, unsigned long bytes);
70 int (*copy_user)(struct snd_pcm_substream *substream, int channel,
71 unsigned long pos, void __user *buf,
72 unsigned long bytes);
73 int (*copy_kernel)(struct snd_pcm_substream *substream, int channel,

--- 264 unchanged lines hidden (view full) ---

338 *data |= (tmp << 16);
339 *accuracy = report->accuracy;
340}
341
342
343struct snd_pcm_runtime {
344 /* -- Status -- */
345 struct snd_pcm_substream *trigger_master;
66 struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
67 struct snd_pcm_audio_tstamp_report *audio_tstamp_report);
68 int (*fill_silence)(struct snd_pcm_substream *substream, int channel,
69 unsigned long pos, unsigned long bytes);
70 int (*copy_user)(struct snd_pcm_substream *substream, int channel,
71 unsigned long pos, void __user *buf,
72 unsigned long bytes);
73 int (*copy_kernel)(struct snd_pcm_substream *substream, int channel,

--- 264 unchanged lines hidden (view full) ---

338 *data |= (tmp << 16);
339 *accuracy = report->accuracy;
340}
341
342
343struct snd_pcm_runtime {
344 /* -- Status -- */
345 struct snd_pcm_substream *trigger_master;
346 struct timespec trigger_tstamp; /* trigger timestamp */
346 struct timespec64 trigger_tstamp; /* trigger timestamp */
347 bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */
348 int overrange;
349 snd_pcm_uframes_t avail_max;
350 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
351 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
352 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
353 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
354 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */

--- 61 unchanged lines hidden (view full) ---

416 size_t dma_bytes; /* size of DMA area */
417
418 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
419 unsigned int buffer_changed:1; /* buffer allocation changed; set only in managed mode */
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;
347 bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */
348 int overrange;
349 snd_pcm_uframes_t avail_max;
350 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
351 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
352 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
353 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
354 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */

--- 61 unchanged lines hidden (view full) ---

416 size_t dma_bytes; /* size of DMA area */
417
418 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
419 unsigned int buffer_changed:1; /* buffer allocation changed; set only in managed mode */
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;
424 struct timespec64 driver_tstamp;
425
426#if IS_ENABLED(CONFIG_SND_PCM_OSS)
427 /* -- OSS things -- */
428 struct snd_pcm_oss_runtime oss;
429#endif
430};
431
432struct snd_pcm_group { /* keep linked substreams */

--- 717 unchanged lines hidden (view full) ---

1150 runtime->dma_buffer_p = NULL;
1151 runtime->dma_area = NULL;
1152 runtime->dma_addr = 0;
1153 runtime->dma_bytes = 0;
1154 }
1155}
1156
1157/**
425
426#if IS_ENABLED(CONFIG_SND_PCM_OSS)
427 /* -- OSS things -- */
428 struct snd_pcm_oss_runtime oss;
429#endif
430};
431
432struct snd_pcm_group { /* keep linked substreams */

--- 717 unchanged lines hidden (view full) ---

1150 runtime->dma_buffer_p = NULL;
1151 runtime->dma_area = NULL;
1152 runtime->dma_addr = 0;
1153 runtime->dma_bytes = 0;
1154 }
1155}
1156
1157/**
1158 * snd_pcm_gettime - Fill the timespec depending on the timestamp mode
1158 * snd_pcm_gettime - Fill the timespec64 depending on the timestamp mode
1159 * @runtime: PCM runtime instance
1159 * @runtime: PCM runtime instance
1160 * @tv: timespec to fill
1160 * @tv: timespec64 to fill
1161 */
1162static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
1161 */
1162static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
1163 struct timespec *tv)
1163 struct timespec64 *tv)
1164{
1165 switch (runtime->tstamp_type) {
1166 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC:
1164{
1165 switch (runtime->tstamp_type) {
1166 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC:
1167 ktime_get_ts(tv);
1167 ktime_get_ts64(tv);
1168 break;
1169 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
1168 break;
1169 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
1170 getrawmonotonic(tv);
1170 ktime_get_raw_ts64(tv);
1171 break;
1172 default:
1171 break;
1172 default:
1173 getnstimeofday(tv);
1173 ktime_get_real_ts64(tv);
1174 break;
1175 }
1176}
1177
1178/*
1179 * Memory
1180 */
1181

--- 244 unchanged lines hidden ---
1174 break;
1175 }
1176}
1177
1178/*
1179 * Memory
1180 */
1181

--- 244 unchanged lines hidden ---