@@ -355,33 +355,6 @@ static int mca_be_prepare(struct snd_pcm_substream *substream,
355355 return 0 ;
356356}
357357
358- static int mca_be_hw_free (struct snd_pcm_substream * substream ,
359- struct snd_soc_dai * dai )
360- {
361- struct mca_cluster * cl = mca_dai_to_cluster (dai );
362- struct mca_data * mca = cl -> host ;
363- struct mca_cluster * fe_cl ;
364-
365- if (cl -> port_driver < 0 )
366- return - EINVAL ;
367-
368- /*
369- * We are operating on a foreign cluster here, but since we
370- * belong to the same PCM, accesses should have been
371- * synchronized at ASoC level.
372- */
373- fe_cl = & mca -> clusters [cl -> port_driver ];
374- if (!mca_fe_clocks_in_use (fe_cl ))
375- return 0 ; /* Nothing to do */
376-
377- cl -> clocks_in_use [substream -> stream ] = false;
378-
379- if (!mca_fe_clocks_in_use (fe_cl ))
380- mca_fe_disable_clocks (fe_cl );
381-
382- return 0 ;
383- }
384-
385358static unsigned int mca_crop_mask (unsigned int mask , int nchans )
386359{
387360 while (hweight32 (mask ) > nchans )
@@ -779,6 +752,26 @@ static void mca_be_shutdown(struct snd_pcm_substream *substream,
779752 struct mca_cluster * cl = mca_dai_to_cluster (dai );
780753 struct mca_data * mca = cl -> host ;
781754
755+ if (cl -> clocks_in_use [substream -> stream ] &&
756+ !WARN_ON (cl -> port_driver < 0 )) {
757+ struct mca_cluster * fe_cl = & mca -> clusters [cl -> port_driver ];
758+
759+ /*
760+ * Typically the CODECs we are paired with will require clocks
761+ * to be present at time of mute with the 'mute_stream' op.
762+ * We need to disable the clocks here at the earliest (hw_free
763+ * would be too early).
764+ *
765+ * We are operating on a foreign cluster here, but since we
766+ * belong to the same PCM, accesses should have been
767+ * synchronized at ASoC level.
768+ */
769+ cl -> clocks_in_use [substream -> stream ] = false;
770+
771+ if (!mca_fe_clocks_in_use (fe_cl ))
772+ mca_fe_disable_clocks (fe_cl );
773+ }
774+
782775 cl -> port_started [substream -> stream ] = false;
783776
784777 if (!mca_be_started (cl )) {
@@ -796,7 +789,6 @@ static void mca_be_shutdown(struct snd_pcm_substream *substream,
796789
797790static const struct snd_soc_dai_ops mca_be_ops = {
798791 .prepare = mca_be_prepare ,
799- .hw_free = mca_be_hw_free ,
800792 .startup = mca_be_startup ,
801793 .shutdown = mca_be_shutdown ,
802794};
0 commit comments