Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Mar 9, 2023

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

@fredoh9
Copy link
Collaborator

fredoh9 commented Mar 9, 2023

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.

TPLG=/lib/firmware/intel/sof-ace-tplg/sof-mtl-nocodec.tplg ~/sof-test/test-case/check-signal-stop-start.sh -c 10 -m playback

However, same test for capture is still broken.

TPLG=/lib/firmware/intel/sof-ace-tplg/sof-mtl-nocodec.tplg ~/sof-test/test-case/check-signal-stop-start.sh -c 10 -m capture

@plbossart
Copy link
Member

@ranj063 is this really a MTL problem or more general all IPC4 targets are broken for start/stop?

@ranj063
Copy link
Collaborator Author

ranj063 commented Mar 10, 2023

@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

@ranj063 ranj063 changed the title ASoC: SOF: pcm: Always free widget list during stop/suspend trigger ASoC: SOF: pcm: Do not invoke sof_pcm_stream_free() during stop trigger Mar 10, 2023
@ranj063 ranj063 force-pushed the fix/start_stop branch 4 times, most recently from 479e0cf to 6b923fc Compare March 10, 2023 05:04
@ranj063 ranj063 marked this pull request as ready for review March 10, 2023 06:15
bardliao
bardliao previously approved these changes Mar 10, 2023
Copy link
Collaborator

@bardliao bardliao left a 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);

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);

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 ?

Copy link
Member

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?

Copy link

@RanderWang RanderWang Mar 14, 2023

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.

Copy link
Collaborator Author

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

Copy link

@RanderWang RanderWang Mar 14, 2023

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag was added for a reason, at least the commit message was very specific on what this is suppose to handle:
04c8027 ("ASoC: SOF: reset DMA state in prepare")

It might lost it's purpose and relevance over time, but aren't we going to break something with this?

@kv2019i ?

Copy link
Collaborator Author

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.

Copy link
Member

@plbossart plbossart left a 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);
Copy link
Member

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?

ranj063 added 2 commits March 13, 2023 17:49
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>
@ranj063 ranj063 requested a review from plbossart March 14, 2023 00:51
Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ranj063

@plbossart plbossart merged commit 63f8775 into thesofproject:topic/sof-dev Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] I/O error with DMIC capture pause/release on MTL

6 participants