Message ID | 20240629101112.628-1-shenghao-ding@ti.com |
---|---|
State | New |
Headers | show |
Series | [v1] ASoc: tas2781: Add name_prefix as the prefix name of DSP firmwares and calibrated data files | expand |
On Mon, Jul 01, 2024 at 02:00:13PM +0000, Ding, Shenghao wrote: > > I'll apply this but I do wonder if it's worth falling back to trying to load the > > unprefixed name if we fail to load the prefixed one. > If fail to load dsp firmware, the driver won't load unprefixed name firmware, > but switch tas2563/tas2781 to bypass-dsp mode automatically. > In this mode, smartamp become simple amp. > These day, I met a case from one of my customers, they put 2 pieces of tas2563, > and 2 pieces of tas2781 in the same i2c bus. In order to identify tas2563 and > tas2781, I think name_prefix is a good solution for this case. > Looking forward to your comment. Thanks. Yes, the name_prefix is a good idea and probably people want things specifically tuned for the DSP - I was thinking about error handling or upgrade cases where wrong calibration might work better. Bypass mode means the device will still function at least.
diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c index 4d1a0d836e77..cc765d45c6b5 100644 --- a/sound/soc/codecs/tas2781-i2c.c +++ b/sound/soc/codecs/tas2781-i2c.c @@ -394,8 +394,12 @@ static void tasdevice_fw_ready(const struct firmware *fmw, * failing to load DSP firmware is NOT an error. */ tas_priv->fw_state = TASDEVICE_RCA_FW_OK; - scnprintf(tas_priv->coef_binaryname, 64, "%s_coef.bin", - tas_priv->dev_name); + if (tas_priv->name_prefix) + scnprintf(tas_priv->rca_binaryname, 64, "%s-%s_coef.bin", + tas_priv->name_prefix, tas_priv->dev_name); + else + scnprintf(tas_priv->coef_binaryname, 64, "%s_coef.bin", + tas_priv->dev_name); ret = tasdevice_dsp_parser(tas_priv); if (ret) { dev_err(tas_priv->dev, "dspfw load %s error\n", @@ -418,8 +422,15 @@ static void tasdevice_fw_ready(const struct firmware *fmw, * calibrated data inside algo. */ for (i = 0; i < tas_priv->ndev; i++) { - scnprintf(tas_priv->cal_binaryname[i], 64, "%s_cal_0x%02x.bin", - tas_priv->dev_name, tas_priv->tasdevice[i].dev_addr); + if (tas_priv->name_prefix) + scnprintf(tas_priv->cal_binaryname[i], 64, + "%s-%s_cal_0x%02x.bin", tas_priv->name_prefix, + tas_priv->dev_name, + tas_priv->tasdevice[i].dev_addr); + else + scnprintf(tas_priv->cal_binaryname[i], 64, + "%s_cal_0x%02x.bin", tas_priv->dev_name, + tas_priv->tasdevice[i].dev_addr); ret = tas2781_load_calibration(tas_priv, tas_priv->cal_binaryname[i], i); if (ret != 0)
Add name_prefix as the prefix name of DSP firmwares and calibrated data files which stored speaker calibrated impedance. Signed-off-by: Shenghao Ding <shenghao-ding@ti.com> --- sound/soc/codecs/tas2781-i2c.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)