diff options
author | Mark Brown <broonie@kernel.org> | 2022-11-23 15:22:12 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-23 15:22:12 +0300 |
commit | e9a45c8aca0c83f61a7dffcbb996952919f4ae54 (patch) | |
tree | dfa2263f3bec4080768f22fc7b1f3644ac0ecb25 /sound/soc/intel | |
parent | 3115be55138afb9fb9ae1b4e99378da34bcfd164 (diff) | |
parent | f3fbb553f98563f692e356aca87d656baba910a0 (diff) | |
download | linux-e9a45c8aca0c83f61a7dffcbb996952919f4ae54.tar.xz |
ASoC: Intel: avs: DSP recovery and resume fixes
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:
Two fixes that are result of the recent discussions [1][2].
First adds missing locking around snd_pcm_stop() while the second fix
sets substream state to DISCONNECTED if any suspend/resume related
operation fails so that userspace has means to be aware that something
went wrong during said operation.
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/avs/ipc.c | 3 | ||||
-rw-r--r-- | sound/soc/intel/avs/pcm.c | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c index 152f8d0bdf8e..af8a260093f4 100644 --- a/sound/soc/intel/avs/ipc.c +++ b/sound/soc/intel/avs/ipc.c @@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev) if (!substream || !substream->runtime) continue; + /* No need for _irq() as we are in nonatomic context. */ + snd_pcm_stream_lock(substream); snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); + snd_pcm_stream_unlock(substream); } } } 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; + } } } } |