Commit e9a45c8a authored by Mark Brown's avatar Mark Brown

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.
parents 3115be55 f3fbb553
...@@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev) ...@@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev)
if (!substream || !substream->runtime) if (!substream || !substream->runtime)
continue; 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_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
snd_pcm_stream_unlock(substream);
} }
} }
} }
......
...@@ -934,8 +934,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be, ...@@ -934,8 +934,11 @@ 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;
}
} }
} }
...@@ -944,8 +947,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be, ...@@ -944,8 +947,11 @@ 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;
}
} }
} }
} }
......
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