-
Notifications
You must be signed in to change notification settings - Fork 350
Smart amp to module #10490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Smart amp to module #10490
Conversation
Zephyr and broken pass through configuration fixes. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There is for no apparent reason a blob handler pointer model_handler in component data, remove it and remove select COMP_BLOB from Kconfig. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There was a problem hiding this 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 converts the smart_amp component from the legacy component driver model to the new module adapter framework, removing dependencies on component-specific APIs and updating to use processing_module infrastructure.
Changes:
- Replaced component driver interface with module adapter interface
- Updated memory allocation from legacy
rballoc/rfreeto module APImod_alloc/mod_free - Migrated IPC command handlers to new configuration APIs (
set_configuration/get_configuration)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/audio/smart_amp/smart_amp.c | Main conversion to module adapter interface, replacing component driver functions with module interface implementations |
| src/audio/smart_amp/smart_amp_passthru.c | Added LOG_MODULE_DECLARE and removed unused sof/bit.h include |
| src/audio/smart_amp/smart_amp_maxim_dsm.c | Added LOG_MODULE_DECLARE for logging integration |
| src/audio/smart_amp/Kconfig | Removed COMP_BLOB dependency no longer needed with module adapter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NOTE: This change has not been tested in any functional setup
For smart_amp to remain compatible with developing SOF it has to be
converted to use module API. The component API as such does not allow
llext loading or user-space usage. However, its unlikely the module
will work out of the box after this change, but in any case this
should make it easier to take smart_amp again into use.
This patch converts this component to module adapter API.
- New() becomes simpler init()
- Params() is handled in module adapter, in init()
"mod->verify_params_flags = BUFF_PARAMS_CHANNELS;" replaces
smart_amp_verify_params()
- Channels check in params() is placed to separate function
smart_amp_ipc4_params() to be called from prepare()
- cmd() handler is changed to module adapter client style with
smart_amp_set_configuration() and smart_amp_get_configuration().
- smart_amp_copy() becomes module API smart_amp_process() function
- smart_amo_prepare() picks sources and sink and does other
preparations for processing
- smart_amp_trigger() does the same thing as before, zeroes feedback
buffer at playback start
- Preliminary IPC4 support added
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Replace all rbmalloc() and rfree() usage with mod_alloc() and mod_free(). Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Fix a simple typo inherited from the component version. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
bd043d5 to
22b7368
Compare
| return NULL; | ||
| /* Copy IPC config */ | ||
| if (mcfg->avail) { | ||
| sad->ipc_config.data = mcfg->init_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the shallow copy suffice here? I see in other place that same data is rested to NULL after module init (see module_adapter_reset_data).
EDIT:
I noticed that in the original code we also don't make a full/deep copy, but at least some useful fields of the ipc_config_process structure (e.g. type) are copied here:
dev->ipc_config = *config;
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return NULL; | ||
| /* Copy IPC config */ | ||
| if (mcfg->avail) { | ||
| sad->ipc_config.data = mcfg->init_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copy made to the locally defined struct smart_amp_data can only be used in this file, and the only usage I can find is copying the data to the sad->config, if the size of the data is big enough.
While looking at the code there is no need to store the original data pointer anywhere as the only use is in the init (or comp_new) function. This is of course the only way it could work as the data is pointing directly to the IPC message box and the contents are gone after the init/com_new function returns.
The sof_ipc_process_type is not delivered to module init function, but if the module_asdapter code has done its job properly, then the whole *config should be copied to mod->dev->ipc_config. But if its not there, there is not much that can be done about it in module init code. In any case the smart_amp code does not access the mod->dev->ipc_config, so what ever the module_adapter code does I am sure its adequate when considering the rest of the FW.
Alla in all the target of this commit and PR was not to improve or refactor the smart_amp, but to bring the old component code to module age with minimal changes.
|
I started to do the llext additions too, but I do not have any toml data to begin with. Is there somewhere some documentation about the data that should be found in the module specific toml file? |
The llext stuff is still missing, but I had to go to sleep.
Anyway the conversion is ready AFAICT. The llext stuff can be added in separate PR.