* [PATCH] ASoC/soundwire: Intel: reset the PCMSyCM registers in hda_sdw_bpt_close
@ 2026-07-30 1:25 Bard Liao
2026-07-30 9:12 ` Pierre-Louis Bossart
0 siblings, 1 reply; 2+ messages in thread
From: Bard Liao @ 2026-07-30 1:25 UTC (permalink / raw)
To: linux-sound, broonie, tiwai, vkoul
Cc: vinod.koul, linux-kernel, pierre-louis.bossart, peter.ujfalusi,
bard.liao
Resetting the PCMSyCM registers is required for Intel SoundWire stream. The
same procedure is done in sdw_hda_dai_hw_params() for the normal
SoundWire stream, too.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
---
Mark/Vinod,
The change is mainly on the ASoC tree. Can we go via the ASoC tree?
---
drivers/soundwire/intel_ace2x.c | 4 +++-
include/sound/hda-sdw-bpt.h | 5 +++--
sound/soc/sof/intel/hda-sdw-bpt.c | 31 ++++++++++++++++++++++++++++---
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index b37933efac5d..63f131d5682b 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -261,6 +261,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
__func__, str_read_write(command), ret);
ret1 = hda_sdw_bpt_close(cdns->dev->parent, /* PCI device */
+ sdw->instance,
sdw->bpt_ctx.bpt_tx_stream, &sdw->bpt_ctx.dmab_tx_bdl,
sdw->bpt_ctx.bpt_rx_stream, &sdw->bpt_ctx.dmab_rx_bdl);
if (ret1 < 0)
@@ -295,7 +296,8 @@ static void intel_ace2x_bpt_close_stream(struct sdw_intel *sdw, struct sdw_slave
struct sdw_cdns *cdns = &sdw->cdns;
int ret;
- ret = hda_sdw_bpt_close(cdns->dev->parent /* PCI device */, sdw->bpt_ctx.bpt_tx_stream,
+ ret = hda_sdw_bpt_close(cdns->dev->parent /* PCI device */, sdw->instance,
+ sdw->bpt_ctx.bpt_tx_stream,
&sdw->bpt_ctx.dmab_tx_bdl, sdw->bpt_ctx.bpt_rx_stream,
&sdw->bpt_ctx.dmab_rx_bdl);
if (ret < 0)
diff --git a/include/sound/hda-sdw-bpt.h b/include/sound/hda-sdw-bpt.h
index 9b654c31829a..e24a549f7d49 100644
--- a/include/sound/hda-sdw-bpt.h
+++ b/include/sound/hda-sdw-bpt.h
@@ -27,7 +27,7 @@ int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_st
int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
struct hdac_ext_stream *bpt_rx_stream);
-int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
+int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *bpt_tx_stream,
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl);
@@ -58,7 +58,8 @@ static inline int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *b
return -EOPNOTSUPP;
}
-static inline int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
+static inline int hda_sdw_bpt_close(struct device *dev, int link_id,
+ struct hdac_ext_stream *bpt_tx_stream,
struct snd_dma_buffer *dmab_tx_bdl,
struct hdac_ext_stream *bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl)
diff --git a/sound/soc/sof/intel/hda-sdw-bpt.c b/sound/soc/sof/intel/hda-sdw-bpt.c
index c10648f56f23..ba9fbd662b85 100644
--- a/sound/soc/sof/intel/hda-sdw-bpt.c
+++ b/sound/soc/sof/intel/hda-sdw-bpt.c
@@ -322,7 +322,8 @@ int hda_sdw_bpt_open(struct device *dev, int link_id, struct hdac_ext_stream **b
__func__, ret);
close:
- ret1 = hda_sdw_bpt_close(dev, *bpt_tx_stream, dmab_tx_bdl, *bpt_rx_stream, dmab_rx_bdl);
+ ret1 = hda_sdw_bpt_close(dev, link_id, *bpt_tx_stream, dmab_tx_bdl,
+ *bpt_rx_stream, dmab_rx_bdl);
if (ret1 < 0)
dev_err(dev, "%s: hda_sdw_bpt_close failed: %d\n",
__func__, ret1);
@@ -447,14 +448,38 @@ int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
}
EXPORT_SYMBOL_NS(hda_sdw_bpt_wait, "SND_SOC_SOF_INTEL_HDA_SDW_BPT");
-int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
+int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *bpt_tx_stream,
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl)
{
+ struct snd_sof_dev *sdev = dev_get_drvdata(dev);
int ret;
int ret1;
- ret = hda_sdw_bpt_dma_deprepare(dev, bpt_rx_stream, dmab_rx_bdl);
+ /*
+ * In the case of SoundWire we need to reset the PCMSyCM registers.
+ * Need to continue depreparing the DMA buffers even if this fails.
+ */
+ ret = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
+ 0, /* PDI0 */
+ 0, 0, SNDRV_PCM_STREAM_PLAYBACK);
+ if (ret < 0)
+ dev_err(dev, "%s: hdac_bus_eml_sdw_map_stream_ch failed %d for PDI0\n",
+ __func__, ret);
+
+ ret1 = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
+ 1, /* PDI1 */
+ 0, 0, SNDRV_PCM_STREAM_CAPTURE);
+ if (ret1 < 0) {
+ dev_err(dev, "%s: hdac_bus_eml_sdw_map_stream_ch failed %d for PDI1\n",
+ __func__, ret1);
+ if (!ret)
+ ret = ret1;
+ }
+
+ ret1 = hda_sdw_bpt_dma_deprepare(dev, bpt_rx_stream, dmab_rx_bdl);
+ if (!ret)
+ ret = ret1;
ret1 = hda_sdw_bpt_dma_deprepare(dev, bpt_tx_stream, dmab_tx_bdl);
if (!ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC/soundwire: Intel: reset the PCMSyCM registers in hda_sdw_bpt_close
2026-07-30 1:25 [PATCH] ASoC/soundwire: Intel: reset the PCMSyCM registers in hda_sdw_bpt_close Bard Liao
@ 2026-07-30 9:12 ` Pierre-Louis Bossart
0 siblings, 0 replies; 2+ messages in thread
From: Pierre-Louis Bossart @ 2026-07-30 9:12 UTC (permalink / raw)
To: Bard Liao, linux-sound, broonie, tiwai, vkoul
Cc: vinod.koul, linux-kernel, peter.ujfalusi, bard.liao
On 7/30/26 03:25, Bard Liao wrote:
> Resetting the PCMSyCM registers is required for Intel SoundWire stream. The
> same procedure is done in sdw_hda_dai_hw_params() for the normal
it's actually in sdw_hda_dai_hw_free() for the regular cases, the
sequence is also used in hw_params() but for corner cases such as
xruns/drops, see comment:
/*
* reset the PCMSyCM registers to handle a prepare callback when the
PCM is restarted
* due to xruns or after a call to snd_pcm_drain/drop()
*/
No need to respin the patch for this nit-pick.
> SoundWire stream, too.
>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
LGTM, this patch makes the _close() sequence and api mimic the _open() one.
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-30 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 1:25 [PATCH] ASoC/soundwire: Intel: reset the PCMSyCM registers in hda_sdw_bpt_close Bard Liao
2026-07-30 9:12 ` Pierre-Louis Bossart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox