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

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.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent bb224c3e
...@@ -462,6 +462,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, ...@@ -462,6 +462,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
unsigned int read_ll, read_rl; unsigned int read_ll, read_rl;
int i; int i;
mutex_lock(&rt711->calibrate_mutex);
/* Can't use update bit function, so read the original value first */ /* Can't use update bit function, so read the original value first */
addr_h = mc->reg; addr_h = mc->reg;
addr_l = mc->rreg; addr_l = mc->rreg;
...@@ -547,6 +549,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, ...@@ -547,6 +549,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
regmap_write(rt711->regmap, regmap_write(rt711->regmap,
RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
mutex_unlock(&rt711->calibrate_mutex);
return 0; return 0;
} }
...@@ -859,9 +863,11 @@ static int rt711_set_bias_level(struct snd_soc_component *component, ...@@ -859,9 +863,11 @@ static int rt711_set_bias_level(struct snd_soc_component *component,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
mutex_lock(&rt711->calibrate_mutex);
regmap_write(rt711->regmap, regmap_write(rt711->regmap,
RT711_SET_AUDIO_POWER_STATE, RT711_SET_AUDIO_POWER_STATE,
AC_PWRST_D3); AC_PWRST_D3);
mutex_unlock(&rt711->calibrate_mutex);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment