diff mbox series

[v2,2/2] ASoC: wm8524: Correct the MUTE setting while power up/down

Message ID 20230227091938.1671416-2-chancel.liu@nxp.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] ASoC: dt-bindings: wlf,wm8524: Convert to json-schema | expand

Commit Message

Chancel Liu Feb. 27, 2023, 9:19 a.m. UTC
wm8524 should be unmuted while power up and muted while power down.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
---
 sound/soc/codecs/wm8524.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown March 1, 2023, 9:07 p.m. UTC | #1
On Mon, Feb 27, 2023 at 05:19:38PM +0800, Chancel Liu wrote:

> wm8524 should be unmuted while power up and muted while power down.

> @@ -75,7 +75,7 @@ static int wm8524_startup(struct snd_pcm_substream *substream,
>  				   SNDRV_PCM_HW_PARAM_RATE,
>  				   &wm8524->rate_constraint);
>  
> -	gpiod_set_value_cansleep(wm8524->mute, 1);
> +	gpiod_set_value_cansleep(wm8524->mute, 0);
>  
>  	return 0;
>  }

I *think* the theory with these is that the device should be muted by
default so that any noise during startup is minimised, and only unmuted
when there's an actual audio stream, done in wm8524_mute_stream().  I am
unclear why this default state is set up in startup(), or why we unmute
in shutdown().  It could be that the startup thing is trying to work
around some suspend/resume thing?  In any case I'm not sure this helps,
I think really we should just not be managing the GPIO in these
functions at all and setting the default state to be muted when the GPIO
is requested.  With this change we'd move the unmute _mute_stream() does
much earlier, meaning that any noise output by the SoC during startup
will get played.
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm8524.c b/sound/soc/codecs/wm8524.c
index b56dcac60244..8f2130e05b32 100644
--- a/sound/soc/codecs/wm8524.c
+++ b/sound/soc/codecs/wm8524.c
@@ -75,7 +75,7 @@  static int wm8524_startup(struct snd_pcm_substream *substream,
 				   SNDRV_PCM_HW_PARAM_RATE,
 				   &wm8524->rate_constraint);
 
-	gpiod_set_value_cansleep(wm8524->mute, 1);
+	gpiod_set_value_cansleep(wm8524->mute, 0);
 
 	return 0;
 }
@@ -86,7 +86,7 @@  static void wm8524_shutdown(struct snd_pcm_substream *substream,
 	struct snd_soc_component *component = dai->component;
 	struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
 
-	gpiod_set_value_cansleep(wm8524->mute, 0);
+	gpiod_set_value_cansleep(wm8524->mute, 1);
 }
 
 static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,