Skip to contentSkip to conversation

ALSA: ASoc/tas2781: fixed wrong loading calibrated data sequence

PATCH Superseded Shenghao Ding 2 participants 2 messages Apr 27, 2024 – Apr 29, 2024

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Shenghao Ding

author maintainer
#0 lore raw

PATCH 1/1 ALSA: ASoc/tas2781: fixed wrong loading calibrated data sequence

Calibrated data will be set to default after loading dsp config params, which will cause speaker protection work abnormally. Reload calibrated data after loading dsp config params.

---
Change in v1:
- Download calibrated data after loading the new dsp config params
- call tasdevice_prmg_load instead of tasdevice_prmg_calibdata_load, it is unnecessary to load calibrated data after loading dsp program. Load it after loading dsp config params.
- Remove tasdevice_prmg_calibdata_load, because it is unnecessary to load calibrated data after loading dsp program.
- work in bypass-dsp mode even if no dsp fw loaded.

---
 include/sound/tas2781-dsp.h       |  3 +-
 sound/soc/codecs/tas2781-fmwlib.c | 96 +++++++------------------------
 sound/soc/codecs/tas2781-i2c.c    |  4 +-
 3 files changed, 23 insertions(+), 80 deletions(-)
include/sound/tas2781-dsp.h +1 -2
index ea9af2726a53..14a4a254ad2a 100644
@@ -2,7 +2,7 @@
 //
 // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
 //
-// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
+// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
 // https://www.ti.com
 //
 // The TAS2781 driver implements a flexible and configurable
@@ -180,7 +180,6 @@ void tasdevice_calbin_remove(void *context);
 int tasdevice_select_tuningprm_cfg(void *context, int prm,
 	int cfg_no, int rca_conf_no);
 int tasdevice_prmg_load(void *context, int prm_no);
-int tasdevice_prmg_calibdata_load(void *context, int prm_no);
 void tasdevice_tuning_switch(void *context, int state);
 int tas2781_load_calibration(void *context, char *file_name,
 	unsigned short i);
sound/soc/codecs/tas2781-fmwlib.c +20 -76

122 lines not on this page · raw message

sound/soc/codecs/tas2781-i2c.c +2 -2
index b5abff230e43..9350972dfefe 100644
@@ -2,7 +2,7 @@
 //
 // ALSA SoC Texas Instruments TAS2563/TAS2781 Audio Smart Amplifier
 //
-// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
+// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
 // https://www.ti.com
 //
 // The TAS2563/TAS2781 driver implements a flexible and configurable
@@ -414,7 +414,7 @@ static void tasdevice_fw_ready(const struct firmware *fmw,
 				__func__, tas_priv->cal_binaryname[i]);
 	}
 
-	tasdevice_prmg_calibdata_load(tas_priv, 0);
+	tasdevice_prmg_load(tas_priv, 0);
 	tas_priv->cur_prog = 0;
 out:
 	if (tas_priv->fw_state == TASDEVICE_DSP_FW_FAIL) {
Signature · 1 line
2.34.1
#1 lore raw

On Sat, Apr 27, 2024 at 01:28:57PM +0800, Shenghao Ding wrote:

In the Subject: fixed --> Fix

Quoted 1 line

Calibrated data will be set to default after loading dsp config params,

DSP

Quoted 2 lines

which will cause speaker protection work abnormally. Reload calibrated data after loading dsp config params.

DSP

...

Review

Quoted 5 lines
(quoted diff) +2 -2
-// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
+// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
 
-// Copyright 2023 Texas Instruments, Inc.
+// Copyright 2023 - 2024 Texas Instruments, Inc.

Seems unrelated changes, but harmless.

...

sound/soc/codecs/tas2781-fmwlib.c int tasdevice_select_tuningprm_cfg(void *context, int prm_no, · line 2251

Quoted 2 lines
sound/soc/codecs/tas2781-fmwlib.c +2 -0
+						load_calib_data(tas_priv,
+							&(cal->dev_data));

Why do you need parentheses for & (dereference) operator?

Signature · 2 lines
With Best Regards,
Andy Shevchenko