lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] ASoC: wm8940: Mute also the speaker output
Date
Without this change the BTL speaker produces some
"distortion" noise when test program
(speaker-test -t waw) is ended with ctrl+c.

As our design uses speaker outputs to drive BTL speaker,
it was necessary to also mute the speaker via the codec
internal WM8940_SPKVOL register with setting
WM8940_SPKMUTE bit.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
sound/soc/codecs/wm8940.c | 11 ++++++++++-
sound/soc/codecs/wm8940.h | 3 +++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 6fb1c3780439..a8596f4089dd 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -465,9 +465,18 @@ static int wm8940_mute(struct snd_soc_dai *dai, int mute, int direction)
{
struct snd_soc_component *component = dai->component;
u16 mute_reg = snd_soc_component_read(component, WM8940_DAC) & 0xffbf;
+ u16 spkvol_reg = snd_soc_component_read(component, WM8940_SPKVOL);
+ int ret;

- if (mute)
+ spkvol_reg &= ~WM8940_SPKMUTE;
+ if (mute) {
mute_reg |= 0x40;
+ spkvol_reg |= WM8940_SPKMUTE;
+ }
+
+ ret = snd_soc_component_write(component, WM8940_SPKVOL, spkvol_reg);
+ if (ret)
+ return ret;

return snd_soc_component_write(component, WM8940_DAC, mute_reg);
}
diff --git a/sound/soc/codecs/wm8940.h b/sound/soc/codecs/wm8940.h
index 0d4f53ada2e6..eb051ed29bb8 100644
--- a/sound/soc/codecs/wm8940.h
+++ b/sound/soc/codecs/wm8940.h
@@ -95,5 +95,8 @@ struct wm8940_setup_data {
#define WM8940_OPCLKDIV_3 2
#define WM8940_OPCLKDIV_4 3

+/* Bit definitions */
+#define WM8940_SPKMUTE BIT(6)
+
#endif /* _WM8940_H */

--
2.20.1
\
 
 \ /
  Last update: 2022-06-06 17:46    [W:0.597 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site