Skip to content

Commit

Permalink
ASoC: SOF: compress: Set compress data offset
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dbaluta committed Jan 16, 2023
1 parent ef8ba9f commit bfdc6b8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sound/soc/sof/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "sof-audio.h"
#include "sof-priv.h"
#include "sof-utils.h"
#include "ops.h"

static void sof_set_transferred_bytes(struct sof_compr_stream *sstream,
u64 host_pos, u64 buffer_size)
Expand Down Expand Up @@ -164,6 +165,7 @@ static int sof_compr_set_params(struct snd_soc_component *component,
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_compr_runtime *crtd = cstream->runtime;
struct sof_ipc_pcm_params_reply ipc_params_reply;
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
struct sof_ipc_fw_version *v = &ready->version;
struct sof_compr_stream *sstream;
Expand Down Expand Up @@ -227,12 +229,21 @@ static int sof_compr_set_params(struct snd_soc_component *component,

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

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

ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[cstream->direction],
ipc_params_reply.posn_offset);
if (ret < 0) {
dev_err(component->dev, "Invalid stream data offset for Compr %d\n",
spcm->pcm.pcm_id);
goto out;
}

sstream->sampling_rate = params->codec.sample_rate;
sstream->channels = params->codec.ch_out;
sstream->sample_container_bytes = pcm->params.sample_container_bytes;
Expand Down

0 comments on commit bfdc6b8

Please sign in to comment.