]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: SOF: Introduce a new callback pair to be used for PCM delay reporting
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 21 Mar 2024 13:08:03 +0000 (15:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:17 +0000 (16:38 +0200)
commit217a7c1c8a8026abbdf59df4af5809c4210ca84a
tree9e44898ece77824596014d22d012c3f1c8864ef0
parentb3331377acd1e4e42918269676ba10f39574f20a
ASoC: SOF: Introduce a new callback pair to be used for PCM delay reporting

commit ce2faa9a180c1984225689b6b1cb26045f8b7470 upstream.

For delay calculation we need two information:
Number of bytes transferred between the DSP and host memory (ALSA buffer)
Number of frames transferred between the DSP and external device
(link/codec/DMIC/etc).

The reason for the different units (bytes vs frames) on host and dai side
is that the format on the dai side is decided by the firmware and might
not be the same as on the host side, thus the expectation is that the
counter reflects the number of frames.
The kernel know the host side format and in there we have access to the
DMA position which is in bytes.

In a simplified way, the DSP caused delay is the difference between the
two counters.

The existing get_stream_position callback is defined to retrieve the frame
counter on the DAI side but it's name is too generic to be intuitive and
makes it hard to define a callback for the host side.

This patch introduces a new set of callbacks to replace the
get_stream_position and define the host side equivalent:
get_dai_frame_counter
get_host_byte_counter

Subsequent patches will remove the old callback.

Cc: stable@vger.kernel.org # 6.8
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240321130814.4412-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/sof/ops.h
sound/soc/sof/sof-priv.h