summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorShuming Fan <shumingf@realtek.com>2020-12-17 11:56:51 +0300
committerMark Brown <broonie@kernel.org>2020-12-17 17:24:44 +0300
commit6108f990c0887d3e8f1db2d13c7012e40a061f28 (patch)
tree3b46c3fa4f31ef9f1914869227ccc410f4e2935a /sound/soc
parentbb224c3e3e41d940612d4cc9573289cdbd5cb8f5 (diff)
downloadlinux-6108f990c0887d3e8f1db2d13c7012e40a061f28.tar.xz
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: Shuming Fan <shumingf@realtek.com> Link: https://lore.kernel.org/r/20201217085651.24580-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/rt711.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c
index 5771c02c3459..85f744184a60 100644
--- a/sound/soc/codecs/rt711.c
+++ b/sound/soc/codecs/rt711.c
@@ -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: