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

Commit a4e8864f authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

ASoC: wcd934x: Add delay during headphone path bringup and teardown



When compander is disabled, headphone power amplifiers
need more delay to ramp up and ramp down. Add a delay
to avoid pop noise during headphone path bringup and teardown.

Change-Id: I74d834d5096535c124083f3e24ccb493a86cbbd5
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent 2dc96b1c
Loading
Loading
Loading
Loading
+33 −9
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, 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
@@ -1923,9 +1923,13 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
	case SND_SOC_DAPM_POST_PMU:
		/*
		 * 7ms sleep is required after PA is enabled as per
		 * HW requirement
		 * HW requirement. If compander is disabled, then
		 * 20ms delay is needed.
		 */
		if (test_bit(HPH_PA_DELAY, &tavil->status_mask)) {
			if (!tavil->comp_enabled[COMPANDER_2])
				usleep_range(20000, 20100);
			else
				usleep_range(7000, 7100);
			clear_bit(HPH_PA_DELAY, &tavil->status_mask);
		}
@@ -1965,9 +1969,17 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
		snd_soc_update_bits(codec, WCD934X_HPH_R_TEST, 0x01, 0x00);
		snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_CTL,
				    0x10, 0x10);
		snd_soc_update_bits(codec, WCD934X_CDC_RX2_RX_PATH_MIX_CTL,
				    0x10, 0x10);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 5ms sleep is required after PA disable */
		/*
		 * 5ms sleep is required after PA disable. If compander is
		 * disabled, then 20ms delay is needed after PA disable.
		 */
		if (!tavil->comp_enabled[COMPANDER_2])
			usleep_range(20000, 20100);
		else
			usleep_range(5000, 5100);
		tavil_codec_override(codec, tavil->hph_mode, event);
		blocking_notifier_call_chain(&tavil->mbhc->notifier,
@@ -2008,9 +2020,13 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
	case SND_SOC_DAPM_POST_PMU:
		/*
		 * 7ms sleep is required after PA is enabled as per
		 * HW requirement
		 * HW requirement. If compander is disabled, then
		 * 20ms delay is needed.
		 */
		if (test_bit(HPH_PA_DELAY, &tavil->status_mask)) {
			if (!tavil->comp_enabled[COMPANDER_1])
				usleep_range(20000, 20100);
			else
				usleep_range(7000, 7100);
			clear_bit(HPH_PA_DELAY, &tavil->status_mask);
		}
@@ -2049,9 +2065,17 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
		snd_soc_update_bits(codec, WCD934X_HPH_L_TEST, 0x01, 0x00);
		snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_CTL,
				    0x10, 0x10);
		snd_soc_update_bits(codec, WCD934X_CDC_RX1_RX_PATH_MIX_CTL,
				    0x10, 0x10);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/* 5ms sleep is required after PA disable */
		/*
		 * 5ms sleep is required after PA disable. If compander is
		 * disabled, then 20ms delay is needed after PA disable.
		 */
		if (!tavil->comp_enabled[COMPANDER_1])
			usleep_range(20000, 20100);
		else
			usleep_range(5000, 5100);
		tavil_codec_override(codec, tavil->hph_mode, event);
		blocking_notifier_call_chain(&tavil->mbhc->notifier,