Skip to contentSkip to conversation

ASoC: atmel: mchp-pdmc: Clear busy_stream in hw_free()

PATCH New [email protected] 1 participant 1 message Nov 16

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: atmel: mchp-pdmc: Clear busy_stream in hw_free()

From: bui duc phuc <[email protected]>

busy_stream is set in hw_params() but only cleared in remove(), so the "Audio Filter" and "SINC Filter Order" controls keep returning -EBUSY after the first hw_params().

Add a hw_free() callback that clears busy_stream, to balance hw_params(), and drop the reset from remove().

Fixes 2ed1a4a5c005 ("ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls")
---
 sound/soc/atmel/mchp-pdmc.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
sound/soc/atmel/mchp-pdmc.c +10 -2
index 039b2eba0d9d..8b55d864f3d5 100644
@@ -614,6 +614,15 @@ static int mchp_pdmc_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
+static int mchp_pdmc_hw_free(struct snd_pcm_substream *substream,
+			     struct snd_soc_dai *dai)
+{
+	struct mchp_pdmc *dd = snd_soc_dai_get_drvdata(dai);
+
+	atomic_set(&dd->busy_stream, 0);
+	return 0;
+}
+
 static void mchp_pdmc_noise_filter_workaround(struct mchp_pdmc *dd)
 {
 	u32 tmp, steps = 16;
@@ -748,6 +757,7 @@ static const struct snd_soc_dai_ops mchp_pdmc_dai_ops = {
 	.set_fmt	= mchp_pdmc_set_fmt,
 	.startup	= mchp_pdmc_startup,
 	.hw_params	= mchp_pdmc_hw_params,
+	.hw_free	= mchp_pdmc_hw_free,
 	.trigger	= mchp_pdmc_trigger,
 	.pcm_new	= &mchp_pdmc_pcm_new,
 	.auto_selectable_formats	= &mchp_selectable_formats,
@@ -1121,8 +1131,6 @@ static void mchp_pdmc_remove(struct platform_device *pdev)
 {
 	struct mchp_pdmc *dd = platform_get_drvdata(pdev);
 
-	atomic_set(&dd->busy_stream, 0);
-
 	if (!pm_runtime_status_suspended(dd->dev))
 		mchp_pdmc_runtime_suspend(dd->dev);
 
Signature · 1 line
2.43.0