Commit f3fbb553 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: avs: Disconnect substream if suspend or resume fails

To improve performance and overall system stability, suspend/resume
operations for ASoC cards always return success status and defer the
actual work.

Because of that, if a substream fails to resume, userspace may still
attempt to invoke commands on it as from their perspective the operation
completed successfully. Set substream's state to DISCONNECTED to ensure
no further commands are attempted.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221116115550.1100398-3-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c30c8f9d
...@@ -934,21 +934,27 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be, ...@@ -934,21 +934,27 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
rtd = snd_pcm_substream_chip(data->substream); rtd = snd_pcm_substream_chip(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) { if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
ret = op(dai, data); ret = op(dai, data);
if (ret < 0) if (ret < 0) {
__snd_pcm_set_state(data->substream->runtime,
SNDRV_PCM_STATE_DISCONNECTED);
return ret; return ret;
} }
} }
}
data = dai->capture_dma_data; data = dai->capture_dma_data;
if (data) { if (data) {
rtd = snd_pcm_substream_chip(data->substream); rtd = snd_pcm_substream_chip(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) { if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
ret = op(dai, data); ret = op(dai, data);
if (ret < 0) if (ret < 0) {
__snd_pcm_set_state(data->substream->runtime,
SNDRV_PCM_STATE_DISCONNECTED);
return ret; return ret;
} }
} }
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment