mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 22:34:33 +01:00
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: Paul Olaru <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Laurentiu Mihalcea <[email protected]> Signed-off-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
1 parent
3ccbe68877
commit
c1a731c713
1 file changed
+11
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user