diff options
author | Steve Lee <steve.lee.analog@gmail.com> | 2022-09-08 09:03:59 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-09-08 13:39:42 +0300 |
commit | 6ac246105b4fd737ed51b8ac3ef031f837686dee (patch) | |
tree | 0d50feb211e58b09d2768974b0aa46399f46860a /sound/soc/codecs/max98390.c | |
parent | e0d38f88e977e7fb6a8aa4d4f31720b1c9b7817e (diff) | |
download | linux-6ac246105b4fd737ed51b8ac3ef031f837686dee.tar.xz |
ASoC: max98390: Remove unnecessary amp on/off conrtol
The Amp is already control in userspace before trigger calibrate function.
Remove unnecessary control in calibrate function and
add condition to check calibration is ready.
Signed-off-by: Steve Lee <steve.lee.analog@gmail.com>
Link: https://lore.kernel.org/r/20220908060359.13606-1-steve.lee.analog@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/max98390.c')
-rw-r--r-- | sound/soc/codecs/max98390.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c index 5c08166a8dc6..4ef8cd1053af 100644 --- a/sound/soc/codecs/max98390.c +++ b/sound/soc/codecs/max98390.c @@ -635,10 +635,19 @@ static int max98390_dsm_calib_get(struct snd_kcontrol *kcontrol, static int max98390_dsm_calib_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + unsigned int val; struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct max98390_priv *max98390 = + snd_soc_component_get_drvdata(component); - max98390_dsm_calibrate(component); + regmap_read(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, &val); + if (val == 0x1) + max98390_dsm_calibrate(component); + else { + dev_err(component->dev, "AMP is not ready to run calibration\n"); + return -ECANCELED; + } return 0; } @@ -826,9 +835,6 @@ static int max98390_dsm_calibrate(struct snd_soc_component *component) struct max98390_priv *max98390 = snd_soc_component_get_drvdata(component); - regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x81); - regmap_write(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, 0x01); - regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE1, &rdc); regmap_read(max98390->regmap, @@ -847,9 +853,6 @@ static int max98390_dsm_calibrate(struct snd_soc_component *component) dev_info(component->dev, "rdc resistance about %d.%02d ohm, reg=0x%X temp reg=0x%X\n", rdc_integer, rdc_factor, rdc_cal_result, temp); - regmap_write(max98390->regmap, MAX98390_R23FF_GLOBAL_EN, 0x00); - regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80); - return 0; } |