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

Commit 09b3c696 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

ASoC: wcd937x: Fix CnP when compander is disabled



Pop noise is observed at teardown when compander
is disabled. Allow proper delay after PA disable
to resolve the pop.

Change-Id: I15efa08f28bc1dd32e39b3ca1311b1e417199fd3
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 733128bb
Loading
Loading
Loading
Loading
+33 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, 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
@@ -660,9 +660,24 @@ static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
					     WCD_EVENT_PRE_HPHR_PA_OFF,
					     &wcd937x->mbhc->wcd_mbhc);
		set_bit(HPH_PA_DELAY, &wcd937x->status_mask);
		break;
	case SND_SOC_DAPM_POST_PMD:
		usleep_range(7000, 7010);
		/*
		 * 7ms sleep is required after PA is disabled as per
		 * HW requirement. If compander is disabled, then
		 * 20ms delay is required.
		 */
		if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) {
			if (!wcd937x->comp2_enable)
				usleep_range(20000, 20100);
			else
				usleep_range(7000, 7100);
			clear_bit(HPH_PA_DELAY, &wcd937x->status_mask);
		}

		snd_soc_update_bits(codec, WCD937X_DIGITAL_PDM_WD_CTL1,
				    0x17, 0x00);
		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
					     WCD_EVENT_POST_HPHR_PA_OFF,
					     &wcd937x->mbhc->wcd_mbhc);
@@ -733,9 +748,24 @@ static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
					     WCD_EVENT_PRE_HPHL_PA_OFF,
					     &wcd937x->mbhc->wcd_mbhc);
		set_bit(HPH_PA_DELAY, &wcd937x->status_mask);
		break;
	case SND_SOC_DAPM_POST_PMD:
		usleep_range(7000, 7010);
		/*
		 * 7ms sleep is required after PA is disabled as per
		 * HW requirement. If compander is disabled, then
		 * 20ms delay is required.
		 */
		if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) {
			if (!wcd937x->comp1_enable)
				usleep_range(20000, 20100);
			else
				usleep_range(7000, 7100);
			clear_bit(HPH_PA_DELAY, &wcd937x->status_mask);
		}

		snd_soc_update_bits(codec, WCD937X_DIGITAL_PDM_WD_CTL0,
				    0x17, 0x00);
		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
					     WCD_EVENT_POST_HPHL_PA_OFF,
					     &wcd937x->mbhc->wcd_mbhc);