ASoC: tas2781: Add calibration kcontrols for TAS2573
Subsystems (3)
Shenghao Ding
maintainerPATCH v2 1/1 ASoC: tas2781: Add calibration kcontrols for TAS2573
Add calibration kcontrols for TAS2573 in TAS2781 driver to support device-specific calibration settings.
---
v2:
- Follow the comment style of the ASoC subsystem.
- CC the necessary people, and remove unnecessary people.
--- include/sound/tas2781-dsp.h | 2 + include/sound/tas2781.h | 25 +++ sound/soc/codecs/tas2781-fmwlib.c | 35 +++- sound/soc/codecs/tas2781-i2c.c | 290 +++++++++++++++++++++++++----- 4 files changed, 301 insertions(+), 51 deletions(-)
include/sound/tas2781-dsp.h +2 -0
@@ -142,6 +142,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 {
@@ -201,6 +202,7 @@ struct tasdevice_rca {int ncfgs;struct tasdevice_config_info **cfg_info;int profile_cfg_id; +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 +25 -0
@@ -17,6 +17,8 @@#ifndef __TAS2781_H__#define __TAS2781_H__ +#define CONFIG_SND_SOC_TAS2781_ACOUST_I2C +#ifdef CONFIG_SND_SOC_TAS2781_ACOUST_I2C #include <linux/debugfs.h> #endif
@@ -91,6 +93,29 @@/* prm_TE_1_Beta1 */ #define TAS2563_TE_DT_REG TASDEVICE_REG(0x00, 0x0f, 0x70) +#define TAS2573_FCT_INT_LATCH TASDEVICE_REG(0x00, 0x00, 0x67) +// YM147 +#define TAS2573_FCT_STATUS_CTRL TASDEVICE_REG(0x00, 0x68, 0x74) +// YM148 +#define TAS2573_FCT_STATUS_BINNING TASDEVICE_REG(0x00, 0x68, 0x78) +// 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) +// 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 +32 -3
@@ -198,15 +198,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 ; }
@@ -631,6 +638,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 id = %d\n" , + __func__, tas_fmw->calibration_config_id); + }/*skip extra 16 bytes*/ offset +=80 ;
@@ -1372,6 +1390,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 =strlen ((char *)&data[offset]); n +=15 ;if (offset + n > fmw->size) {
sound/soc/codecs/tas2781-i2c.c +242 -48
349 lines not on this page · raw message
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 2 lines · Shenghao Ding
Add calibration kcontrols for TAS2573 in TAS2781 driver to support device-specific calibration settings.
This doesn't apply against current code, please check and resend.
It looks like this is more than just some controls, it looks like it can also load the resulting calibration?
Ding, Shenghao
maintainerQuoted 12 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Wednesday, July 22, 2026 12:35 AM
To: Ding, Shenghao <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Xu, Baojun <[email protected]>
Subject: [EXTERNAL] Re: [PATCH v2] ASoC: tas2781: Add calibration kcontrols for TAS2573
Quoted 8 lines
Quoted 2 lines · Shenghao Ding
Add calibration kcontrols for TAS2573 in TAS2781 driver to support device-specific calibration settings.
This doesn't apply against current code, please check and resend.
It looks like this is more than just some controls, it looks like it can also load the resulting calibration?
The controls include start, stop, and calibration status and value query,