18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * pcm_local.h - a local header file for snd-pcm module. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) Takashi Sakamoto <o-takashi@sakamocchi.jp> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __SOUND_CORE_PCM_LOCAL_H 98c2ecf20Sopenharmony_ci#define __SOUND_CORE_PCM_LOCAL_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciextern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_civoid snd_interval_mul(const struct snd_interval *a, 148c2ecf20Sopenharmony_ci const struct snd_interval *b, struct snd_interval *c); 158c2ecf20Sopenharmony_civoid snd_interval_div(const struct snd_interval *a, 168c2ecf20Sopenharmony_ci const struct snd_interval *b, struct snd_interval *c); 178c2ecf20Sopenharmony_civoid snd_interval_muldivk(const struct snd_interval *a, 188c2ecf20Sopenharmony_ci const struct snd_interval *b, 198c2ecf20Sopenharmony_ci unsigned int k, struct snd_interval *c); 208c2ecf20Sopenharmony_civoid snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, 218c2ecf20Sopenharmony_ci const struct snd_interval *b, struct snd_interval *c); 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciint snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, 248c2ecf20Sopenharmony_ci snd_pcm_hw_param_t var, u_int32_t mask); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciint pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream, 278c2ecf20Sopenharmony_ci snd_pcm_uframes_t appl_ptr); 288c2ecf20Sopenharmony_ciint snd_pcm_update_state(struct snd_pcm_substream *substream, 298c2ecf20Sopenharmony_ci struct snd_pcm_runtime *runtime); 308c2ecf20Sopenharmony_ciint snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream); 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_civoid snd_pcm_playback_silence(struct snd_pcm_substream *substream, 338c2ecf20Sopenharmony_ci snd_pcm_uframes_t new_hw_ptr); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic inline snd_pcm_uframes_t 368c2ecf20Sopenharmony_cisnd_pcm_avail(struct snd_pcm_substream *substream) 378c2ecf20Sopenharmony_ci{ 388c2ecf20Sopenharmony_ci if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 398c2ecf20Sopenharmony_ci return snd_pcm_playback_avail(substream->runtime); 408c2ecf20Sopenharmony_ci else 418c2ecf20Sopenharmony_ci return snd_pcm_capture_avail(substream->runtime); 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline snd_pcm_uframes_t 458c2ecf20Sopenharmony_cisnd_pcm_hw_avail(struct snd_pcm_substream *substream) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 488c2ecf20Sopenharmony_ci return snd_pcm_playback_hw_avail(substream->runtime); 498c2ecf20Sopenharmony_ci else 508c2ecf20Sopenharmony_ci return snd_pcm_capture_hw_avail(substream->runtime); 518c2ecf20Sopenharmony_ci} 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_PCM_TIMER 548c2ecf20Sopenharmony_civoid snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); 558c2ecf20Sopenharmony_civoid snd_pcm_timer_init(struct snd_pcm_substream *substream); 568c2ecf20Sopenharmony_civoid snd_pcm_timer_done(struct snd_pcm_substream *substream); 578c2ecf20Sopenharmony_ci#else 588c2ecf20Sopenharmony_cistatic inline void 598c2ecf20Sopenharmony_cisnd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {} 608c2ecf20Sopenharmony_cistatic inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {} 618c2ecf20Sopenharmony_cistatic inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {} 628c2ecf20Sopenharmony_ci#endif 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_civoid __snd_pcm_xrun(struct snd_pcm_substream *substream); 658c2ecf20Sopenharmony_civoid snd_pcm_group_init(struct snd_pcm_group *group); 668c2ecf20Sopenharmony_civoid snd_pcm_sync_stop(struct snd_pcm_substream *substream, bool sync_irq); 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_DMA_SGBUF 698c2ecf20Sopenharmony_cistruct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, 708c2ecf20Sopenharmony_ci unsigned long offset); 718c2ecf20Sopenharmony_ci#endif 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#endif /* __SOUND_CORE_PCM_LOCAL_H */ 76