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

Commit 1068ccd4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd9335: fix pop during CLS-AB mode"

parents 8a1bf61f 5780614c
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3664,6 +3664,28 @@ static void tasha_codec_hph_post_pa_config(struct tasha_priv *tasha,
	}
}

static void tasha_codec_override(struct snd_soc_codec *codec,
				 int mode,
				 int event)
{
	if (mode == CLS_AB) {
		switch (event) {
		case SND_SOC_DAPM_POST_PMU:
			if (!(snd_soc_read(codec,
					WCD9335_CDC_RX2_RX_PATH_CTL) & 0x10) &&
				(!(snd_soc_read(codec,
					WCD9335_CDC_RX1_RX_PATH_CTL) & 0x10)))
				snd_soc_update_bits(codec,
					WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x02);
		break;
		case SND_SOC_DAPM_POST_PMD:
			snd_soc_update_bits(codec,
				WCD9XXX_A_ANA_RX_SUPPLIES, 0x02, 0x00);
		break;
		}
	}
}

static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
				      struct snd_kcontrol *kcontrol,
				      int event)
@@ -3697,6 +3719,7 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec,
					    WCD9335_CDC_RX2_RX_PATH_MIX_CTL,
					    0x10, 0x00);
		tasha_codec_override(codec, hph_mode, event);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		blocking_notifier_call_chain(&tasha->notifier,
@@ -3709,6 +3732,7 @@ static int tasha_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
		 * HW requirement
		 */
		usleep_range(5000, 5500);
		tasha_codec_override(codec, hph_mode, event);
		blocking_notifier_call_chain(&tasha->notifier,
					WCD_EVENT_POST_HPHR_PA_OFF,
					&tasha->mbhc);
@@ -3758,6 +3782,7 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec,
					    WCD9335_CDC_RX1_RX_PATH_MIX_CTL,
					    0x10, 0x00);
		tasha_codec_override(codec, hph_mode, event);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		blocking_notifier_call_chain(&tasha->notifier,
@@ -3770,6 +3795,7 @@ static int tasha_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		 * HW requirement
		 */
		usleep_range(5000, 5500);
		tasha_codec_override(codec, hph_mode, event);
		blocking_notifier_call_chain(&tasha->notifier,
					WCD_EVENT_POST_HPHL_PA_OFF,
					&tasha->mbhc);
@@ -3830,12 +3856,14 @@ static int tasha_codec_enable_lineout_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec,
					    lineout_mix_vol_reg,
					    0x10, 0x00);
		tasha_codec_override(codec, CLS_AB, event);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 5ms sleep is required after PA is disabled as per
		 * HW requirement
		 */
		usleep_range(5000, 5500);
		tasha_codec_override(codec, CLS_AB, event);
		if (!(strcmp(w->name, "ANC LINEOUT1 PA")) ||
			!(strcmp(w->name, "ANC LINEOUT2 PA"))) {
			ret = tasha_codec_enable_anc(w, kcontrol, event);
+3 −7
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -348,10 +348,6 @@ static void wcd_clsh_set_flyback_current(struct snd_soc_codec *codec, int mode)
static void wcd_clsh_set_buck_regulator_mode(struct snd_soc_codec *codec,
					     int mode)
{
	if (mode == CLS_AB)
		snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
				    0x02, 0x02);
	else
	snd_soc_update_bits(codec, WCD9XXX_A_ANA_RX_SUPPLIES,
			    0x02, 0x00);
}