Skip to contentSkip to conversation

ASoC: max98390: Remove unnecessary amp on/off conrtol

PATCH In review Steve Lee 2 participants 2 messages Sep 8, 2022

Subsystems (2)
lore
Share & tools
lore

Steve Lee

author
#0 lore raw

PATCH v2 1/1 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.

---
 sound/soc/codecs/max98390.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
sound/soc/codecs/max98390.c +10 -7
index 91c0bf3d76fc..4b2ee70c29d7 100644
@@ -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;
 }
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 5 lines · Steve Lee

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.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: max98390: Remove unnecessary amp on/off conrtol

      commit: 6ac246105b4fd737ed51b8ac3ef031f837686dee

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark