Patch "ASoC: SOF: Intel: hda: Implement get_stream_position (Linear Link Position)" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: SOF: Intel: hda: Implement get_stream_position (Linear Link Position)

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-intel-hda-implement-get_stream_position-linear-link-position.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 67b182bea08a8d1092b91b57aefdfe420fce1634 Mon Sep 17 00:00:00 2001
From: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
Date: Thu, 21 Mar 2024 15:08:01 +0200
Subject: ASoC: SOF: Intel: hda: Implement get_stream_position (Linear Link Position)

From: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>

commit 67b182bea08a8d1092b91b57aefdfe420fce1634 upstream.

When the Linear Link Position is not available in firmware SRAM window we
use the host accessible position registers to read it.
The address of the PPLCLLPL/U registers depend on the number of streams
(playback+capture).
At probe time the pplc_addr is calculated for each stream and we can use
it to read the LLP without the need of address re-calculation.

Set the get_stream_position callback in sof_hda_common_ops for all
platforms:
The callback is used for IPC4 delay calculations only but the register is
a generic HDA register, not tied to any specific IPC version.

Cc: stable@xxxxxxxxxxxxxxx # 6.8
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
Reviewed-by: Rander Wang <rander.wang@xxxxxxxxx>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
Link: https://msgid.link/r/20240321130814.4412-5-peter.ujfalusi@xxxxxxxxxxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 sound/soc/sof/intel/hda-common-ops.c |    2 ++
 sound/soc/sof/intel/hda-stream.c     |   32 ++++++++++++++++++++++++++++++++
 sound/soc/sof/intel/hda.h            |    3 +++
 3 files changed, 37 insertions(+)

--- a/sound/soc/sof/intel/hda-common-ops.c
+++ b/sound/soc/sof/intel/hda-common-ops.c
@@ -57,6 +57,8 @@ struct snd_sof_dsp_ops sof_hda_common_op
 	.pcm_pointer	= hda_dsp_pcm_pointer,
 	.pcm_ack	= hda_dsp_pcm_ack,
 
+	.get_stream_position = hda_dsp_get_stream_llp,
+
 	/* firmware loading */
 	.load_firmware = snd_sof_load_firmware_raw,
 
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -1054,3 +1054,35 @@ snd_pcm_uframes_t hda_dsp_stream_get_pos
 
 	return pos;
 }
+
+/**
+ * hda_dsp_get_stream_llp - Retrieve the LLP (Linear Link Position) of the stream
+ * @sdev: SOF device
+ * @component: ASoC component
+ * @substream: PCM substream
+ *
+ * Returns the raw Linear Link Position value
+ */
+u64 hda_dsp_get_stream_llp(struct snd_sof_dev *sdev,
+			   struct snd_soc_component *component,
+			   struct snd_pcm_substream *substream)
+{
+	struct hdac_stream *hstream = substream->runtime->private_data;
+	struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream);
+	u32 llp_l, llp_u;
+
+	/*
+	 * The pplc_addr have been calculated during probe in
+	 * hda_dsp_stream_init():
+	 * pplc_addr = sdev->bar[HDA_DSP_PP_BAR] +
+	 *	       SOF_HDA_PPLC_BASE +
+	 *	       SOF_HDA_PPLC_MULTI * total_stream +
+	 *	       SOF_HDA_PPLC_INTERVAL * stream_index
+	 *
+	 * Use this pre-calculated address to avoid repeated re-calculation.
+	 */
+	llp_l = readl(hext_stream->pplc_addr + AZX_REG_PPLCLLPL);
+	llp_u = readl(hext_stream->pplc_addr + AZX_REG_PPLCLLPU);
+
+	return ((u64)llp_u << 32) | llp_l;
+}
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -657,6 +657,9 @@ bool hda_dsp_check_stream_irq(struct snd
 
 snd_pcm_uframes_t hda_dsp_stream_get_position(struct hdac_stream *hstream,
 					      int direction, bool can_sleep);
+u64 hda_dsp_get_stream_llp(struct snd_sof_dev *sdev,
+			   struct snd_soc_component *component,
+			   struct snd_pcm_substream *substream);
 
 struct hdac_ext_stream *
 	hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags);


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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux