-
Notifications
You must be signed in to change notification settings - Fork 140
ASoC: SOF: pcm: Do not invoke sof_pcm_stream_free() during stop trigger #4235
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
ASoC: SOF: pcm: Do not invoke sof_pcm_stream_free() during stop trigger #4235
Conversation
|
I'm able to verify that this fixes check-signal-stop-start test for playback. looks very solid pass with this fix. tested with NOCODEC mode.
However, same test for capture is still broken.
|
|
@ranj063 is this really a MTL problem or more general all IPC4 targets are broken for start/stop? |
@plbossart TGL/ADL seem to be OK. I'm now wondering if they work only by accident |
479e0cf to
6b923fc
Compare
bardliao
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
| switch (cmd) { | ||
| case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| case SNDRV_PCM_TRIGGER_STOP: | ||
| ret = hda_link_dma_cleanup(substream, hext_stream, dai); |
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.
hda_link_dma_prepare is called by ASoC framework, not by widget prepare. If we don't clean up hda_link_dma, do we need to skip some hda_link_dma_prepare ?
| switch (cmd) { | ||
| case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| case SNDRV_PCM_TRIGGER_STOP: | ||
| ret = hda_link_dma_cleanup(substream, hext_stream, dai); |
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.
hda_link_dma_prepare is called by ASoC framework, not by widget setup. If we don't clean up hda_link_dma, do we need to skip some hda_link_dma_prepare ?
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.
not following @RanderWang 's question. Can you please elaborate?
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.
hda_link_dma_cleanup is not called by TRIGGER STOP now, but where is hda_link_dma_prepare called ? hda_link_dma_prepare is paired with hda_link_dma_cleanup, if we remove one hda_link_dma_cleanup, do we need to remove one hda_link_dma_prepare ? I found hda_link_dma_prepare is called by ASoC framework directly.
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.
what do you mean by hda_link_dma_prepare? There is no such function? Anyway, if I can guess what you're asking, the stream tag is assigned in hda_link_hw_params() and with a repeated start, if the stream tag is not freed, prepare wouldnt really do anything, thus preserving the original stream tag for the start trigger
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.
o, my code is out of date. I can't find it after updating code
| struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); | ||
| const struct sof_ipc_pcm_ops *pcm_ops = sof_ipc_get_ops(sdev, pcm); | ||
| struct snd_sof_pcm *spcm; | ||
| bool reset_hw_params = false; |
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.
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.
@ujfalusi allot of has changed in terms of how we free the widgets with all.thenwork around ipc4. And if you think about it, platform_hw_params gets the stream tag and if with start/stop tests,.there's no setting up widgets again, we need preserve the original tag.
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.
Not following if the second patch is redundant or needed. Maybe a host- of link-dma difference between the two?
| switch (cmd) { | ||
| case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| case SNDRV_PCM_TRIGGER_STOP: | ||
| ret = hda_link_dma_cleanup(substream, hext_stream, dai); |
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.
not following @RanderWang 's question. Can you please elaborate?
In the case of repeated start/stop without involving hw_free, the stream tag needs to be preserved for the subsequent starts. So, skip performing the DMA clean up during stop and handle it only during suspend or hw_free. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
In the case of IPC4, since there is no PCM_PARAMS IPC to send the new stream tag when restarting a stream without a hw_free, the original stream tag needs to be preserved. So, add new a flag as part of struct sof_ipc_pcm_ops, reset_hw_params_during_stop and set it only for IPC3. This will ensure that the host DMA stream tag will not be given up during the STOP trigger for IPC4. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
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.
Thanks @ranj063
Signal start/stop tests perform stream start/stop and restart without doing a hw_free. This means that the widget list associated with a stream is never freed after a stop. Change this to always free the widget list during stop so that the behaviour will be consistent with the regular PCM open/close.
Partially fixes thesofproject/sof#6723 i.e. the check-signal-stop-start-playback-50.sh and check-signal-stop-start-capture-50.sh cases for MTL Nocodec