Skip to content

Commit bfdc6b8

Browse files
committed
ASoC: SOF: compress: Set compress data offset
Because now snd_sof_set_stream_data_offset has compress support we use it to set posn_offset for compress stream. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
1 parent ef8ba9f commit bfdc6b8

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎sound/soc/sof/compress.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "sof-audio.h"
1111
#include "sof-priv.h"
1212
#include "sof-utils.h"
13+
#include "ops.h"
1314

1415
static void sof_set_transferred_bytes(struct sof_compr_stream *sstream,
1516
u64 host_pos, u64 buffer_size)
@@ -164,6 +165,7 @@ static int sof_compr_set_params(struct snd_soc_component *component,
164165
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
165166
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
166167
struct snd_compr_runtime *crtd = cstream->runtime;
168+
struct sof_ipc_pcm_params_reply ipc_params_reply;
167169
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
168170
struct sof_ipc_fw_version *v = &ready->version;
169171
struct sof_compr_stream *sstream;
@@ -227,12 +229,21 @@ static int sof_compr_set_params(struct snd_soc_component *component,
227229

228230
memcpy((u8 *)pcm->params.ext_data, &params->codec, ext_data_size);
229231

230-
ret = sof_ipc_tx_message_no_reply(sdev->ipc, pcm, sizeof(*pcm) + ext_data_size);
232+
ret = sof_ipc_tx_message(sdev->ipc, pcm, sizeof(*pcm) + ext_data_size,
233+
&ipc_params_reply, sizeof(ipc_params_reply));
231234
if (ret < 0) {
232235
dev_err(component->dev, "error ipc failed\n");
233236
goto out;
234237
}
235238

239+
ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[cstream->direction],
240+
ipc_params_reply.posn_offset);
241+
if (ret < 0) {
242+
dev_err(component->dev, "Invalid stream data offset for Compr %d\n",
243+
spcm->pcm.pcm_id);
244+
goto out;
245+
}
246+
236247
sstream->sampling_rate = params->codec.sample_rate;
237248
sstream->channels = params->codec.ch_out;
238249
sstream->sample_container_bytes = pcm->params.sample_container_bytes;

0 commit comments

Comments
 (0)