Skip to content

ASoC: Intel: sof-function-topology-lib: Provide option to skip function topology loading - #5998

Open
bardliao wants to merge 1 commit into
thesofproject:topic/sof-devfrom
bardliao:mask_function_topology
Open

bardliao wants to merge 1 commit into
thesofproject:topic/sof-devfrom
bardliao:mask_function_topology

Conversation

@bardliao

Copy link
Copy Markdown
Collaborator

A function topology provides a standard pipeline. Although feature topologies allow appending widgets, they do not support modifying or inserting widgets into the middle of the pipeline. To achieve this, users must deploy a customized topology.

Add support to bypass loading function topologies so that custom topologies can be loaded directly through the 'feature_topologies' module parameter.

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.

🟡 Changes recommended

A zero mask aborts loading before custom feature topologies can load, preventing the intended custom-only configuration.

1 open issue
What changed in this PR

This PR adds configurable function-topology selection to Intel SOF, aiming to let custom topologies supplied through feature_topologies replace standard pipelines.

Changes:

  • Adds a read-only function_tplg_mask module parameter, defaulting to all devices.
  • Applies the mask to SoundWire and I2S topology discovery with best-effort loading.
  • Returns an error when an explicit mask yields no function topologies.
File Description
sound/​soc/​intel/​common/​sof-function-topology-lib.c Adds mask-based function-topology selection and empty-selection checks.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 23, 2026 09:13
@bardliao
bardliao force-pushed the mask_function_topology branch from 5878b6d to 01cbec4 Compare October 23, 2026 09:13

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.

🔵 Needs a closer look

Explicit-mask behavior, monolithic fallback, and variant selection need maintainer validation across SoundWire and I2S configurations.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

{
char *filename = NULL;
const struct firmware *fw;
char *variant_name = NULL;

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.

char *variant_name __free(kfree) = NULL; ?

filename = devm_kasprintf(dev, GFP_KERNEL, "%s/sof-%s-%s-id%d",
prefix, platform, tplg_dev_name, dai_link_id);
if (function_variant_count)
variant_name = devm_kasprintf(dev, GFP_KERNEL,

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.

why do you use devm variant? The variant_name is only used locally.

const struct firmware *fw;
char *variant_name = NULL;
char *tplg_filename;
char *filename;

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.

char *filename __free(kfree) = NULL; and you save on free all around the place?

break;
default:
filename = devm_kasprintf(dev, GFP_KERNEL, "%s/sof-%s-id%d.tplg",
filename = devm_kasprintf(dev, GFP_KERNEL, "%s/sof-%s-id%d",

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 used locally, no need for devm_ ?

int dai_link_id, int tplg_dev)
{
char *filename = NULL;
const struct firmware *fw;

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 only use this under the if() within the loop, why not move it there?

static int function_tplg_mask = -1;
module_param(function_tplg_mask, int, 0444);
MODULE_PARM_DESC(function_tplg_mask,
"Function topology selection mask, BIT(tplg_device_id); -1: all devices");

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.

why this is useful? Disabling BT on non Chrome products is one that I can think of, but other than that?

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.

Indeed, there is no strong reason to have it. I will drop the commit for now.

@bardliao
bardliao force-pushed the mask_function_topology branch from 01cbec4 to acc8a6c Compare November 4, 2026 12:55
Copilot AI balanced review requested due to automatic review settings November 4, 2026 12:55

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.

🟡 Changes recommended

The help text documents feature names instead of the required function-topology basename, so following it can silently leave the default topology selected.

1 open issue

Review effort: Balanced

While we can load feature topologies to add features to the generial
function topology, we can not change the modules in the function
topology. This commit allow selecting function topology variants
through the feature_variant module parameter to use the variant
function topology instead of the generic function topology.
Fall back to the generic topology when a configured variant is
unavailable.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@bardliao
bardliao force-pushed the mask_function_topology branch from acc8a6c to d111f14 Compare November 4, 2026 13:17
Copilot AI balanced review requested due to automatic review settings November 4, 2026 13:17

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.

🟢 Approval recommended

No active review issues are identified for the per-function topology variant selection change.

1 open issue

Review effort: Balanced

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