Unverified Commit e9a45c8a authored by Mark Brown's avatar Mark Brown
Browse files

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
			}
		}
	}
+8 −2
Original line number Diff line number Diff line
@@ -934,21 +934,27 @@ 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;
				}
			}
		}

		data = dai->capture_dma_data;
		if (data) {
			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;
				}
			}
		}
	}

	return 0;
}