diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2017-03-13 12:52:16 +0100 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-12-21 14:27:43 +0100 |
commit | 22494287e5cb3ad176834af96373ab8e6d5efef7 (patch) | |
tree | d889ca9f47553d7c7ef27a061d98b73d1f7af8e8 /sound | |
parent | 2eb79784a65c67562d5b93b49bac9313c469cd54 (diff) |
sgtl5000: switch on vag power for line_in -> output
The VAG power is switched off whenever there is no ADC or DAC activity
resulting in a non functional local loop from line in to headphone out.
Switch on VAG power or keep it on when line in gets directly connected
to the output.
TODO: when switching the muxer back to DAC switch the VAG power off
if no recording or playing is happening.
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
(cherry picked from commit 3e3ea9ba80e8bc9fe6896d6afe664ba3be904cd2)
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 1589325855bc..3044478aa0ea 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -164,6 +164,12 @@ static int power_vag_event(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMD: /* + * Don't clear VAG_POWERUP when there is a local loop + * from LINE_IN to the DAC. + */ + if (snd_soc_read(codec, SGTL5000_CHIP_ANA_CTRL) & (1<<6)) + break; + /* * Don't clear VAG_POWERUP, when both DAC and ADC are * operational to prevent inadvertently starving the * other one of them. @@ -221,7 +227,9 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), - SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), + SND_SOC_DAPM_MUX_E("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux, + power_vag_event, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_POST_PMD), /* aif for i2s input */ SND_SOC_DAPM_AIF_IN("AIFIN", "Playback", |