Skip to content

ASoC: Intel: add I2S function topology support#5657

Open
bardliao wants to merge 7 commits into
thesofproject:topic/sof-devfrom
bardliao:get-i2s-tplg
Open

ASoC: Intel: add I2S function topology support#5657
bardliao wants to merge 7 commits into
thesofproject:topic/sof-devfrom
bardliao:get-i2s-tplg

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

Currently, function topology is only used by the SoundWire machines. Extend the support to the I2S machines.

@ujfalusi ujfalusi left a comment

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.

only checked the first patch

}

dev_err(dev, "%s: No match for SSP%d in NHLT table\n", __func__,
dev_dbg(dev, "%s: No match for SSP%d in NHLT table\n", __func__,

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 have this as separate patch?

we are also going to look for DMIC blobs in several nhlt, so change those prints as well?

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.

Not sure about the DMIC blobs. Maybe we can change the DMIC prints when we look for DMIC blobs in several nhlt?

@ujfalusi ujfalusi Jan 29, 2026

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.

but we do after the second patch...

There could be NHLT blobs w/o DMIC (SSP fragment) and we would print error/warn?

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.

intel_nhlt_get_endpoint_blob() will be called for each NHLT blobs, but it uses dev_dbg already.

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.

you need to call out that in preparation for supporting multiple topology fragments per function which could end up calling this function multiple types with NHLT blobs from different fragments, downgrade the error message to debug level.

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. But do you mean to move the commit to before the ASoC: SOF: get nhlt from all topologies commit?

Comment thread sound/soc/sof/intel/hda-dai.c Outdated
Comment thread sound/soc/sof/intel/hda-dai.c Outdated
Comment thread sound/soc/sof/ipc4-priv.h Outdated
Comment thread sound/soc/sof/ipc4-priv.h Outdated
Comment thread sound/soc/sof/ipc4-topology.c Outdated
channel_count, sample_rate,
dir, dev_type);
if (cfg)
break;

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.

goto out; and remove the cfg check after the loop?

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.

fixed

Comment thread sound/soc/sof/ipc4-topology.c Outdated
@bardliao bardliao force-pushed the get-i2s-tplg branch 2 times, most recently from a0fd522 to 8d4c0c3 Compare January 29, 2026 03:30

@ujfalusi ujfalusi left a comment

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.

@bardliao, looks really nice, I have few nitpicks and one bigger question only

}

