Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream
@ 2026-02-03 11:40 Bard Liao
  2026-02-03 11:40 ` [PATCH 1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers Bard Liao
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Bard Liao @ 2026-02-03 11:40 UTC (permalink / raw)
  To: broonie, tiwai
  Cc: linux-sound, pierre-louis.bossart, bard.liao, peter.ujfalusi,
	ranjani.sridharan

Currently, hda_sdw_bpt_dma_prepare() get a HDA stream and use the link
DMA but doesn't reserve it. It works fine because we assume the
SwoundWire BPT will not run with audio streams simultaneously. Create
and use the new helpers to reserve the link DMA and allow running BPT
and audio stream simultaneously.

Bard Liao (3):
  ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
  ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
  ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT
    streams

 sound/soc/sof/intel/hda-loader.c  |  94 +-----------------
 sound/soc/sof/intel/hda-sdw-bpt.c |   5 +-
 sound/soc/sof/intel/hda-stream.c  | 157 +++++++++++++++++++++++++++++-
 sound/soc/sof/intel/hda.h         |  11 +++
 4 files changed, 171 insertions(+), 96 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
  2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
@ 2026-02-03 11:40 ` Bard Liao
  2026-02-03 11:40 ` [PATCH 2/3] ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers Bard Liao
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2026-02-03 11:40 UTC (permalink / raw)
  To: broonie, tiwai
  Cc: linux-sound, pierre-louis.bossart, bard.liao, peter.ujfalusi,
	ranjani.sridharan

Currently, hda_dsp_stream_get/put are used to get/put the host dma.
However, we may want to use a hda stream that both host and link dma are
available. Add helper to find the hda stream and reserve/release it.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/intel/hda-stream.c | 41 +++++++++++++++++++++++++++++---
 sound/soc/sof/intel/hda.h        |  3 +++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index 8fdaf1fdc338..36b647d987fc 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -210,8 +210,8 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
 }
 
 /* get next unused stream */
-struct hdac_ext_stream *
-hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
+static struct hdac_ext_stream *
+_hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags, bool pair)
 {
 	const struct sof_intel_dsp_desc *chip_info =  get_chip_info(sdev->pdata);
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
@@ -233,7 +233,14 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
 			if (hda_stream->host_reserved)
 				continue;
 
+			if (pair && hext_stream->link_locked)
+				continue;
+
 			s->opened = true;
+
+			if (pair)
+				hext_stream->link_locked = true;
+
 			break;
 		}
 	}
@@ -264,14 +271,27 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
 	return hext_stream;
 }
 
+struct hdac_ext_stream *
+hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags)
+{
+	return _hda_dsp_stream_get(sdev, direction, flags, false);
+}
+
+struct hdac_ext_stream *
+hda_dsp_stream_pair_get(struct snd_sof_dev *sdev, int direction, u32 flags)
+{
+	return _hda_dsp_stream_get(sdev, direction, flags, true);
+}
+
 /* free a stream */
-int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
+static int _hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag, bool pair)
 {
 	const struct sof_intel_dsp_desc *chip_info =  get_chip_info(sdev->pdata);
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 	struct hdac_bus *bus = sof_to_bus(sdev);
 	struct sof_intel_hda_stream *hda_stream;
 	struct hdac_ext_stream *hext_stream;
+	struct hdac_ext_stream *link_stream;
 	struct hdac_stream *s;
 	bool dmi_l1_enable = true;
 	bool found = false;
@@ -292,6 +312,8 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
 		if (s->direction == direction && s->stream_tag == stream_tag) {
 			s->opened = false;
 			found = true;
+			if (pair)
+				link_stream = hext_stream;
 		} else if (!(hda_stream->flags & SOF_HDA_STREAM_DMI_L1_COMPATIBLE)) {
 			dmi_l1_enable = false;
 		}
@@ -312,9 +334,22 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
 		return -ENODEV;
 	}
 
+	if (pair)
+		snd_hdac_ext_stream_release(link_stream, HDAC_EXT_STREAM_TYPE_LINK);
+
 	return 0;
 }
 
+int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
+{
+	return _hda_dsp_stream_put(sdev, direction, stream_tag, false);
+}
+
+int hda_dsp_stream_pair_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
+{
+	return _hda_dsp_stream_put(sdev, direction, stream_tag, true);
+}
+
 static int hda_dsp_stream_reset(struct snd_sof_dev *sdev, struct hdac_stream *hstream)
 {
 	int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 3be39c229c9f..9234e73f30fb 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -694,7 +694,10 @@ u64 hda_dsp_get_stream_ldp(struct snd_sof_dev *sdev,
 
 struct hdac_ext_stream *
 	hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction, u32 flags);
+struct hdac_ext_stream *
+	hda_dsp_stream_pair_get(struct snd_sof_dev *sdev, int direction, u32 flags);
 int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag);
+int hda_dsp_stream_pair_put(struct snd_sof_dev *sdev, int direction, int stream_tag);
 int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev,
 			       struct hdac_ext_stream *hext_stream,
 			       int enable, u32 size);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
  2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
  2026-02-03 11:40 ` [PATCH 1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers Bard Liao
@ 2026-02-03 11:40 ` Bard Liao
  2026-02-03 11:40 ` [PATCH 3/3] ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT streams Bard Liao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2026-02-03 11:40 UTC (permalink / raw)
  To: broonie, tiwai
  Cc: linux-sound, pierre-louis.bossart, bard.liao, peter.ujfalusi,
	ranjani.sridharan

SoundWire BPT stream needs to use link and host DMAs. Thus we need
helpers to prepare and cleanup the link and host DMAs. Currently the
SoundWire BPT stream uses hda_cl_prepare/cleanup helpers. It works fine
because we assume the SwoundWire BPT will not run with audio streams
simultaneously. The new helpers are copied from hda_cl_prepare/cleanup
and add a flag to reserve the paired host and link DMAs. The new helpers
will be used by both code loader and SoundWire BPT.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/intel/hda-loader.c |  94 +------------------------
 sound/soc/sof/intel/hda-stream.c | 116 +++++++++++++++++++++++++++++++
 sound/soc/sof/intel/hda.h        |   8 +++
 3 files changed, 127 insertions(+), 91 deletions(-)

diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c
index 2cc11d8b0f70..2b3abcf75d55 100644
--- a/sound/soc/sof/intel/hda-loader.c
+++ b/sound/soc/sof/intel/hda-loader.c
@@ -53,65 +53,8 @@ hda_cl_prepare(struct device *dev, unsigned int format, unsigned int size,
 	       struct snd_dma_buffer *dmab, bool persistent_buffer, int direction,
 	       bool is_iccmax)
 {
-	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
-	struct hdac_ext_stream *hext_stream;
-	struct hdac_stream *hstream;
-	int ret;
-
-	hext_stream = hda_dsp_stream_get(sdev, direction, 0);
-
-	if (!hext_stream) {
-		dev_err(sdev->dev, "error: no stream available\n");
-		return ERR_PTR(-ENODEV);
-	}
-	hstream = &hext_stream->hstream;
-	hstream->substream = NULL;
-
-	/*
-	 * Allocate DMA buffer if it is temporary or if the buffer is intended
-	 * to be persistent but not yet allocated.
-	 * We cannot rely solely on !dmab->area as caller might use a struct on
-	 * stack (when it is temporary) without clearing it to 0.
-	 */
-	if (!persistent_buffer || !dmab->area) {
-		ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, dev, size, dmab);
-		if (ret < 0) {
-			dev_err(sdev->dev, "%s: memory alloc failed: %d\n",
-				__func__, ret);
-			goto out_put;
-		}
-	}
-
-	hstream->period_bytes = 0;/* initialize period_bytes */
-	hstream->format_val = format;
-	hstream->bufsize = size;
-
-	if (is_iccmax) {
-		ret = hda_dsp_iccmax_stream_hw_params(sdev, hext_stream, dmab, NULL);
-		if (ret < 0) {
-			dev_err(sdev->dev, "error: iccmax stream prepare failed: %d\n", ret);
-			goto out_free;
-		}
-	} else {
-		ret = hda_dsp_stream_hw_params(sdev, hext_stream, dmab, NULL);
-		if (ret < 0) {
-			dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret);
-			goto out_free;
-		}
-		hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, size);
-	}
-
-	return hext_stream;
-
-out_free:
-	snd_dma_free_pages(dmab);
-	dmab->area = NULL;
-	dmab->bytes = 0;
-	hstream->bufsize = 0;
-	hstream->format_val = 0;
-out_put:
-	hda_dsp_stream_put(sdev, direction, hstream->stream_tag);
-	return ERR_PTR(ret);
+	return hda_data_stream_prepare(dev, format, size, dmab, persistent_buffer,
+				       direction, is_iccmax, false);
 }
 EXPORT_SYMBOL_NS(hda_cl_prepare, "SND_SOC_SOF_INTEL_HDA_COMMON");
 
@@ -275,38 +218,7 @@ EXPORT_SYMBOL_NS(hda_cl_trigger, "SND_SOC_SOF_INTEL_HDA_COMMON");
 int hda_cl_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
 			  bool persistent_buffer, struct hdac_ext_stream *hext_stream)
 {
-	struct snd_sof_dev *sdev =  dev_get_drvdata(dev);
-	struct hdac_stream *hstream = &hext_stream->hstream;
-	int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
-	int ret = 0;
-
-	if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
-		ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
-	else
-		snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
-					SOF_HDA_SD_CTL_DMA_START, 0);
-
-	hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag);
-	hstream->running = 0;
-	hstream->substream = NULL;
-
-	/* reset BDL address */
-	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
-			  sd_offset + SOF_HDA_ADSP_REG_SD_BDLPL, 0);
-	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
-			  sd_offset + SOF_HDA_ADSP_REG_SD_BDLPU, 0);
-
-	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset, 0);
-
-	if (!persistent_buffer) {
-		snd_dma_free_pages(dmab);
-		dmab->area = NULL;
-		dmab->bytes = 0;
-		hstream->bufsize = 0;
-		hstream->format_val = 0;
-	}
-
-	return ret;
+	return hda_data_stream_cleanup(dev, dmab, persistent_buffer, hext_stream, false);
 }
 EXPORT_SYMBOL_NS(hda_cl_cleanup, "SND_SOC_SOF_INTEL_HDA_COMMON");
 
diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index 36b647d987fc..1c04b5d9c0d8 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -1243,3 +1243,119 @@ u64 hda_dsp_get_stream_ldp(struct snd_sof_dev *sdev,
 	return ((u64)ldp_u << 32) | ldp_l;
 }
 EXPORT_SYMBOL_NS(hda_dsp_get_stream_ldp, "SND_SOC_SOF_INTEL_HDA_COMMON");
+
+struct hdac_ext_stream *
+hda_data_stream_prepare(struct device *dev, unsigned int format, unsigned int size,
+			struct snd_dma_buffer *dmab, bool persistent_buffer, int direction,
+			bool is_iccmax, bool pair)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	struct hdac_ext_stream *hext_stream;
+	struct hdac_stream *hstream;
+	int ret;
+
+	if (pair)
+		hext_stream = hda_dsp_stream_pair_get(sdev, direction, 0);
+	else
+		hext_stream = hda_dsp_stream_get(sdev, direction, 0);
+
+	if (!hext_stream) {
+		dev_err(sdev->dev, "%s: no stream available\n", __func__);
+		return ERR_PTR(-ENODEV);
+	}
+	hstream = &hext_stream->hstream;
+	hstream->substream = NULL;
+
+	/*
+	 * Allocate DMA buffer if it is temporary or if the buffer is intended
+	 * to be persistent but not yet allocated.
+	 * We cannot rely solely on !dmab->area as caller might use a struct on
+	 * stack (when it is temporary) without clearing it to 0.
+	 */
+	if (!persistent_buffer || !dmab->area) {
+		ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, dev, size, dmab);
+		if (ret < 0) {
+			dev_err(sdev->dev, "%s: memory alloc failed: %d\n",
+				__func__, ret);
+			goto out_put;
+		}
+	}
+
+	hstream->period_bytes = 0; /* initialize period_bytes */
+	hstream->format_val = format;
+	hstream->bufsize = size;
+
+	if (is_iccmax) {
+		ret = hda_dsp_iccmax_stream_hw_params(sdev, hext_stream, dmab, NULL);
+		if (ret < 0) {
+			dev_err(sdev->dev, "%s: iccmax stream prepare failed: %d\n",
+				__func__, ret);
+			goto out_free;
+		}
+	} else {
+		ret = hda_dsp_stream_hw_params(sdev, hext_stream, dmab, NULL);
+		if (ret < 0) {
+			dev_err(sdev->dev, "%s: hdac prepare failed: %d\n", __func__, ret);
+			goto out_free;
+		}
+		hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, size);
+	}
+
+	return hext_stream;
+
+out_free:
+	snd_dma_free_pages(dmab);
+	dmab->area = NULL;
+	dmab->bytes = 0;
+	hstream->bufsize = 0;
+	hstream->format_val = 0;
+out_put:
+	if (pair)
+		hda_dsp_stream_pair_put(sdev, direction, hstream->stream_tag);
+	else
+		hda_dsp_stream_put(sdev, direction, hstream->stream_tag);
+	return ERR_PTR(ret);
+}
+EXPORT_SYMBOL_NS(hda_data_stream_prepare, "SND_SOC_SOF_INTEL_HDA_COMMON");
+
+int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
+			    bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool pair)
+{
+	struct snd_sof_dev *sdev =  dev_get_drvdata(dev);
+	struct hdac_stream *hstream = hdac_stream(hext_stream);
+	int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
+	int ret = 0;
+
+	if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
+		ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
+	else
+		snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
+					SOF_HDA_SD_CTL_DMA_START, 0);
+
+	if (pair)
+		hda_dsp_stream_pair_put(sdev, hstream->direction, hstream->stream_tag);
+	else
+		hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag);
+
+	hstream->running = 0;
+	hstream->substream = NULL;
+
+	/* reset BDL address */
+	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
+			  sd_offset + SOF_HDA_ADSP_REG_SD_BDLPL, 0);
+	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR,
+			  sd_offset + SOF_HDA_ADSP_REG_SD_BDLPU, 0);
+
+	snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset, 0);
+
+	if (!persistent_buffer) {
+		snd_dma_free_pages(dmab);
+		dmab->area = NULL;
+		dmab->bytes = 0;
+		hstream->bufsize = 0;
+		hstream->format_val = 0;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_NS(hda_data_stream_cleanup, "SND_SOC_SOF_INTEL_HDA_COMMON");
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 9234e73f30fb..3fe00c269114 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -905,6 +905,14 @@ int sdw_hda_dai_hw_free(struct snd_pcm_substream *substream,
 int sdw_hda_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 			struct snd_soc_dai *cpu_dai);
 
+struct hdac_ext_stream *
+hda_data_stream_prepare(struct device *dev, unsigned int format, unsigned int size,
+			struct snd_dma_buffer *dmab, bool persistent_buffer, int direction,
+			bool is_iccmax, bool pair);
+
+int hda_data_stream_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
+			    bool persistent_buffer, struct hdac_ext_stream *hext_stream, bool pair);
+
 /* common dai driver */
 extern struct snd_soc_dai_driver skl_dai[];
 int hda_dsp_dais_suspend(struct snd_sof_dev *sdev);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT streams
  2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
  2026-02-03 11:40 ` [PATCH 1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers Bard Liao
  2026-02-03 11:40 ` [PATCH 2/3] ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers Bard Liao
@ 2026-02-03 11:40 ` Bard Liao
  2026-02-03 13:16 ` [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Pierre-Louis Bossart
  2026-02-04 12:00 ` Mark Brown
  4 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2026-02-03 11:40 UTC (permalink / raw)
  To: broonie, tiwai
  Cc: linux-sound, pierre-louis.bossart, bard.liao, peter.ujfalusi,
	ranjani.sridharan

Currently the SoundWire BPT stream uses the paired link DMA but not
reserve it. It works without any issue because we assume the SoundWire
BPT will not run with audio streams simultaneously.
To support simultaneous audio and BPT streams, we need to use the
hda_dma_prepare/cleanup helpers to reserve the pair link host DMA.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/intel/hda-sdw-bpt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda-sdw-bpt.c b/sound/soc/sof/intel/hda-sdw-bpt.c
index ae2f8d55dbd0..728ffe7ae54d 100644
--- a/sound/soc/sof/intel/hda-sdw-bpt.c
+++ b/sound/soc/sof/intel/hda-sdw-bpt.c
@@ -118,7 +118,8 @@ static int hda_sdw_bpt_dma_prepare(struct device *dev, struct hdac_ext_stream **
 
 	dev_dbg(dev, "direction %d format_val %#x\n", direction, format);
 
-	bpt_stream = hda_cl_prepare(dev, format, bpt_num_bytes, dmab_bdl, false, direction, false);
+	bpt_stream = hda_data_stream_prepare(dev, format, bpt_num_bytes, dmab_bdl,
+					     false, direction, false, true);
 	if (IS_ERR(bpt_stream)) {
 		dev_err(sdev->dev, "%s: SDW BPT DMA prepare failed: dir %d\n",
 			__func__, direction);
@@ -162,7 +163,7 @@ static int hda_sdw_bpt_dma_deprepare(struct device *dev, struct hdac_ext_stream
 	u32 mask;
 	int ret;
 
-	ret = hda_cl_cleanup(sdev->dev, dmab_bdl, false, sdw_bpt_stream);
+	ret = hda_data_stream_cleanup(sdev->dev, dmab_bdl, false, sdw_bpt_stream, true);
 	if (ret < 0) {
 		dev_err(sdev->dev, "%s: SDW BPT DMA cleanup failed\n",
 			__func__);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream
  2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
                   ` (2 preceding siblings ...)
  2026-02-03 11:40 ` [PATCH 3/3] ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT streams Bard Liao
@ 2026-02-03 13:16 ` Pierre-Louis Bossart
  2026-02-04 12:05   ` Liao, Bard
  2026-02-04 12:00 ` Mark Brown
  4 siblings, 1 reply; 7+ messages in thread
From: Pierre-Louis Bossart @ 2026-02-03 13:16 UTC (permalink / raw)
  To: Bard Liao, broonie, tiwai
  Cc: linux-sound, bard.liao, peter.ujfalusi, ranjani.sridharan

On 2/3/26 12:40, Bard Liao wrote:
> Currently, hda_sdw_bpt_dma_prepare() get a HDA stream and use the link
> DMA but doesn't reserve it. It works fine because we assume the
> SwoundWire BPT will not run with audio streams simultaneously. Create
> and use the new helpers to reserve the link DMA and allow running BPT
> and audio stream simultaneously.
> 
> Bard Liao (3):
>   ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
>   ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
>   ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT
>     streams

For the record this solution has two issues not documented in any commit message.

a) this will not work in 'dspless' mode, where the link DMA is not enabled. That's probably fine given that no one used that mode in production, but that's a software restriction that you will not be able to undo.

