Skip to content

Commit ab31212

Browse files
committed
ASoC/soundwire: Intel: reset the PCMSyCM registers in hda_sdw_bpt_close
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>
1 parent b309a4a commit ab31212

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

drivers/soundwire/intel_ace2x.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ static int intel_ace2x_bpt_open_stream(struct sdw_intel *sdw, struct sdw_slave *
261261
__func__, str_read_write(command), ret);
262262

263263
ret1 = hda_sdw_bpt_close(cdns->dev->parent, /* PCI device */
264+
sdw->instance,
264265
sdw->bpt_ctx.bpt_tx_stream, &sdw->bpt_ctx.dmab_tx_bdl,
265266
sdw->bpt_ctx.bpt_rx_stream, &sdw->bpt_ctx.dmab_rx_bdl);
266267
if (ret1 < 0)
@@ -295,7 +296,8 @@ static void intel_ace2x_bpt_close_stream(struct sdw_intel *sdw, struct sdw_slave
295296
struct sdw_cdns *cdns = &sdw->cdns;
296297
int ret;
297298

298-
ret = hda_sdw_bpt_close(cdns->dev->parent /* PCI device */, sdw->bpt_ctx.bpt_tx_stream,
299+
ret = hda_sdw_bpt_close(cdns->dev->parent /* PCI device */, sdw->instance,
300+
sdw->bpt_ctx.bpt_tx_stream,
299301
&sdw->bpt_ctx.dmab_tx_bdl, sdw->bpt_ctx.bpt_rx_stream,
300302
&sdw->bpt_ctx.dmab_rx_bdl);
301303
if (ret < 0)

include/sound/hda-sdw-bpt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_st
2727
int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
2828
struct hdac_ext_stream *bpt_rx_stream);
2929

30-
int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
30+
int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *bpt_tx_stream,
3131
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
3232
struct snd_dma_buffer *dmab_rx_bdl);
3333

@@ -58,7 +58,8 @@ static inline int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *b
5858
return -EOPNOTSUPP;
5959
}
6060

61-
static inline int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
61+
static inline int hda_sdw_bpt_close(struct device *dev, int link_id,
62+
struct hdac_ext_stream *bpt_tx_stream,
6263
struct snd_dma_buffer *dmab_tx_bdl,
6364
struct hdac_ext_stream *bpt_rx_stream,
6465
struct snd_dma_buffer *dmab_rx_bdl)

sound/soc/sof/intel/hda-sdw-bpt.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ int hda_sdw_bpt_open(struct device *dev, int link_id, struct hdac_ext_stream **b
322322
__func__, ret);
323323

324324
close:
325-
ret1 = hda_sdw_bpt_close(dev, *bpt_tx_stream, dmab_tx_bdl, *bpt_rx_stream, dmab_rx_bdl);
325+
ret1 = hda_sdw_bpt_close(dev, link_id, *bpt_tx_stream, dmab_tx_bdl,
326+
*bpt_rx_stream, dmab_rx_bdl);
326327
if (ret1 < 0)
327328
dev_err(dev, "%s: hda_sdw_bpt_close failed: %d\n",
328329
__func__, ret1);
@@ -447,14 +448,38 @@ int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
447448
}
448449
EXPORT_SYMBOL_NS(hda_sdw_bpt_wait, "SND_SOC_SOF_INTEL_HDA_SDW_BPT");
449450

450-
int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
451+
int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *bpt_tx_stream,
451452
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
452453
struct snd_dma_buffer *dmab_rx_bdl)
453454
{
455+
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
454456
int ret;
455457
int ret1;
456458

457-
ret = hda_sdw_bpt_dma_deprepare(dev, bpt_rx_stream, dmab_rx_bdl);
459+
/*
460+
* In the case of SoundWire we need to reset the PCMSyCM registers.
461+
* Need to continue depreparing the DMA buffers even if this fails.
462+
*/
463+
ret = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
464+
0, /* PDI0 */
465+
0, 0, SNDRV_PCM_STREAM_PLAYBACK);
466+
if (ret < 0)
467+
dev_err(dev, "%s: hdac_bus_eml_sdw_map_stream_ch failed %d for PDI0\n",
468+
__func__, ret);
469+
470+
ret1 = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
471+
1, /* PDI1 */
472+
0, 0, SNDRV_PCM_STREAM_CAPTURE);
473+
if (ret1 < 0) {
474+
dev_err(dev, "%s: hdac_bus_eml_sdw_map_stream_ch failed %d for PDI1\n",
475+
__func__, ret1);
476+
if (!ret)
477+
ret = ret1;
478+
}
479+
480+
ret1 = hda_sdw_bpt_dma_deprepare(dev, bpt_rx_stream, dmab_rx_bdl);
481+
if (!ret)
482+
ret = ret1;
458483

459484
ret1 = hda_sdw_bpt_dma_deprepare(dev, bpt_tx_stream, dmab_tx_bdl);
460485
if (!ret)

0 commit comments

Comments
 (0)