Skip to content

Commit ae3e2f3

Browse files
shumingfangregkh
authored andcommitted
ASoC: rt711: mutex between calibration and power state changes
[ Upstream commit 6108f99 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 14fe083 commit ae3e2f3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎sound/soc/codecs/rt711.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
462462
unsigned int read_ll, read_rl;
463463
int i;
464464

465+
mutex_lock(&rt711->calibrate_mutex);
466+
465467
/* Can't use update bit function, so read the original value first */
466468
addr_h = mc->reg;
467469
addr_l = mc->rreg;
@@ -547,6 +549,8 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol,
547549
if (dapm->bias_level <= SND_SOC_BIAS_STANDBY)
548550
regmap_write(rt711->regmap,
549551
RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
552+
553+
mutex_unlock(&rt711->calibrate_mutex);
550554
return 0;
551555
}
552556

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

861865
case SND_SOC_BIAS_STANDBY:
866+
mutex_lock(&rt711->calibrate_mutex);
862867
regmap_write(rt711->regmap,
863868
RT711_SET_AUDIO_POWER_STATE,
864869
AC_PWRST_D3);
870+
mutex_unlock(&rt711->calibrate_mutex);
865871
break;
866872

867873
default:

0 commit comments

Comments
 (0)