[PATCH] ASoC: wm8978: Support the recording function of codec
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@gmail.com --- 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 */
On Mon, Sep 12, 2022 at 04:23:05PM +0800, Mengchen Li wrote:
@@ -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);
This should be done by creating a supply widget for the MICBIAS which will be connected by the machine driver to the microphone widget. This will mean that the MICBIAS is only enabled when it's actively being used which saves power. Look for MICBIAS widgets in other CODEC drivers for examples.
participants (2)
-
Mark Brown
-
Mengchen Li