Skip to content

ASoC: sdw_utils: generate combined spk components string#5445

Merged
bardliao merged 2 commits intothesofproject:topic/sof-devfrom
bardliao:for-combined-spks
Jun 13, 2025
Merged

ASoC: sdw_utils: generate combined spk components string#5445
bardliao merged 2 commits intothesofproject:topic/sof-devfrom
bardliao:for-combined-spks

Conversation

@bardliao
Copy link
Copy Markdown
Collaborator

@bardliao bardliao commented Jun 4, 2025

The suggestion from UCM for 2 speaker components is using 1 "spk" tag with 2 component names. Like "spk:rt722+rt1320". The PR creates the combined spk component string with the suggested format.
Note that I didn't tough the cs35l56-bridge and cs42l43-spk strings since they seem be special cases. I.e. Depends on the quirks. Not sure how UCM work when cs42l43 speaker and cs35l56 work together. :)

{
.direction = {true, false},
.dai_name = "rt1320-aif1",
.component_name = "rt1320",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would update the commit message and reword/sentence it as these:
extracted from DAI name. And different codecs
without rely on the rtd_init. And can combine different
Sentences are not really easy to follow.

I would also mention why you only add the component_name to SOC_SDW_DAI_TYPE_AMP only (as far as I can see).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit message updated.

{
.direction = {true, true},
.dai_name = "max98373-aif1",
.component_name = "mx8373",
Copy link
Copy Markdown
Collaborator

@ujfalusi ujfalusi Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it max98373 or mx8373 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/sdw_utils/soc_sdw_maxim.c#L31, I think it should be mx8373.

	card->components = devm_kasprintf(card->dev, GFP_KERNEL,
					  "%s spk:mx%04x",
					  card->components, maxim_part_id);


int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{
const char *dai_name = rtd->dai_link->codecs->dai_name;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have a link for the suggestion? Out of curiosity

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (strlen (spk_components) == 0)
spk_components =
devm_kasprintf(card->dev, GFP_KERNEL, "%s",
codec_info->dais[dai_index].component_name);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need a human readable (UCM readable) name here, right?
iow, "spk:rt722+rt1320" and "spk:0x722+0x1320" (printing the part_id as %#x) would not work here, right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it will be "spk:rt722+rt1320" as it is "spk:rt722 spk:rt1320" now.

@bardliao bardliao force-pushed the for-combined-spks branch from 8839376 to f394dd5 Compare June 5, 2025 06:59
bardliao added 2 commits June 5, 2025 17:55
Currently the sdw machine driver uses different way to get the
component name from the DAI name for different codecs in the rtd_init
callback. It means that we need to rely on the rtd_init callback to get
the component name. Add an optional component string to the
asoc_sdw_dai_info struct allows the machine driver to get the component
name directly.
The commit adds the component names for the AMP dais for the preparation
to set card->components string for combined speaker configs.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
The suggestion from UCM for 2 speaker components is using 1 "spk" tag
with 2 component names. Like "spk:rt722+rt1320". The commit removes the
creation of the "spk" components in each rtd_init callback and creat the
string in asoc_sdw_rtd_init().

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao bardliao force-pushed the for-combined-spks branch from f394dd5 to a6f3a25 Compare June 5, 2025 09:56
@bardliao bardliao requested a review from ujfalusi June 12, 2025 06:23
@bardliao bardliao merged commit c0ce398 into thesofproject:topic/sof-dev Jun 13, 2025
8 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants