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
| 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.
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.
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.
not following @RanderWang 's question. Can you please elaborate?
There was a problem hiding this comment.
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.
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.
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.
There was a problem hiding this comment.
@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.
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.
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>
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