Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f091f3f0 authored by Lothar Waßmann's avatar Lothar Waßmann Committed by Mark Brown
Browse files

ASoC: sgtl5000: prevent playback to be muted when terminating concurrent capture



When a sound capture/playback is terminated while a playback/capture
is running, power_vag_event() will clear SGTL5000_CHIP_ANA_POWER in
the SND_SOC_DAPM_PRE_PMD event, thus muting the respective other
channel.

Don't clear SGTL5000_CHIP_ANA_POWER when both DAC and ADC are active
to prevent this.

Signed-off-by: default avatarLothar Waßmann <LW@KARO-electronics.de>
Reviewed-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 5ae90d8e
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -153,6 +153,8 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
static int power_vag_event(struct snd_soc_dapm_widget *w,
static int power_vag_event(struct snd_soc_dapm_widget *w,
	struct snd_kcontrol *kcontrol, int event)
	struct snd_kcontrol *kcontrol, int event)
{
{
	const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;

	switch (event) {
	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
	case SND_SOC_DAPM_POST_PMU:
		snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
		snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
@@ -160,9 +162,17 @@ static int power_vag_event(struct snd_soc_dapm_widget *w,
		break;
		break;


	case SND_SOC_DAPM_PRE_PMD:
	case SND_SOC_DAPM_PRE_PMD:
		/*
		 * Don't clear VAG_POWERUP, when both DAC and ADC are
		 * operational to prevent inadvertently starving the
		 * other one of them.
		 */
		if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) &
				mask) != mask) {
			snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
			snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
				SGTL5000_VAG_POWERUP, 0);
				SGTL5000_VAG_POWERUP, 0);
			msleep(400);
			msleep(400);
		}
		break;
		break;
	default:
	default:
		break;
		break;