summaryrefslogtreecommitdiff
path: root/sound/soc/intel
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-11-16 14:55:50 +0300
committerMark Brown <broonie@kernel.org>2022-11-22 22:32:27 +0300
commitf3fbb553f98563f692e356aca87d656baba910a0 (patch)
tree51efbeb76e23cf5a22f9fcb36050065338f35379 /sound/soc/intel
parentc30c8f9d51ec24b36e2c65a6307a5c8cbc5a0ebc (diff)
downloadlinux-f3fbb553f98563f692e356aca87d656baba910a0.tar.xz
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: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221116115550.1100398-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r--sound/soc/intel/avs/pcm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index b4e7514f8789..70d687fa9923 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -934,8 +934,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
rtd = snd_pcm_substream_chip(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
ret = op(dai, data);
- if (ret < 0)
+ if (ret < 0) {
+ __snd_pcm_set_state(data->substream->runtime,
+ SNDRV_PCM_STATE_DISCONNECTED);
return ret;
+ }
}
}
@@ -944,8 +947,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
rtd = snd_pcm_substream_chip(data->substream);
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
ret = op(dai, data);
- if (ret < 0)
+ if (ret < 0) {
+ __snd_pcm_set_state(data->substream->runtime,
+ SNDRV_PCM_STATE_DISCONNECTED);
return ret;
+ }
}
}
}