b) this raise the question of how bandwidth will be managed. The premise of BPT is that it uses all the bus bandwidth to guarantee predictable firmware download times. If the available bandwidth is restricted by other audio streams, then mechanically the startup latency will be increased and vary - or you will have to run the bus at a higher frequency to provision enough bandwidth for BPT but that means higher power consumption. Or you will have to change the bus clock dynamically which is possible at the hardware level for SDCA parts but not legacy ones.

I am not going to lay on the tracks for this low-level set of changes, but you'll have to address the b) opens for future contributions.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>

>  sound/soc/sof/intel/hda-loader.c  |  94 +-----------------
>  sound/soc/sof/intel/hda-sdw-bpt.c |   5 +-
>  sound/soc/sof/intel/hda-stream.c  | 157 +++++++++++++++++++++++++++++-
>  sound/soc/sof/intel/hda.h         |  11 +++
>  4 files changed, 171 insertions(+), 96 deletions(-)
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream
  2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
                   ` (3 preceding siblings ...)
  2026-02-03 13:16 ` [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Pierre-Louis Bossart
@ 2026-02-04 12:00 ` Mark Brown
  4 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-02-04 12:00 UTC (permalink / raw)
  To: tiwai, Bard Liao
  Cc: linux-sound, pierre-louis.bossart, bard.liao, peter.ujfalusi,
	ranjani.sridharan

On Tue, 03 Feb 2026 19:40:24 +0800, Bard Liao wrote:
> Currently, hda_sdw_bpt_dma_prepare() get a HDA stream and use the link
> DMA but doesn't reserve it. It works fine because we assume the
> SwoundWire BPT will not run with audio streams simultaneously. Create
> and use the new helpers to reserve the link DMA and allow running BPT
> and audio stream simultaneously.
> 
> Bard Liao (3):
>   ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
>   ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
>   ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT
>     streams
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
      commit: 89e1d632bb29e0915d801629d4a842ff609514e2
[2/3] ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
      commit: 8834ae896bfe10f239d49adb9cc76bb6a57c431c
[3/3] ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT streams
      commit: 330d1deb410fe75f7f79bd1e5025f2827365eb83

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream
  2026-02-03 13:16 ` [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Pierre-Louis Bossart
@ 2026-02-04 12:05   ` Liao, Bard
  0 siblings, 0 replies; 7+ messages in thread
From: Liao, Bard @ 2026-02-04 12:05 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Bard Liao, broonie@kernel.org,
	tiwai@suse.de
  Cc: linux-sound@vger.kernel.org, peter.ujfalusi@linux.intel.com,
	ranjani.sridharan@linux.intel.com



> -----Original Message-----
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
> Sent: Tuesday, February 3, 2026 9:17 PM
> To: Bard Liao <yung-chuan.liao@linux.intel.com>; broonie@kernel.org;
> tiwai@suse.de
> Cc: linux-sound@vger.kernel.org; Liao, Bard <bard.liao@intel.com>;
> peter.ujfalusi@linux.intel.com; ranjani.sridharan@linux.intel.com
> Subject: Re: [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt
> stream
> 
> On 2/3/26 12:40, Bard Liao wrote:
> > Currently, hda_sdw_bpt_dma_prepare() get a HDA stream and use the link
> > DMA but doesn't reserve it. It works fine because we assume the
> > SwoundWire BPT will not run with audio streams simultaneously. Create
> > and use the new helpers to reserve the link DMA and allow running BPT
> > and audio stream simultaneously.
> >
> > Bard Liao (3):
> >   ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers
> >   ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers
> >   ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT
> >     streams
> 
> For the record this solution has two issues not documented in any commit
> message.
> 
> a) this will not work in 'dspless' mode, where the link DMA is not enabled.
> That's probably fine given that no one used that mode in production, but
> that's a software restriction that you will not be able to undo.
> 
> b) this raise the question of how bandwidth will be managed. The premise of
> BPT is that it uses all the bus bandwidth to guarantee predictable firmware
> download times. If the available bandwidth is restricted by other audio
> streams, then mechanically the startup latency will be increased and vary - or
> you will have to run the bus at a higher frequency to provision enough
> bandwidth for BPT but that means higher power consumption. Or you will
> have to change the bus clock dynamically which is possible at the hardware
> level for SDCA parts but not legacy ones.
> 
> I am not going to lay on the tracks for this low-level set of changes, but you'll
> have to address the b) opens for future contributions.

Thanks Pierre for reminding me. I will always use the highest frequency
when a BPT stream is running. And I will reserve a few columns for the
audio streams. It will indeed reduce the BPT bandwidth, but it seems be
a necessary feature.

> 
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
> 
> >  sound/soc/sof/intel/hda-loader.c  |  94 +-----------------
> >  sound/soc/sof/intel/hda-sdw-bpt.c |   5 +-
> >  sound/soc/sof/intel/hda-stream.c  | 157
> +++++++++++++++++++++++++++++-
> >  sound/soc/sof/intel/hda.h         |  11 +++
> >  4 files changed, 171 insertions(+), 96 deletions(-)
> >


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-04 12:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 11:40 [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Bard Liao
2026-02-03 11:40 ` [PATCH 1/3] ASoC: SOF: Intel: add hda_dsp_stream_pair_get/put helpers Bard Liao
2026-02-03 11:40 ` [PATCH 2/3] ASoC: SOF: Intel: add hda_dma_prepare/cleanup helpers Bard Liao
2026-02-03 11:40 ` [PATCH 3/3] ASoC: SOF: Intel: hda-sdw-bpt: support simultaneous audio and BPT streams Bard Liao
2026-02-03 13:16 ` [PATCH 0/3]ASoC: SOF: Intel: reserve link DMA for sdw bpt stream Pierre-Louis Bossart
2026-02-04 12:05   ` Liao, Bard
2026-02-04 12:00 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox