-
Notifications
You must be signed in to change notification settings - Fork 140
Add support for hostless pipelines #5571
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
Conversation
Add a couple of bitfields in the IPC message extension for pipelines to include the direction. This will be useful to set the direction for modules belonging to hostless pipelines. Signed-off-by: Ranjani Sridharan <[email protected]>
Add support for the siggen type widgets in order to support hostless pipelines with the tone generator module in the firmware. Signed-off-by: Ranjani Sridharan <[email protected]>
In the case of hostless pipelines, there are no AIF-type widgets and the tone generator is the source of the pipeline. For such pipelines, skip setting the host config when setting the hw params. Signed-off-by: Ranjani Sridharan <[email protected]>
This patch introduces the implementation of hostless pipelines in the SOF driver by leveraging virtual widgets for DAPM. Hostless pipelines are used in scenarios where audio data does not originate from or terminate at the host, such as internal DSP processing pipelines or feedback loops. The implementation includes: - Support for virtual widgets in the topology to represent hostless pipelines. These virtual widgets are solely for the purpose of propagating the hw_params confirguation to the codec in the absence of an AIF component. - Virtual widgets are treated as checkpoints to stop propagating widget setup/free in the SOF driver. This patch updates the logic to the widget setup and free routines to handle virtual widgets and the rest of pipeline downstream from a virtual widget. An example of a hostless pipeline in topology is: Virtual input widget -> ToneGen -> mixin -> mixout -> gain -> DAI widget This change enables the SOF driver to handle pipelines that are entirely internal to the DSP, improving support for use cases like sidetone, amplifier feedback, and other DSP-only processing scenarios. Signed-off-by: Ranjani Sridharan <[email protected]>
0720941 to
fb66474
Compare
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.
This only adds support for one type of use of a siggen, right?
Can you share some topology pictures how this suppose to look like?
In my mind the siggen is a DAI or an AIF, depending on the pipeline.
when it is an 'AIF':
siggen -> mixin -> mixout -> gain -> DAI widget
when it is a 'DAI':
siggen -> mixin -> mixout -> gain -> AIF widget
you can use the same module to generate audio to be played out on speaker, but you can use it to generate tone to be captured by host.
You can use the generated signal to be mixed with other audio and routed out to DAI or AIF.
From the tone generator's pow it does not matter if it is on capture or playback stream, doe it? It will generate signal to it's output and then that will traverse around in the path to the destination...
I also guess we can have a tone generator which emits 0 and does not hing else (special case of a tone I guess)
Another thing which would be a natural companion of tone generator is a /dev/null or black hole DAI/AIF which just eats up audio as it is receiving it..
This hostless playback can be enabled with a flip of a kcontrol? Or how this will work?
| #define SOF_IPC4_GLB_PIPE_EXT_CORE_ID(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT) | ||
|
|
||
| #define SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET_SHIFT 24 | ||
| #define SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET_SHIFT) |
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.
SOF_IPC4_GLB_PIPE_EXT_DIRECTION_VALID ?
|
|
||
| /* set pipeline direction */ | ||
| pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET(0x1); | ||
| pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION(dir); |
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.
Document what dir value is what direction, I assume playback is 0, capture is 1?
and to be safe with the integer:
pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION(!!dir);Another way to put this could be to
#define SOF_IPC4_GLB_PIPE_EXT_DIR_MASK GENMASK(25, 24)
#define SOF_IPC4_GLB_PIPE_EXT_DIR_SET(dir) ((dir + 1) << 24)
so:
0 means it is not provided
1 means it is playback direction
2 means capture
3 for later use
| #include "ops.h" | ||
|
|
||
| /* | ||
| * Check is a DAI widget is an aggregated DAI. Aggregated DAI's have names ending in numbers |
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.
Check if a DAI widget...
| { | ||
| return (WIDGET_IS_DAI(swidget->id) && | ||
| isdigit(swidget->widget->name[strlen(swidget->widget->name) - 1]) && | ||
| swidget->widget->name[strlen(swidget->widget->name) - 1] != '0'); |
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.
can you give some example how this looks like in real life?
dai-copier.HDA.iDisp1.playback - a read DAI
dai-copier.HDA.iDisp1.playback[1-9] - a fake DAI
?
What are these 'aggregate'? I have hard time to put this into context..
| goto sink_unprepare; | ||
|
|
||
| /* skip aggregated DAIs */ | ||
| if (!swidget || is_aggregated_dai(swidget)) |
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.
I think this is going to cause change in behavior?
- Previously we just returned in case of virtual_widget(), now we will proceed to sink_unprepare
- Now we will return instead of proceeding to sink_unprepare if swidget is NULL.
Are you sure of these changes will not have side effects?
| /* skip aggregated DAIs */ | ||
| if (!swidget || is_aggregated_dai(swidget)) | ||
| return 0; | ||
|
|
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.
Right, I think you are doing this deliberately...
| return snd_sof_find_swidget_sname_type(scomp, pcm_name, snd_soc_dapm_input); | ||
| } | ||
|
|
||
| return snd_sof_find_swidget_sname_type(scomp, pcm_name, snd_soc_dapm_aif_out); |
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.
Should we look for snd_soc_dapm_output if aif_out is not present?
| int i; | ||
|
|
||
| /* skip aggregated DAIs */ | ||
| if (!swidget || is_aggregated_dai(swidget)) |
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.
you are inside of if (swidget) {
| widget->id != snd_soc_dapm_input)) | ||
| continue; | ||
|
|
||
| /* starting widget for capture is DAI type */ |
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.
Similar change for capture?
| if (!swidget || is_aggregated_dai(swidget)) | ||
| return 0; | ||
|
|
||
| err = sof_widget_free(sdev, widget->dobj.private); |
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.
you can use swidget as parameter.
We'd need this kind of black hole component also for audio signal analysis, e.g. SPL meter that updates it's ALSA control for measured sound level. It reads and uses the source samples but produces no other output than occasional update of a control with notification to user space. |
|
replaced with #5609 |
This PR introduces the implementation of hostless pipelines in the SOF
driver by leveraging virtual widgets for DAPM. Hostless pipelines are used
in scenarios where audio data does not originate from or terminate at the
host, such as internal DSP processing pipelines or feedback loops.
The implementation includes:
These virtual widgets are solely for the purpose of propagating the
hw_params confirguation to the codec in the absence of a AIF component
setup/free in the SOF driver. This patch updates the logic to the
widget setup and free routines to handle virtual widgets and the rest of
pipeline downstream from a virtual widget.
An example of a hostless pipeline in topology is:
Virtual input widget -> ToneGen -> mixin -> mixout -> gain -> DAI widget
This change enables the SOF driver to handle pipelines that are entirely
internal to the DSP, improving support for use cases like sidetone,
amplifier feedback, and other DSP-only processing scenarios.