diff mbox series

ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()

Message ID 20241107134957.25160-1-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit 7a117225b15b2d1dc021ab9fc36687c1e61ad2b1
Headers show
Series ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend() | expand

Commit Message

Peter Ujfalusi Nov. 7, 2024, 1:49 p.m. UTC
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

hda_dai_suspend() was added to handle paused stream during system
suspend. But as a side effect, it also ends up cleaning up the DMA
data for those streams that were prepared but not triggered before a
system suspend. Since these streams will not receive the prepare
callback after resuming, we need to preserve the DMA data during suspend.
So, add the check to handle only those streams that are in the paused
state to avoid losing the DMA data for all other streams.

Link: https://github.com/thesofproject/linux/issues/5080
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/intel/hda-dai.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mark Brown Nov. 7, 2024, 8:37 p.m. UTC | #1
On Thu, 07 Nov 2024 15:49:57 +0200, Peter Ujfalusi wrote:
> hda_dai_suspend() was added to handle paused stream during system
> suspend. But as a side effect, it also ends up cleaning up the DMA
> data for those streams that were prepared but not triggered before a
> system suspend. Since these streams will not receive the prepare
> callback after resuming, we need to preserve the DMA data during suspend.
> So, add the check to handle only those streams that are in the paused
> state to avoid losing the DMA data for all other streams.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
      commit: 7a117225b15b2d1dc021ab9fc36687c1e61ad2b1

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index ac505c7ad342..ee274d445515 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -646,6 +646,10 @@  static int hda_dai_suspend(struct hdac_bus *bus)
 			sdai = swidget->private;
 			ops = sdai->platform_private;
 
+			if (rtd->dpcm[hext_stream->link_substream->stream].state !=
+			    SND_SOC_DPCM_STATE_PAUSED)
+				continue;
+
 			/* for consistency with TRIGGER_SUSPEND  */
 			if (ops->post_trigger) {
 				ret = ops->post_trigger(sdev, cpu_dai,