Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Sep 15, 2025

In preparation for preparing modules during the bind phase instead of pipeline trigger, move the code to count of the sinks/sources as and when they are connected.

Copilot AI review requested due to automatic review settings September 15, 2025 19:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves the counting of sink and source connections from the prepare phase to the bind phase in the module adapter. The change counts sinks and sources as they are connected during the bind operation instead of iterating through connected buffers during the prepare phase.

  • Remove sink/source counting code from the prepare phase
  • Add increment counters during bind operations for both sinks and sources

Reviewed Changes

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

File Description
src/audio/module_adapter/module_adapter.c Removes the code that counts sources and sinks during prepare phase
src/audio/module_adapter/module/generic.c Adds increment operations for sink/source counters during bind operations
Comments suppressed due to low confidence (1)

src/audio/module_adapter/module/generic.c:766

  • The unbind function increments counters during bind but doesn't decrement them during unbind. This will cause incorrect counts when components are unbound and rebound. Add mod->num_of_sinks-- and mod->num_of_sources-- in the respective unbind cases.
int module_unbind(struct processing_module *mod, struct bind_info *unbind_data)
{
	int ret;
	const struct module_interface *const ops = mod->dev->drv->adapter_ops;

	switch (unbind_data->bind_type) {
	case COMP_BIND_TYPE_SINK:
		ret = sink_unbind(unbind_data->sink);
		break;
	case COMP_BIND_TYPE_SOURCE:
		ret = source_unbind(unbind_data->source);
		break;
	default:
		ret = -EINVAL;
	}
	if (ret)
		return ret;

	if (ops->unbind)
		ret = ops->unbind(mod, unbind_data);

	return ret;
}

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

In preparation for preparing modules during the bind phase instead of
pipeline trigger, move the code to count of the sinks/sources as and
when they are bound/unbound.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Copy link
Collaborator

@softwarecki softwarecki left a comment

Choose a reason for hiding this comment

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

Do I understand correctly that modules are ultimately to be initialized during binding instead of triggering the pipeline?

@ranj063
Copy link
Collaborator Author

ranj063 commented Sep 16, 2025

Do I understand correctly that modules are ultimately to be initialized during binding instead of triggering the pipeline?

@softwarecki yes, thats the intention.

@kv2019i kv2019i merged commit ba3e73f into thesofproject:main Sep 17, 2025
38 of 45 checks passed
@ranj063 ranj063 deleted the fix/module_bind branch September 17, 2025 18:08
@dbaluta
Copy link
Collaborator

dbaluta commented Sep 22, 2025

@ranj063 This breaks any IPC3 topology. I propose to temporarily revert this once we figure out a better solution:

#10252

Will try to test every change related to module_adapter as of now, it looks like Intel doesn't use IPC3 anymore.

@ranj063
Copy link
Collaborator Author

ranj063 commented Sep 22, 2025

@ranj063 This breaks any IPC3 topology. I propose to temporarily revert this once we figure out a better solution:

#10252

Will try to test every change related to module_adapter as of now, it looks like Intel doesn't use IPC3 anymore.

@dbaluta Im good with the revert. I will start working on a better separation between IPC3 and IPC4 before I make invasive changes wrt pipeline prepare for IPC4.

@dbaluta
Copy link
Collaborator

dbaluta commented Sep 23, 2025

@dbaluta Im good with the revert. I will start working on a better separation between IPC3 and IPC4 before I make invasive changes wrt pipeline prepare for IPC4.

Thanks @ranj063 . Let sync and ping me to test each change before merging. Unfortunately we only are able to see our CI results just after the PR is merged.

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