Skip to content

Commit e83dcd1

Browse files
Shenghao-Dingbroonie
authored andcommitted
ASoC: tas2781: Add keyword "init" in profile section
Since version 0x105, the keyword 'init' was introduced into the profile, which is used for chip initialization, particularly to store common settings for other non-initialization profiles. Signed-off-by: Shenghao Ding <shenghao-ding@ti.com> Link: https://patch.msgid.link/20250803131110.1443-1-shenghao-ding@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 32dffd4 commit e83dcd1

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

include/sound/tas2781-dsp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ struct tasdevice_rca {
198198
int ncfgs;
199199
struct tasdevice_config_info **cfg_info;
200200
int profile_cfg_id;
201+
/*
202+
* Since version 0x105, the keyword 'init' was introduced into the
203+
* profile, which is used for chip initialization, particularly to
204+
* store common settings for other non-initialization profiles.
205+
* if (init_profile_id < 0)
206+
* No init profile inside the RCA firmware.
207+
*/
208+
int init_profile_id;
201209
};
202210

203211
void tasdevice_select_cfg_blk(void *context, int conf_no,

sound/soc/codecs/tas2781-fmwlib.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ static struct tasdevice_config_info *tasdevice_add_config(
180180
dev_err(tas_priv->dev, "add conf: Out of boundary\n");
181181
goto out;
182182
}
183+
/* If in the RCA bin file are several profiles with the
184+
* keyword "init", init_profile_id only store the last
185+
* init profile id.
186+
*/
187+
if (strnstr(&config_data[config_offset], "init", 64)) {
188+
tas_priv->rcabin.init_profile_id =
189+
tas_priv->rcabin.ncfgs - 1;
190+
dev_dbg(tas_priv->dev, "%s: init profile id = %d\n",
191+
__func__, tas_priv->rcabin.init_profile_id);
192+
}
183193
config_offset += 64;
184194
}
185195

@@ -283,6 +293,8 @@ int tasdevice_rca_parser(void *context, const struct firmware *fmw)
283293
int i;
284294

285295
rca = &(tas_priv->rcabin);
296+
/* Initialize to none */
297+
rca->init_profile_id = -1;
286298
fw_hdr = &(rca->fw_hdr);
287299
if (!fmw || !fmw->data) {
288300
dev_err(tas_priv->dev, "Failed to read %s\n",

sound/soc/codecs/tas2781-i2c.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,12 @@ static void tasdevice_fw_ready(const struct firmware *fmw,
16411641
tasdevice_prmg_load(tas_priv, 0);
16421642
tas_priv->cur_prog = 0;
16431643

1644+
/* Init common setting for different audio profiles */
1645+
if (tas_priv->rcabin.init_profile_id >= 0)
1646+
tasdevice_select_cfg_blk(tas_priv,
1647+
tas_priv->rcabin.init_profile_id,
1648+
TASDEVICE_BIN_BLK_PRE_POWER_UP);
1649+
16441650
#ifdef CONFIG_SND_SOC_TAS2781_ACOUST_I2C
16451651
if (tas_priv->name_prefix)
16461652
acoustic_debugfs_node = devm_kasprintf(tas_priv->dev,

0 commit comments

Comments
 (0)