Skip to content

Commit 019eed0

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 019eed0

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
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: 19 additions & 2 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,13 +448,29 @@ 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

459+
/* in the case of SoundWire we need to reset the PCMSyCM registers */
460+
ret = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
461+
0, /* cpu_dai->id -> PDI0 */
462+
0, 0, SNDRV_PCM_STREAM_PLAYBACK);
463+
if (ret)
464+
dev_err(dev, "%s: PCMSyCM PCMSyCM failed for TX: %d\n",
465+
__func__, ret);
466+
467+
ret = hdac_bus_eml_sdw_map_stream_ch(sof_to_bus(sdev), link_id,
468+
1, /* cpu_dai->id -> PDI1 */
469+
0, 0, SNDRV_PCM_STREAM_CAPTURE);
470+
if (ret)
471+
dev_err(dev, "%s: reset PCMSyCM failed for RX: %d\n",
472+
__func__, ret);
473+
457474
ret = hda_sdw_bpt_dma_deprepare(dev, bpt_rx_stream, dmab_rx_bdl);
458475

459476
ret1 = hda_sdw_bpt_dma_deprepare(dev, bpt_tx_stream, dmab_tx_bdl);

0 commit comments

Comments
 (0)