Unverified Commit 6108f990 authored by Shuming Fan's avatar Shuming Fan Committed by Mark Brown
Browse files

ASoC: rt711: mutex between calibration and power state changes



To avoid calibration time-out, this patch adds the mutex between calibration and power state changes

Signed-off-by: default avatarShuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20201217085651.24580-1-shumingf@realtek.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent bb224c3e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -462,6 +462,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
	unsigned int read_ll, read_rl;
	int i;

	mutex_lock(&rt711->calibrate_mutex);

	/* Can't use update bit function, so read the original value first */
	addr_h = mc->reg;
	addr_l = mc->rreg;
@@ -547,6 +549,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
	if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
		regmap_write(rt711->regmap,
				RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);

	mutex_unlock(&rt711->calibrate_mutex);
	return 0;
}

@@ -859,9 +863,11 @@ static int rt711_set_bias_level(struct snd_soc_component *component,
		break;

	case SND_SOC_BIAS_STANDBY:
		mutex_lock(&rt711->calibrate_mutex);
		regmap_write(rt711->regmap,
			RT711_SET_AUDIO_POWER_STATE,
			AC_PWRST_D3);
		mutex_unlock(&rt711->calibrate_mutex);
		break;

	default: