ASoC: wm8974: add support enable/disable micbias during capturing

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Change-Id: I3696c0c73db6550795d192442d6bba41cea5086d
This commit is contained in:
Xing Zheng
2020-08-07 09:10:53 +08:00
committed by Tao Huang
parent 0ed2465002
commit ecbee1c72a

View File

@@ -613,6 +613,32 @@ static int wm8974_set_bias_level(struct snd_soc_component *component,
return 0;
}
static int wm8974_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *component = dai->component;
u16 power1 = snd_soc_component_read(component, WM8974_POWER1);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
power1 |= 0x10;
snd_soc_component_write(component, WM8974_POWER1, power1);
}
return 0;
}
static void wm8974_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *component = dai->component;
u16 power1 = snd_soc_component_read(component, WM8974_POWER1);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
power1 &= ~0x10;
snd_soc_component_write(component, WM8974_POWER1, power1);
}
}
#define WM8974_RATES (SNDRV_PCM_RATE_8000_48000)
#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
@@ -625,6 +651,8 @@ static const struct snd_soc_dai_ops wm8974_ops = {
.set_clkdiv = wm8974_set_dai_clkdiv,
.set_pll = wm8974_set_dai_pll,
.set_sysclk = wm8974_set_dai_sysclk,
.startup = wm8974_startup,
.shutdown = wm8974_shutdown,
.no_capture_mute = 1,
};