From 11a2b192e0a8b7514895f9f6b7451f4c6ddd0a22 Mon Sep 17 00:00:00 2001
From: Matt Flax <flatmax@flatmax.org>
Date: Fri, 17 Jul 2020 09:17:36 +1000
Subject: [PATCH] Mute bug fix for the Audioinjector.net isolated
 soundcard.

---
 .../bcm/audioinjector-isolated-soundcard.c    | 26 +++----------------
 1 file changed, 3 insertions(+), 23 deletions(-)

--- a/sound/soc/bcm/audioinjector-isolated-soundcard.c
+++ b/sound/soc/bcm/audioinjector-isolated-soundcard.c
@@ -42,41 +42,20 @@ static int audioinjector_isolated_dai_in
 	int ret=snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 24576000, 0);
 	if (ret)
 		return ret;
-
 	return snd_soc_dai_set_bclk_ratio(rtd->cpu_dai, 64);
 }
 
 static int audioinjector_isolated_startup(struct snd_pcm_substream *substream)
 {
 	snd_pcm_hw_constraint_list(substream->runtime, 0,
-				SNDRV_PCM_HW_PARAM_RATE, &audioinjector_isolated_constraints);
-
-	return 0;
-}
+			SNDRV_PCM_HW_PARAM_RATE, &audioinjector_isolated_constraints);
 
-static int audioinjector_isolated_trigger(struct snd_pcm_substream *substream,
-								int cmd){
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_STOP:
-	case SNDRV_PCM_TRIGGER_SUSPEND:
-	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		gpiod_set_value(mute_gpio, 0);
-		break;
-	case SNDRV_PCM_TRIGGER_START:
-	case SNDRV_PCM_TRIGGER_RESUME:
-	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		gpiod_set_value(mute_gpio, 1);
-		break;
-	default:
-		return -EINVAL;
-	}
+	gpiod_set_value(mute_gpio, 1);
 	return 0;
 }
 
 static struct snd_soc_ops audioinjector_isolated_ops = {
 	.startup	= audioinjector_isolated_startup,
-	.trigger = audioinjector_isolated_trigger,
 };
 
 SND_SOC_DAILINK_DEFS(audioinjector_isolated,
@@ -153,6 +132,7 @@ static int audioinjector_isolated_probe(
 			dev_err(&pdev->dev, "mute gpio not found in dt overlay\n");
 			return PTR_ERR(mute_gpio);
 		}
+		gpiod_set_value(mute_gpio, 0);
 	}
 
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
