[PATCH 02/10] ASoC: SOF: amd: acp-pcm: Take buffer information directly from runtime

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Mar 4 21:57:25 CET 2022


From: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>

Instead of using the values from ipc_params, take them directly from
substream->runtime.

This is in preparation of making the platform hw_params callback to be
IPC agnostic.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Reviewed-by: Rander Wang <rander.wang at intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta at nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 sound/soc/sof/amd/acp-pcm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/amd/acp-pcm.c b/sound/soc/sof/amd/acp-pcm.c
index 5b23830cb1f3..b49cc55980ae 100644
--- a/sound/soc/sof/amd/acp-pcm.c
+++ b/sound/soc/sof/amd/acp-pcm.c
@@ -19,13 +19,14 @@
 int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
 		      struct snd_pcm_hw_params *params, struct sof_ipc_stream_params *ipc_params)
 {
-	struct acp_dsp_stream *stream = substream->runtime->private_data;
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct acp_dsp_stream *stream = runtime->private_data;
 	unsigned int buf_offset, index;
 	u32 size;
 	int ret;
 
-	size = ipc_params->buffer.size;
-	stream->num_pages = ipc_params->buffer.pages;
+	size = runtime->dma_bytes;
+	stream->num_pages = PFN_UP(runtime->dma_bytes);
 	stream->dmab = substream->runtime->dma_buffer_p;
 
 	ret = acp_dsp_stream_config(sdev, stream);
-- 
2.30.2



More information about the Alsa-devel mailing list