forked from luck/tmp_suning_uos_patched
6bcf443bce
commit 29bb274e94974669acb5186a75538f20df1508b6 upstream.
The PCM core should perform the sync for the pending stop operations
at disconnection. Otherwise it may lead to unexpected access.
Currently the old user of sync_stop, USB-audio driver, has its own
sync, so this isn't needed, but it's better to guarantee the sync in
the PCM core level.
This patch adds the missing sync_stop call at PCM disconnection
callback. It also assures the IRQ sync if it's specified in the
card. snd_pcm_sync_stop() is slightly modified to be called also for
any PCM substream object now.
Fixes: 1e850beea2
("ALSA: pcm: Add the support for sync-stop operation")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210206203656.15959-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
76 lines
2.7 KiB
C
76 lines
2.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* pcm_local.h - a local header file for snd-pcm module.
|
|
*
|
|
* Copyright (c) Takashi Sakamoto <o-takashi@sakamocchi.jp>
|
|
*/
|
|
|
|
#ifndef __SOUND_CORE_PCM_LOCAL_H
|
|
#define __SOUND_CORE_PCM_LOCAL_H
|
|
|
|
extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;
|
|
|
|
void snd_interval_mul(const struct snd_interval *a,
|
|
const struct snd_interval *b, struct snd_interval *c);
|
|
void snd_interval_div(const struct snd_interval *a,
|
|
const struct snd_interval *b, struct snd_interval *c);
|
|
void snd_interval_muldivk(const struct snd_interval *a,
|
|
const struct snd_interval *b,
|
|
unsigned int k, struct snd_interval *c);
|
|
void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
|
|
const struct snd_interval *b, struct snd_interval *c);
|
|
|
|
int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime,
|
|
snd_pcm_hw_param_t var, u_int32_t mask);
|
|
|
|
int pcm_lib_apply_appl_ptr(struct snd_pcm_substream *substream,
|
|
snd_pcm_uframes_t appl_ptr);
|
|
int snd_pcm_update_state(struct snd_pcm_substream *substream,
|
|
struct snd_pcm_runtime *runtime);
|
|
int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
|
|
|
|
void snd_pcm_playback_silence(struct snd_pcm_substream *substream,
|
|
snd_pcm_uframes_t new_hw_ptr);
|
|
|
|
static inline snd_pcm_uframes_t
|
|
snd_pcm_avail(struct snd_pcm_substream *substream)
|
|
{
|
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
|
return snd_pcm_playback_avail(substream->runtime);
|
|
else
|
|
return snd_pcm_capture_avail(substream->runtime);
|
|
}
|
|
|
|
static inline snd_pcm_uframes_t
|
|
snd_pcm_hw_avail(struct snd_pcm_substream *substream)
|
|
{
|
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
|
return snd_pcm_playback_hw_avail(substream->runtime);
|
|
else
|
|
return snd_pcm_capture_hw_avail(substream->runtime);
|
|
}
|
|
|
|
#ifdef CONFIG_SND_PCM_TIMER
|
|
void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
|
|
void snd_pcm_timer_init(struct snd_pcm_substream *substream);
|
|
void snd_pcm_timer_done(struct snd_pcm_substream *substream);
|
|
#else
|
|
static inline void
|
|
snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream) {}
|
|
static inline void snd_pcm_timer_init(struct snd_pcm_substream *substream) {}
|
|
static inline void snd_pcm_timer_done(struct snd_pcm_substream *substream) {}
|
|
#endif
|
|
|
|
void __snd_pcm_xrun(struct snd_pcm_substream *substream);
|
|
void snd_pcm_group_init(struct snd_pcm_group *group);
|
|
void snd_pcm_sync_stop(struct snd_pcm_substream *substream, bool sync_irq);
|
|
|
|
#ifdef CONFIG_SND_DMA_SGBUF
|
|
struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
|
|
unsigned long offset);
|
|
#endif
|
|
|
|
#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
|
|
|
|
#endif /* __SOUND_CORE_PCM_LOCAL_H */
|