ASoC: tas2781: Add TAS2573 calibration support
Subsystems (3)
Shenghao Ding
maintainerPATCH v3 1/1 ASoC: tas2781: Add TAS2573 calibration support
This patch adds complete calibration workflow support for TAS2573.
---
v3:
- Our customer requests to follow the feedback from the Linux Community. When there is no dedicated special configuration for the calibration feature, the corresponding parameter should be set to -1, so that redundant duplicate configuration work can be completely avoided.
v2:
- Add comments for tasdevice_rca::calibration_profile_id, which is primarily designed for speaker calibration scenarios with special requirements. For use cases without specific calibration demands, it can directly reuse the standard music playback configuration, and its default value is set to 0.
- Correct some logs.
- Use proper kernel error code and WARN_ON_ONCE in the tas2573 calib_start_put control.
v1:
- Add TAS2573 dedicated calibration register definitions
- Extend firmware parser to auto detect and store "calib" tagged profile and config IDs
- Implement TAS2573 calibration start/stop control handlers
- Add dedicated kcontrols for real-time speaker impedance readout and full calibration status dump
- Refactor calibration control creation logic with per-chip switch-case branches for better scalability
- Extend firmware ready check to register TAS2573 calibration controls properly.
--- include/sound/tas2781-dsp.h | 9 + include/sound/tas2781.h | 24 +++ sound/soc/codecs/tas2781-fmwlib.c | 36 +++- sound/soc/codecs/tas2781-i2c.c | 320 +++++++++++++++++++++++++++--- 4 files changed, 361 insertions(+), 28 deletions(-)
include/sound/tas2781-dsp.h +9 -0
@@ -146,6 +146,7 @@ struct tasdevice_fw {struct tasdevice_calibration *calibrations;struct fct_param_address fct_par_addr;struct device *dev; +int calibration_config_id; };enum tasdevice_fw_state {
@@ -210,6 +211,14 @@ struct tasdevice_rca {* capture. */ int capture_profile_id; +/* +* Primarily designed for speaker calibration scenarios with special +* requirements. For regular use cases, when the default value -1 is +* set, calibration will directly reuse the current playback +* configuration; non-negative values can be customized for special +* calibration demands. +*/ +int calibration_profile_id;/* * Since version 0x105, the keyword 'init' was introduced into the * profile, which is used for chip initialization, particularly to
include/sound/tas2781.h +24 -0
@@ -91,6 +91,30 @@/* prm_TE_1_Beta1 */ #define TAS2563_TE_DT_REG TASDEVICE_REG(0x00, 0x0f, 0x70) +#define TAS2573_FCT_INT_LATCH TASDEVICE_REG(0x00, 0x00, 0x67) +/* YM57 */ +#define TAS2573_FCT_OUTPUT_R0 TASDEVICE_REG(0x00, 0x65, 0x74) +/* YM58 */ +#define TAS2573_FCT_OUTPUT_R0_LOW TASDEVICE_REG(0x00, 0x65, 0x78) +/* YM59 */ +#define TAS2573_FCT_OUTPUT_INV_R0 TASDEVICE_REG(0x00, 0x65, 0x7C) +/* YM61 */ +#define TAS2573_FCT_OUTPUT_POWERTOT TASDEVICE_REG(0x00, 0x66, 0x0C) +/* YM64 */ +#define TAS2573_FCT_OUTPUT_F0 TASDEVICE_REG(0x00, 0x65, 0x18) +/* YM147 */ +#define TAS2573_FCT_STATUS_CTRL TASDEVICE_REG(0x00, 0x68, 0x74) +/* YM148 */ +#define TAS2573_FCT_STATUS_BINNING TASDEVICE_REG(0x00, 0x68, 0x78) +/* YM664 */ +#define TAS2573_RE_OUT TASDEVICE_REG(0x00, 0x7A, 0x18) +/* YM952 */ +#define TAS2573_SILENCE_DETECTED TASDEVICE_REG(0x00, 0x83, 0x60) +/* YM954 */ +#define TAS2573_OPEN_CIRCUIT TASDEVICE_REG(0x00, 0x83, 0x68) +/* YM955 */ +#define TAS2573_SHORTCKT TASDEVICE_REG(0x00, 0x83, 0x6C) +#define TAS2781_PRM_INT_MASK_REG TASDEVICE_REG(0x00, 0x00, 0x3b)#define TAS2781_PRM_CLK_CFG_REG TASDEVICE_REG(0x00, 0x00, 0x5c)#define TAS2781_PRM_RSVD_REG TASDEVICE_REG(0x00, 0x01, 0x19)
sound/soc/codecs/tas2781-fmwlib.c +33 -3
@@ -199,15 +199,22 @@ static struct tasdevice_config_info *tasdevice_add_config(dev_err (tas_priv->dev,"add conf: Out of boundary\n" ); goto out; } -/* If in the RCA bin file are several profiles with the -* keyword "init", init_profile_id only store the last -* init profile id. +/* +* If in the RCA bin file are several profiles with the +* keyword "init"/"calib", init_profile_id only store the last +* init profile id, and same as calibration_profile_id. */ if (strnstr (&config_data[config_offset],"init" ,64 )) { tas_priv->rcabin.init_profile_id = tas_priv->rcabin.ncfgs -1 ;dev_dbg (tas_priv->dev,"%s: init profile id = %d\n" , __func__, tas_priv->rcabin.init_profile_id); + }else if (strnstr (&config_data[config_offset],"calib" ,64 )) { + tas_priv->rcabin.calibration_profile_id = + tas_priv->rcabin.ncfgs -1 ; +dev_dbg (tas_priv->dev,"%s: calib profile id = %d\n" , + __func__, + tas_priv->rcabin.calibration_profile_id); } config_offset +=64 ; }
@@ -314,6 +321,7 @@ int tasdevice_rca_parser(void *context, const struct firmware *fmw) rca = &(tas_priv->rcabin);/* Initialize to none */ rca->init_profile_id =-1 ; + rca->calibration_profile_id =-1 ; fw_hdr = &(rca->fw_hdr);if (!fmw || !fmw->data) { dev_err(tas_priv->dev, "Failed to read %s\n",
@@ -632,6 +640,17 @@ static int fw_parse_configuration_data_kernel( goto out; }memcpy (config->name, &data[offset],64 ); + +/* +* If in the coef bin file are several configs with the +* keyword "calib", calibration_config_id only store the last +* calibration profile id. +*/ +if (strnstr (config->name,"calib" ,64 )) { + tas_fmw->calibration_config_id = i; +dev_dbg (tas_priv->dev,"%s: calib cofig = %d\n" , + __func__, tas_fmw->calibration_config_id); + }/*skip extra 16 bytes*/ offset +=80 ;
@@ -1412,6 +1431,17 @@ static int fw_parse_configuration_data(memcpy (config->name, &data[offset],64 ); offset +=64 ; +/* +* If in the coef bin file are several configs with the +* keyword "calib", calibration_config_id only store the last +* calibration profile id. +*/ +if (strnstr (config->name,"calib" ,64 )) { + tas_fmw->calibration_config_id = i; +dev_dbg (tas_priv->dev,"%s: calib cofig id = %d\n" , + __func__, tas_fmw->calibration_config_id); + } + n =tasdevice_fw_strnlen (fmw, offset);if (n <0 ) {dev_err (tas_priv->dev,"Description err\n" );
sound/soc/codecs/tas2781-i2c.c +295 -25
385 lines not on this page · raw message
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 1 line · Shenghao Ding
ASoC: tas2781: Add TAS2573 calibration support
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: tas2781: Add TAS2573 calibration support
https://git.kernel.org/broonie/sound/c/d1a73ad21f96
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
Ding, Shenghao
maintainerHi Brownie,
Hope you are having a good week.
Following up on the ASoC tas2781 patch that was applied to your for-7.4 branch on 2026-09-15:ASoC: tas2781: Add TAS2573 calibration support
https://git.kernel.org/broonie/sound/c/d1a73ad21f96
We have been tracking its progress but have not observed it showing up in linux-next after the usual 24-hour window, nor has it been picked up in the current mainline merge window so far. We would like to check if there are any unresolved test failures, regressions or other concerns we should follow up on, to help get this patch merged smoothly.
Please let us know if any revised version or additional fix patch is needed from our side.
Thanks a lot for your work!
Regards,
Shenghao Ding
Quoted 62 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Wednesday, September 16, 2026 1:50 AM
To: Ding, Shenghao <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Xu, Baojun <[email protected]>; Lu, Kevin(CAAH) <[email protected]>
Subject: [EXTERNAL] Re: [PATCH v3] ASoC: tas2781: Add TAS2573 calibration supportOn Tue, 15 Sep 2026 12: 47: 35 +0800, Shenghao Ding wrote: > ASoC: tas2781:
Add TAS2573 calibration support Applied to
https: //urldefense. com/v3/__https: //git. kernel. org/pub/scm/linux/kernel/git /broonie/sound. git__;!!G3vK!R0se4gOlxz4pnyeYpJc1CitJmTJX6VU3dpzQVS8kV aiAxJUcbUGAZRRqUDUc0-tTYXktLYs5m8C0VSGj$
ZjQcmQRYFpfptBannerStart
This message was sent from outside of Texas Instruments.
Do not click links or open attachments unless you recognize the source of this email and know the content is safe.
<https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/G3vK!utdqPfaOVuw7qqaE_HKAHBC6t__DGl- pCFwe0gKjbkd- GAbDzTu7GtZQQztWp_yVD5FrBcFpfyHQOJgOw06qmO4tR1TNIa7J9MKTkA$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Quoted 1 line · Shenghao Ding
ASoC: tas2781: Add TAS2573 calibration support
Applied to
https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/b
roonie/sound.git__;!!G3vK!R0se4gOlxz4pnyeYpJc1CitJmTJX6VU3dpzQVS8kVai AxJUcbUGAZRRqUDUc0-tTYXktLYs5m8C0VSGj$ for-7.4Thanks!
[1/1] ASoC: tas2781: Add TAS2573 calibration support
https://urldefense.com/v3/__https://git.kernel.org/broonie/sound/c/d1a73ad
21f96__;!!G3vK!R0se4gOlxz4pnyeYpJc1CitJmTJX6VU3dpzQVS8kVaiAxJUcbUGA ZRRqUDUc0-tTYXktLYs5m0zyO5jN$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
Mark Brown
maintainerQuoted 6 lines · Shenghao
We have been tracking its progress but have not observed it showing up in linux-next after the usual 24-hour window, nor has it been picked up in the current mainline merge window so far. We would like to check if there are any unresolved test failures, regressions or other concerns we should follow up on, to help get this patch merged smoothly.
Please let us know if any revised version or additional fix patch is needed from our side.
Nothing needed from your side.