Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sound/soc/sof/intel/hda-dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ static int hda_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct

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 ?

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

if (ret < 0) {
dev_err(sdev->dev, "%s: failed to clean up link DMA\n", __func__);
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/ipc3-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,5 @@ const struct sof_ipc_pcm_ops ipc3_pcm_ops = {
.hw_free = sof_ipc3_pcm_hw_free,
.trigger = sof_ipc3_pcm_trigger,
.dai_link_fixup = sof_ipc3_pcm_dai_link_fixup,
.reset_hw_params_during_stop = true,
};
3 changes: 2 additions & 1 deletion sound/soc/sof/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
fallthrough;
case SNDRV_PCM_TRIGGER_STOP:
ipc_first = true;
reset_hw_params = true;
if (pcm_ops && pcm_ops->reset_hw_params_during_stop)
reset_hw_params = true;
break;
default:
dev_err(component->dev, "Unhandled trigger cmd %d\n", cmd);
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/sof-audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ struct snd_sof_dai_config_data {
* @pcm_free: Function pointer for PCM free that can be used for freeing any
* additional memory in the SOF PCM stream structure
* @delay: Function pointer for pcm delay calculation
* @reset_hw_params_during_stop: Flag indicating whether the hw_params should be reset during the
* STOP pcm trigger
*/
struct sof_ipc_pcm_ops {
int (*hw_params)(struct snd_soc_component *component, struct snd_pcm_substream *substream,
Expand All @@ -117,6 +119,7 @@ struct sof_ipc_pcm_ops {
void (*pcm_free)(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm);
snd_pcm_sframes_t (*delay)(struct snd_soc_component *component,
struct snd_pcm_substream *substream);
bool reset_hw_params_during_stop;
};

/**
Expand Down