@@ -317,6 +317,7 @@ static void intel_ace2x_bpt_close_stream(struct sdw_intel *sdw, struct sdw_slave
317317 dev_err (cdns -> dev , "%s: remove slave failed: %d\n" ,
318318 __func__ , ret );
319319
320+ sdw_release_stream (cdns -> bus .bpt_stream );
320321 cdns -> bus .bpt_stream = NULL ;
321322}
322323
@@ -894,19 +895,6 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
894895 }
895896
896897 switch (cmd ) {
897- case SNDRV_PCM_TRIGGER_SUSPEND :
898-
899- /*
900- * The .prepare callback is used to deal with xruns and resume operations.
901- * In the case of xruns, the DMAs and SHIM registers cannot be touched,
902- * but for resume operations the DMAs and SHIM registers need to be initialized.
903- * the .trigger callback is used to track the suspend case only.
904- */
905-
906- dai_runtime -> suspended = true;
907-
908- break ;
909-
910898 case SNDRV_PCM_TRIGGER_PAUSE_PUSH :
911899 dai_runtime -> paused = true;
912900 break ;
@@ -930,8 +918,34 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
930918 .get_stream = intel_get_sdw_stream ,
931919};
932920
921+ static int intel_component_dais_suspend (struct snd_soc_component * component )
922+ {
923+ struct snd_soc_dai * dai ;
924+
925+ /*
926+ * Mark all open streams as suspended.
927+ * Open streams at this point can be in SUSPENDED, PAUSED or STOPPED
928+ * state and during prepare the DMAs and SHIM registers need to be
929+ * initialized for them.
930+ * The STOPPED state is a special corner case which can happen if audio
931+ * experiences xrun at suspend time.
932+ */
933+ for_each_component_dais (component , dai ) {
934+ struct sdw_cdns * cdns = snd_soc_dai_get_drvdata (dai );
935+ struct sdw_cdns_dai_runtime * dai_runtime ;
936+
937+ dai_runtime = cdns -> dai_runtime_array [dai -> id ];
938+
939+ if (dai_runtime )
940+ dai_runtime -> suspended = true;
941+ }
942+
943+ return 0 ;
944+ }
945+
933946static const struct snd_soc_component_driver dai_component = {
934947 .name = "soundwire" ,
948+ .suspend = intel_component_dais_suspend ,
935949};
936950
937951/*
0 commit comments