1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * pcm_local.h - a local header file for snd-pcm module.
5 * Copyright (c) Takashi Sakamoto <o-takashi@sakamocchi.jp>
8 #ifndef __SOUND_CORE_PCM_LOCAL_H
9 #define __SOUND_CORE_PCM_LOCAL_H
11 extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;
13 void snd_interval_mul(const struct snd_interval *a,
14 const struct snd_interval *b, struct snd_interval *c);
15 void snd_interval_div(const struct snd_interval *a,
16 const struct snd_interval *b, struct snd_interval *c);
17 void snd_interval_muldivk(const struct snd_interval *a,
18 const struct snd_interval *b,
19 unsigned int k, struct snd_interval *c);
20 void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
21 const struct snd_interval *b, struct snd_interval *c);
23 int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime,
24 snd_pcm_hw_param_t var, u_int32_t mask);
26 int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
27 snd_pcm_uframes_t appl_ptr);
28 int snd_pcm_update_state(struct snd_pcm_substream *substream,
29 struct snd_pcm_runtime *runtime);
30 int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
32 void snd_pcm_playback_silence(struct snd_pcm_substream *substream,
33 snd_pcm_uframes_t new_hw_ptr);
35 static inline snd_pcm_uframes_t
36 snd_pcm_avail(struct snd_pcm_substream *substream)
38 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
39 return snd_pcm_playback_avail(substream->runtime);
41 return snd_pcm_capture_avail(substream->runtime);
44 static inline snd_pcm_uframes_t
45 snd_pcm_hw_avail(struct snd_pcm_substream *substream)
47 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
48 return snd_pcm_playback_hw_avail(substream->runtime);
50 return snd_pcm_capture_hw_avail(substream->runtime);
53 #ifdef CONFIG_SND_PCM_TIMER
54 void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
55 void snd_pcm_timer_init(struct snd_pcm_substream *substream);
56 void snd_pcm_timer_done(struct snd_pcm_substream *substream);
59 snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {}
60 static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {}
61 static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {}
64 void __snd_pcm_xrun(struct snd_pcm_substream *substream);
65 void snd_pcm_group_init(struct snd_pcm_group *group);
67 #ifdef CONFIG_SND_DMA_SGBUF
68 struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
69 unsigned long offset);
72 #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
74 #endif /* __SOUND_CORE_PCM_LOCAL_H */