Commit c1a731c7 authored by Laurentiu Mihalcea's avatar Laurentiu Mihalcea Committed by Mark Brown

ASoC: SOF: compress: Add support for computing timestamps

We compute the number of pcm_io_frames by dividing the
dai position to size of a frame (channels * sample size).
Reviewed-by: default avatarPaul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarLaurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20220817080529.10864-5-daniel.baluta@oss.nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3ccbe688
......@@ -327,10 +327,21 @@ static int sof_compr_pointer(struct snd_soc_component *component,
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp)
{
u64 dai_posn;
struct snd_sof_pcm *spcm;
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct sof_compr_stream *sstream = cstream->runtime->private_data;
spcm = snd_sof_find_spcm_dai(component, rtd);
if (!spcm)
return -EINVAL;
dai_posn = spcm->stream[cstream->direction].posn.dai_posn;
tstamp->sampling_rate = sstream->sampling_rate;
tstamp->copied_total = sstream->copied_total;
tstamp->pcm_io_frames = div_u64(spcm->stream[cstream->direction].posn.dai_posn,
sstream->channels * sstream->sample_container_bytes);
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment