hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/sound/soc/soc-pcm.c
....@@ -2336,6 +2336,9 @@
23362336 if (!snd_soc_dpcm_be_can_update(fe, be, stream))
23372337 continue;
23382338
2339
+ if (!snd_soc_dpcm_can_be_prepared(fe, be, stream))
2340
+ continue;
2341
+
23392342 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
23402343 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
23412344 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) &&
....@@ -2978,3 +2981,20 @@
29782981 return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state));
29792982 }
29802983 EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
2984
+
2985
+/*
2986
+ * We can only prepare a BE DAI if any of it's FE are not prepared,
2987
+ * running or paused for the specified stream direction.
2988
+ */
2989
+int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe,
2990
+ struct snd_soc_pcm_runtime *be, int stream)
2991
+{
2992
+ const enum snd_soc_dpcm_state state[] = {
2993
+ SND_SOC_DPCM_STATE_START,
2994
+ SND_SOC_DPCM_STATE_PAUSED,
2995
+ SND_SOC_DPCM_STATE_PREPARE,
2996
+ };
2997
+
2998
+ return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state));
2999
+}
3000
+EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_prepared);