Skip to contentSkip to conversation

ASoC: max98390: Remove unnecessary amp on/off conrtol

PATCH Superseded Steve Lee 2 participants 5 messages Aug 26, 2022 – Sep 6, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Steve Lee

author
#0 lore raw

PATCH 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.

---
 sound/soc/codecs/max98390.c | 6 ------
 1 file changed, 6 deletions(-)
sound/soc/codecs/max98390.c +0 -6
index 91c0bf3d76fc..99e769190568 100644
@@ -826,9 +826,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 +844,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 2 lines · Steve Lee

The Amp is already control in userspace before trigger calibrate function.
Remove unnecessary control in calibrate function.

I can't see anything which ensures that this is the case? Should there be a check which returns an error if the output is not enabled, or should the function check the current state and preserve it at the end? I can see that this would fix problems with it being disabled when callibrating.

author
#2 lore raw
Quoted 11 lines · Mark Brown
Quoted 2 lines · Steve Lee

The Amp is already control in userspace before trigger calibrate function.
Remove unnecessary control in calibrate function.

I can't see anything which ensures that this is the case? Should there be a check which returns an error if the output is not enabled, or should the function check the current state and preserve it at the end? I can see that this would fix problems with it being disabled when callibrating.

As your comment, this can fix amp being disabled when calibrating.
And this also fix the case that music play right after calibration. Actually, calibration process should start mute playback before trigger this function.
AMP disable/enable control in calibration function can break sync with userspace enable/disable control.

maintainer
#3 lore raw
Quoted 8 lines · Lee Steve
Quoted 5 lines · Mark Brown

I can't see anything which ensures that this is the case? Should there be a check which returns an error if the output is not enabled, or should the function check the current state and preserve it at the end? I can see that this would fix problems with it being disabled when callibrating.

Quoted 6 lines

As your comment, this can fix amp being disabled when calibrating.
And this also fix the case that music play right after calibration. Actually, calibration process should start mute playback before trigger this function.
AMP disable/enable control in calibration function can break sync with userspace enable/disable control.

Right, so that sounds like there should be something which checks the current state and doesn't start callibration unless the device is in a sensible state.

author
#4 lore raw
Quoted 17 lines · Mark Brown
Quoted 8 lines · Lee Steve
Quoted 5 lines · Mark Brown

I can't see anything which ensures that this is the case? Should there be a check which returns an error if the output is not enabled, or should the function check the current state and preserve it at the end? I can see that this would fix problems with it being disabled when callibrating.

Quoted 6 lines

As your comment, this can fix amp being disabled when calibrating.
And this also fix the case that music play right after calibration. Actually, calibration process should start mute playback before trigger this function.
AMP disable/enable control in calibration function can break sync with userspace enable/disable control.

Quoted 3 lines

Right, so that sounds like there should be something which checks the current state and doesn't start callibration unless the device is in a sensible state.

I will send v2 patch adding check before start calibration.
Thanks.