summaryrefslogtreecommitdiff
path: root/sound/soc/sof/trace.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-03-11 20:21:11 +0000
committerMark Brown <broonie@kernel.org>2022-03-11 20:21:11 +0000
commitc0fc71e2d7d21ed8b2ee763d894517e4fec6ffc5 (patch)
tree180e22a96dc8c0a341646106a4d3b95090035689 /sound/soc/sof/trace.c
parentee60f738e3bcb75549a094ccb6396ae8ad6b9101 (diff)
parentd7be9e33c4ad71c299fd58c5d46d4407c0b42d86 (diff)
ASoC: SOF/Intel: small fixes and updates for 5.18
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: One important fix from Kai to restore DM1 L1 functionality, one important update from Peter to use DMA trace buffers as capture-only and sync them and a couple of minor updates for Intel/SOF platforms.
Diffstat (limited to 'sound/soc/sof/trace.c')
-rw-r--r--sound/soc/sof/trace.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c
index 104388c551cb..ea8e4506d02e 100644
--- a/sound/soc/sof/trace.c
+++ b/sound/soc/sof/trace.c
@@ -320,6 +320,13 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
if (count > avail)
count = avail;
+ /*
+ * make sure that all trace data is available for the CPU as the trace
+ * data buffer might be allocated from non consistent memory.
+ * Note: snd_dma_buffer_sync() is called for normal audio playback and
+ * capture streams also.
+ */
+ snd_dma_buffer_sync(&sdev->dmatb, SNDRV_DMA_SYNC_CPU);
/* copy available trace data to debugfs */
rem = copy_to_user(buffer, ((u8 *)(dfse->buf) + lpos), count);
if (rem)
@@ -464,8 +471,9 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev)
}
/* allocate trace data buffer */
- ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, sdev->dev,
- DMA_BUF_SIZE_FOR_TRACE, &sdev->dmatb);
+ ret = snd_dma_alloc_dir_pages(SNDRV_DMA_TYPE_DEV_SG, sdev->dev,
+ DMA_FROM_DEVICE, DMA_BUF_SIZE_FOR_TRACE,
+ &sdev->dmatb);
if (ret < 0) {
dev_err(sdev->dev,
"error: can't alloc buffer for trace %d\n", ret);