This is a note to let you know that I've just added the patch titled ASoC: SOF: sof-pcm: Add pointer callback to sof_ipc_pcm_ops to the 6.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asoc-sof-sof-pcm-add-pointer-callback-to-sof_ipc_pcm_ops.patch and it can be found in the queue-6.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 77165bd955d55114028b06787a530b8f9220e4b0 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx> Date: Thu, 21 Mar 2024 15:08:11 +0200 Subject: ASoC: SOF: sof-pcm: Add pointer callback to sof_ipc_pcm_ops From: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx> commit 77165bd955d55114028b06787a530b8f9220e4b0 upstream. The IPC specific pointer callback can be used when additional or custom handling is needed during the pointer calculation, like executing a delay calculation at the same time to minimize drift between the reported pointer and the calculated delay. Cc: stable@xxxxxxxxxxxxxxx # 6.8 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx> Reviewed-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> Link: https://msgid.link/r/20240321130814.4412-15-peter.ujfalusi@xxxxxxxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/sof/pcm.c | 8 ++++++++ sound/soc/sof/sof-audio.h | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 33d576b17647..f03cee94bce6 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -388,13 +388,21 @@ static snd_pcm_uframes_t sof_pcm_pointer(struct snd_soc_component *component, { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); + const struct sof_ipc_pcm_ops *pcm_ops = sof_ipc_get_ops(sdev, pcm); struct snd_sof_pcm *spcm; snd_pcm_uframes_t host, dai; + int ret = -EOPNOTSUPP; /* nothing to do for BE */ if (rtd->dai_link->no_pcm) return 0; + if (pcm_ops && pcm_ops->pointer) + ret = pcm_ops->pointer(component, substream, &host); + + if (ret != -EOPNOTSUPP) + return ret ? ret : host; + /* use dsp ops pointer callback directly if set */ if (sof_ops(sdev)->pcm_pointer) return sof_ops(sdev)->pcm_pointer(sdev, substream); diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 04e5cb2c70a7..86bbb531e142 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -103,7 +103,10 @@ struct snd_sof_dai_config_data { * additional memory in the SOF PCM stream structure * @pcm_free: Function pointer for PCM free that can be used for freeing any * additional memory in the SOF PCM stream structure - * @delay: Function pointer for pcm delay calculation + * @pointer: Function pointer for pcm pointer + * Note: the @pointer callback may return -EOPNOTSUPP which should be + * handled in a same way as if the callback is not provided + * @delay: Function pointer for pcm delay reporting * @reset_hw_params_during_stop: Flag indicating whether the hw_params should be reset during the * STOP pcm trigger * @ipc_first_on_start: Send IPC before invoking platform trigger during @@ -124,6 +127,9 @@ struct sof_ipc_pcm_ops { int (*dai_link_fixup)(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params); int (*pcm_setup)(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm); void (*pcm_free)(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm); + int (*pointer)(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + snd_pcm_uframes_t *pointer); snd_pcm_sframes_t (*delay)(struct snd_soc_component *component, struct snd_pcm_substream *substream); bool reset_hw_params_during_stop; -- 2.44.0 Patches currently in stable-queue which might be from peter.ujfalusi@xxxxxxxxxxxxxxx are queue-6.8/asoc-sof-intel-hda-implement-get_stream_position-linear-link-position.patch queue-6.8/asoc-sof-intel-mtl-lnl-use-the-generic-get_stream_position-callback.patch queue-6.8/asoc-sof-add-dsp_max_burst_size_in_ms-member-to-snd_sof_pcm_stream.patch queue-6.8/asoc-sof-intel-hda-pcm-use-dsp_max_burst_size_in_ms-to-place-constraint.patch queue-6.8/asoc-sof-intel-hda-common-ops-do-not-set-the-get_stream_position-callback.patch queue-6.8/asoc-sof-intel-set-the-dai-host-get-frame-byte-counter-callbacks.patch queue-6.8/asoc-sof-introduce-a-new-callback-pair-to-be-used-for-pcm-delay-reporting.patch queue-6.8/asoc-sof-ipc4-pcm-use-the-snd_sof_pcm_get_dai_frame_counter-for-pcm_delay.patch queue-6.8/asoc-sof-ipc4-topology-save-the-dma-maximum-burst-size-for-pcms.patch queue-6.8/alsa-hda-add-pplcllpl-u-members-to-hdac_ext_stream.patch queue-6.8/asoc-sof-remove-the-get_stream_position-callback.patch queue-6.8/asoc-sof-ipc4-pcm-correct-the-delay-calculation.patch queue-6.8/asoc-sof-ipc4-pcm-combine-the-sof_ipc4_pipe_paused-cases-in-pcm_trigger.patch queue-6.8/asoc-sof-sof-pcm-add-pointer-callback-to-sof_ipc_pcm_ops.patch queue-6.8/asoc-sof-intel-hda-compensate-llp-in-case-it-is-not-reset.patch queue-6.8/asoc-sof-ipc4-pcm-move-struct-sof_ipc4_timestamp_info-definition-locally.patch queue-6.8/asoc-sof-ipc4-pcm-invalidate-the-stream_start_offset-in-paused-state.patch