mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
ASoC: soc-dai: don't call PCM audio ops if the stream is not supported
PCM audio ops may be called when the stream is not supported. We should not call the ops in that case to avoid unexpected behavior. hw_params is handled already in soc-pcm.c [0] https://lore.kernel.org/alsa-devel/ae06b00a-f3f7-f9d1-0b58-4d71f3394416@linux.intel.com/T/#t Signed-off-by: Peter Suti <peter.suti@streamunlimited.com> Link: https://lore.kernel.org/r/20230713095258.3393827-1-peter.suti@streamunlimited.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
85d12eda23
commit
4005d1ba0a
1 changed files with 11 additions and 0 deletions
|
@ -424,6 +424,9 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!snd_soc_dai_stream_valid(dai, substream->stream))
|
||||
return 0;
|
||||
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->startup)
|
||||
ret = dai->driver->ops->startup(substream, dai);
|
||||
|
@ -439,6 +442,9 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
|
|||
struct snd_pcm_substream *substream,
|
||||
int rollback)
|
||||
{
|
||||
if (!snd_soc_dai_stream_valid(dai, substream->stream))
|
||||
return;
|
||||
|
||||
if (rollback && !soc_dai_mark_match(dai, substream, startup))
|
||||
return;
|
||||
|
||||
|
@ -603,6 +609,8 @@ int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream)
|
|||
int i, ret;
|
||||
|
||||
for_each_rtd_dais(rtd, i, dai) {
|
||||
if (!snd_soc_dai_stream_valid(dai, substream->stream))
|
||||
continue;
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->prepare) {
|
||||
ret = dai->driver->ops->prepare(substream, dai);
|
||||
|
@ -619,6 +627,9 @@ static int soc_dai_trigger(struct snd_soc_dai *dai,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!snd_soc_dai_stream_valid(dai, substream->stream))
|
||||
return 0;
|
||||
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->trigger)
|
||||
ret = dai->driver->ops->trigger(substream, cmd, dai);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue