Unverified Commit e9141c1a authored by Oder Chiou's avatar Oder Chiou Committed by Mark Brown
Browse files

ASoC: rt5645: Remove the redundant delay time



This patch removes the redundant delay time to speed up from the cold start
of headphone playback.

Signed-off-by: default avatarOder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20201230080235.12698-1-oder_chiou@realtek.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 89ffd36a
Loading
Loading
Loading
Loading
+8 −25
Original line number Diff line number Diff line
@@ -435,7 +435,6 @@ struct rt5645_priv {

	int jack_type;
	bool en_button_func;
	bool hp_on;
	int v_id;
};

@@ -1645,6 +1644,7 @@ static void hp_amp_power(struct snd_soc_component *component, int on)
{
	static int hp_amp_power_count;
	struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
	int i, val;

	if (on) {
		if (hp_amp_power_count <= 0) {
@@ -1655,7 +1655,13 @@ static void hp_amp_power(struct snd_soc_component *component, int on)
				snd_soc_component_write(component, RT5645_DEPOP_M1, 0x000d);
				regmap_write(rt5645->regmap, RT5645_PR_BASE +
					RT5645_HP_DCC_INT1, 0x9f01);
				msleep(20);
				for (i = 0; i < 20; i++) {
					usleep_range(1000, 1500);
					regmap_read(rt5645->regmap, RT5645_PR_BASE +
						RT5645_HP_DCC_INT1, &val);
					if (!(val & 0x8000))
						break;
				}
				snd_soc_component_update_bits(component, RT5645_DEPOP_M1,
					RT5645_HP_CO_MASK, RT5645_HP_CO_EN);
				regmap_write(rt5645->regmap, RT5645_PR_BASE +
@@ -1665,7 +1671,6 @@ static void hp_amp_power(struct snd_soc_component *component, int on)
					RT5645_MAMP_INT_REG2, 0xfc00);
				snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140);
				msleep(90);
				rt5645->hp_on = true;
			} else {
				/* depop parameters */
				snd_soc_component_update_bits(component, RT5645_DEPOP_M2,
@@ -1885,27 +1890,6 @@ static int rt5645_bst2_event(struct snd_soc_dapm_widget *w,
	return 0;
}

static int rt5650_hp_event(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *k, int  event)
{
	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
	struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		if (rt5645->hp_on) {
			msleep(100);
			rt5645->hp_on = false;
		}
		break;

	default:
		return 0;
	}

	return 0;
}

static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *k, int  event)
{
@@ -2242,7 +2226,6 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
	SND_SOC_DAPM_OUTPUT("PDM1R"),
	SND_SOC_DAPM_OUTPUT("SPOL"),
	SND_SOC_DAPM_OUTPUT("SPOR"),
	SND_SOC_DAPM_POST("DAPM_POST", rt5650_hp_event),
};

static const struct snd_soc_dapm_widget rt5645_specific_dapm_widgets[] = {