[PATCH] ASoC: wm8978: Support the recording function of codec

From: Mengchen Li
Date: Mon Sep 12 2022 - 04:25:01 EST


If we want to use the microphone function of the wm8978 codec,
we must enable the microphone bias circuit and power up the bias
circuit,otherwise the microphone can not vibrate for sound source
sampling.The bit that controls the output voltage of the bias circuit
is the fourth bit of the WM8978_POWER_MANAGEMENT_1 register,so this
bit must be set to 1.This patch can support the recording function of
the wm8978 codec.

Signed-off-by: Mengchen Li <mengchenli64@xxxxxxxxx>
---
sound/soc/codecs/wm8978.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index a682f80..fdd5429 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -822,7 +822,9 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,

snd_soc_component_write(component, WM8978_AUDIO_INTERFACE, iface_ctl);
snd_soc_component_write(component, WM8978_ADDITIONAL_CONTROL, add_ctl);
-
+ /* Enable MICBEN */
+ snd_soc_component_write(component, WM8978_POWER_MANAGEMENT_1,
+ snd_soc_component_read(component, WM8978_POWER_MANAGEMENT_1) | 0x10);
if (wm8978->sysclk != current_clk_id) {
if (wm8978->sysclk == WM8978_PLL)
/* Run CODEC from PLL instead of MCLK */
--
2.7.4