dev_err(dev, "%s: No match for SSP%d in NHLT table\n", __func__,
dev_dbg(dev, "%s: No match for SSP%d in NHLT table\n", __func__,

@ujfalusi ujfalusi Jan 29, 2026

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.

but we do after the second patch...

There could be NHLT blobs w/o DMIC (SSP fragment) and we would print error/warn?

Comment thread sound/soc/sof/ipc4-topology.c Outdated
dai_index);
if (dev_type < 0)
list_for_each_entry(nhlt, &ipc4_data->nhlt_list, list) {
dev_type = intel_nhlt_ssp_device_type(sdev->dev, nhlt->nhlt,

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.

nitpick: nhlt->nhlt, can we do entry->nhlt instead? the outer nhlt is not nhlt as such.

Comment thread sound/soc/sof/ipc4-topology.c Outdated
Comment thread sound/soc/intel/common/sof-function-topology-lib.c
Comment thread sound/soc/intel/common/sof-function-topology-lib.c
if (!(*tplg_files)[tplg_num])
return -ENOMEM;
tplg_num++;
}

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.

To my untrained eyes this looks like identical to what sof_sdw_get_tplg_files() would do, just that this lacks the SDW part, no?
Why not rename that function ad use it for all types as universal tool?

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.

Yeah, I thought about it. And yes, they look quite similar, but the existing topologies may use different PCM IDs for different machines. I think it would be better to use separated function to keep the flexibility to have different function topology names for different machines.

Comment thread sound/soc/sof/ipc4-topology.c Outdated
@CBala21

CBala21 commented Jan 30, 2026

Copy link
Copy Markdown

Tested HDMI in capture and I2S functional. observed the expected behavior.

Comment thread sound/soc/sof/ipc4-topology.c Outdated
Comment thread sound/soc/sof/ipc4-topology.c Outdated
}

dev_err(dev, "%s: No match for SSP%d in NHLT table\n", __func__,
dev_dbg(dev, "%s: No match for SSP%d in NHLT table\n", __func__,

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.

you need to call out that in preparation for supporting multiple topology fragments per function which could end up calling this function multiple types with NHLT blobs from different fragments, downgrade the error message to debug level.

Comment thread sound/soc/intel/common/sof-function-topology-lib.c
Comment thread sound/soc/intel/common/sof-function-topology-lib.c Outdated
Comment thread sound/soc/intel/common/sof-function-topology-lib.c
Comment thread sound/soc/intel/common/sof-function-topology-lib.c

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, one nitpick would be it could do with more inline commentary when it comes to how we are searching for files.

ranj063
ranj063 previously approved these changes Feb 4, 2026

@ranj063 ranj063 left a comment

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.

LGTM thanks @bardliao

ujfalusi
ujfalusi previously approved these changes Feb 5, 2026

@ujfalusi ujfalusi left a comment

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 think this looks good, but not really sure how it is planned to be used in practice ;)

Comment thread sound/soc/intel/common/soc-acpi-intel-ptl-match.c
@lgirdwood

Copy link
Copy Markdown
Member

CI needs kicked.

@lgirdwood

Copy link
Copy Markdown
Member

SOFCI TEST

lgirdwood
lgirdwood previously approved these changes Feb 5, 2026
@bardliao

bardliao commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator Author

change:
fix checkpatch issues.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, just one question.

Comment thread sound/soc/sof/intel/hda-dai.c
ranj063
ranj063 previously approved these changes Feb 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comment on lines 3800 to +3806
case SOF_MANIFEST_DATA_TYPE_NHLT:
/* no NHLT in BIOS, so use the one from topology manifest */
if (ipc4_data->nhlt)
break;
ipc4_data->nhlt = devm_kmemdup(sdev->dev, manifest_tlv->data,
struct snd_ipc4_nhlt *tplg_nhlt;

/* Get the nhlt from topology manifest */
tplg_nhlt = devm_kzalloc(sdev->dev, sizeof(*tplg_nhlt), GFP_KERNEL);
if (!tplg_nhlt)
return -ENOMEM;
bardliao added 2 commits July 8, 2026 10:39
The existing code assumes there is only one NHLT blob either from BIOS
or topology. As function topologies are used and each function topology
contains a NHLT blob section, we need to search the matching NHLT blob
from all the NHLT blobs.
The commit suggests adding a list of NHLTs and search the NHLTs from the
list.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
To support multiple topology fragments per function, this function
could be called multiple types with different NHLT blobs from different
fragments. Downgrade the error message to debug level since the SSP
device type could be found from one of the nhlt.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copilot AI review requested due to automatic review settings July 8, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment on lines +35 to +48
static int get_platform_name(struct snd_soc_card *card,
const struct snd_soc_acpi_mach *mach, char *platform)
{
int ret;

ret = sscanf(mach->sof_tplg_filename, "sof-%3s-*.tplg", platform);
if (ret != 1) {
dev_err(card->dev, "Invalid platform name of tplg %s\n",
mach->sof_tplg_filename);
return -EINVAL;
}

return 0;
}

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.

The suffix will be added at run time.

Comment on lines +319 to +324
/* Check presence of sub-topologies */
if (all_tplg_files_exist(card->dev, tplg_files, tplg_num))
return tplg_num;

/* return 0 to use monolithic topology */
return 0;
Comment thread sound/soc/sof/ipc4-priv.h
Comment on lines +61 to +65
struct snd_ipc4_nhlt {
struct list_head list;
void *nhlt;
bool from_acpi;
};
The existing code supports get_function_tplg_files callback for
SoundWire machine driver only. Some common sections can be used to
extend the support to other machines.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copilot AI review requested due to automatic review settings July 9, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread sound/soc/intel/common/sof-function-topology-lib.c
Comment on lines +327 to +330
(*tplg_files)[tplg_num] = get_tplg_filename(card->dev, prefix, platform,
tplg_dev_name, dai_link->id,
tplg_dev);
(*tplg_files)[tplg_num] = tplg_file;
Comment thread sound/soc/intel/common/sof-function-topology-lib.c
Copilot AI review requested due to automatic review settings July 9, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

{
int ret;

ret = sscanf(mach->sof_tplg_filename, "sof-%3s-*.tplg", platform);
Comment on lines +327 to +331
(*tplg_files)[tplg_num] = get_tplg_filename(card->dev, prefix, platform,
tplg_dev_name, dai_link->id,
tplg_dev);
(*tplg_files)[tplg_num] = tplg_file;
tplg_num++;
Copilot AI review requested due to automatic review settings July 9, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Comment on lines +40 to +45
ret = sscanf(mach->sof_tplg_filename, "sof-%3s-*.tplg", platform);
if (ret != 1) {
dev_err(card->dev, "Invalid platform name of tplg %s\n",
mach->sof_tplg_filename);
return -EINVAL;
}

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.

The 'tplg' suffix will be added in run time

Comment on lines +245 to +247
if (!tplg_files_exist(card->dev, tplg_file)) {
devm_kfree(card->dev, tplg_file);
if (best_effort)
Comment on lines +317 to +319
if (!tplg_files_exist(card->dev, tplg_file)) {
devm_kfree(card->dev, tplg_file);
if (best_effort)
Comment thread sound/soc/sof/ipc4-priv.h
Comment on lines +61 to +65
struct snd_ipc4_nhlt {
struct list_head list;
void *nhlt;
bool from_acpi;
};
bardliao added 4 commits July 9, 2026 20:33
best_effort mode

Currently we will fallback to the monolithic topology if any function
topology is missing. But the monolithic topology may not exist if
best_effort is set. We should load the existing function topologies in
the case.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
…et_tplg_files

The Intel SOF SDW machine drive also supports I2S interface. Add related
supports for the sof_sdw_get_tplg_files() callback.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
… I2S machines

Add sof_i2s_get_tplg_files() callback for Intel SOF I2S machines.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Use sof_i2s_get_tplg_files() for SOF es83x6 machines.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Copilot AI review requested due to automatic review settings July 9, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

{
int ret;

ret = sscanf(mach->sof_tplg_filename, "sof-%3s-*.tplg", platform);
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.

6 participants