-
Notifications
You must be signed in to change notification settings - Fork 140
Abstract the DMA and Codec DAI ops for the BE DAI widgets #3972
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
Abstract the DMA and Codec DAI ops for the BE DAI widgets #3972
Conversation
787fa0e to
e945284
Compare
plbossart
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.
@ranj063 I think you're on to something with the .pre and .post trigger.
I added a bunch of comments to try and help clarify the code, most of the changes are confusing due to naming aliases to different concepts.
sound/soc/sof/intel/hda-dai.c
Outdated
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 is a bit confusion, if the ops are the same between IPC and IPC4 why do wee need the switch()?
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.
for SSP and the NHLT for IPC4
sound/soc/sof/intel/hda-dai.c
Outdated
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 didn't really follow how the hw_free and post-trigger were related. The naming points to different phases in the ALSA world.
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.
For IPC3, post_trigger does what hda_dai_hw_free_ipc(). For IPC4 also, we were doing the same and it made no sense. SO this patch actually fixes it
e945284 to
d56c49b
Compare
d56c49b to
ba07eb1
Compare
sound/soc/sof/intel/hda-dai.c
Outdated
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.
one variable per line?
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.
they are not initialized, so this is fine.
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.
it's still better to have one variable per line for consistency.
plbossart
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.
LGTM, we should probably do more testing overnight to see if we have any regressions, this is a rather intrusive patch.
Nice work @ranj063, I think this will help a lot clarify the sequences which were diluted with different ops and branches left and right.
|
@ujfalusi @RanderWang @bardliao @kv2019i @jsarha please prioritize this PR if you have a bit of time on Thursday 16, we are trying to complete this work before the Thanksgiving break. Friday will be too late for any interaction. |
sound/soc/sof/intel/hda-dai.c
Outdated
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.
%#x to print hex number ? It does not block me.
sound/soc/sof/intel/hda-dai.c
Outdated
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 like the layout
unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_PARAMS;
struct snd_sof_dai_config_data data = { 0 };
struct hdac_ext_stream *hext_stream;
sound/soc/sof/intel/hda-dai.c
Outdated
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.
why we need to init nhlt in hda_set_dai_drv_ops ? It is not a issue in this PR. we remove the switch for ipc version but leave one if for ipc version
RanderWang
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.
LGTM
ujfalusi
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.
@ranj063, this looks really nice!
The only thing holding me to Approve is that I can not follow optionality in struct hda_dai_widget_dma_ops.
assign_hext_stream is as mandatory as the get_hext_stream, which also brings the release_hext_stream as mandatory.
By the look, the other ops are really optional.
sound/soc/sof/intel/hda-dai.c
Outdated
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.
nitpick: I would print error when the get_ext_stream is missing to make it more obvious.
sound/soc/sof/intel/hda-dai.c
Outdated
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 got me here...
Only get_hext_stream is mandatory, which is to to retrieve the dma_data set by the optional assign_hext_stream.
If the assign_hext_stream is not set (optional!) and this is the first call here then the get_hext_stream is going to return with NULL and you are not going to get anything but NULL...
What I was saying is that most, if not all callbacks in struct hda_dai_widget_dma_ops are in fact mandatory, don't they?
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.
also to note: you also must have the release_hext_stream defined if you have the assign_hext_stream, but you must need to have the assign_hext_stream in order to have working stack.
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.
or you should not return with error in line 118?
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 conclusion for this thread is that assign/release need to be optional because couple mode will not need them
sound/soc/sof/intel/hda-dai.c
Outdated
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.
nitpick: would look better two lines down..
ujfalusi
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.
@ranj063, I'm OK with few fixups (checkpatch).
Let's see how this will behave in the wild and under the DSPless and ChainDMA cases.
Introduce a new ops structure for HDA DAI widget DMA ops and add a new field to struct snd_sof_dai that will be used to set the ops pointer for DAI widgets. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Define and set the get_hext_stream, assign_hext_stream and release_hext_stream DMA ops for HDA DAIs. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
…A ops Define and use the setup_hext_stream/reset_hext_stream DMA ops during link hw_params and cleanup. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Use the topology IPC dai_config to update the dai_config for HDA DAI widgets. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Define and use the SOF widget's DMA pre_trigger/trigger/post_trigger ops in ipc4_hda_dai_trigger(). Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Define the post_trigger DMA op for IPC3 and unify the DAI driver ops for IPC3 and IPC4 for HDA DAI's. Also, use the post_trigger op to stop the paused streams properly in the hda_dai_suspend() function. This fixes the suspend while paused case for IPC4 because previously we weren't resetting the pipeline when suspending the system with some paused streams. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Remove these functions and reuse hda_dai_config(). Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
ee710ae
5c11a0f to
ee710ae
Compare
Introduce SOF DAI ops to abstract the BE DAI widget DMA, codec_dai and dai_config ops. This change will allow adding the chained DMA mode or the DSP-less mode for the BE DAI widgets with a simple change like this: