Skip to content

Commit 5d5cb86

Browse files
plbossartvinodkoul
authored andcommitted
ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA
Add SoundWire BPT DMA helpers as a separate module to avoid circular dependencies. For now this assumes no link DMA, only coupled mode. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> 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> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Acked-by: Mark Brown <broonie@kernel.org> Tested-by: shumingf@realtek.com Link: https://lore.kernel.org/r/20250227140615.8147-12-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 7f17a73 commit 5d5cb86

File tree

4 files changed

+399
-0
lines changed

4 files changed

+399
-0
lines changed

include/sound/hda-sdw-bpt.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2+
/*
3+
* This file is provided under a dual BSD/GPLv2 license. When using or
4+
* redistributing this file, you may do so under either license.
5+
*
6+
* Copyright(c) 2025 Intel Corporation.
7+
*/
8+
9+
#ifndef __HDA_SDW_BPT_H
10+
#define __HDA_SDW_BPT_H
11+
12+
#include <linux/device.h>
13+
14+
struct hdac_ext_stream;
15+
struct snd_dma_buffer;
16+
17+
#if IS_ENABLED(CONFIG_SND_SOF_SOF_HDA_SDW_BPT)
18+
int hda_sdw_bpt_open(struct device *dev, int link_id, struct hdac_ext_stream **bpt_tx_stream,
19+
struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes,
20+
u32 tx_dma_bandwidth, struct hdac_ext_stream **bpt_rx_stream,
21+
struct snd_dma_buffer *dmab_rx_bdl, u32 bpt_rx_num_bytes,
22+
u32 rx_dma_bandwidth);
23+
24+
int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
25+
struct hdac_ext_stream *bpt_rx_stream);
26+
27+
int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
28+
struct hdac_ext_stream *bpt_rx_stream);
29+
30+
int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
31+
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
32+
struct snd_dma_buffer *dmab_rx_bdl);
33+
#else
34+
static inline int hda_sdw_bpt_open(struct device *dev, int link_id,
35+
struct hdac_ext_stream **bpt_tx_stream,
36+
struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes,
37+
u32 tx_dma_bandwidth, struct hdac_ext_stream **bpt_rx_stream,
38+
struct snd_dma_buffer *dmab_rx_bdl, u32 bpt_rx_num_bytes,
39+
u32 rx_dma_bandwidth)
40+
{
41+
WARN_ONCE(1, "SoundWire BPT is disabled");
42+
return -EOPNOTSUPP;
43+
}
44+
45+
static inline int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
46+
struct hdac_ext_stream *bpt_rx_stream)
47+
{
48+
WARN_ONCE(1, "SoundWire BPT is disabled");
49+
return -EOPNOTSUPP;
50+
}
51+
52+
static inline int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
53+
struct hdac_ext_stream *bpt_rx_stream)
54+
{
55+
WARN_ONCE(1, "SoundWire BPT is disabled");
56+
return -EOPNOTSUPP;
57+
}
58+
59+
static inline int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
60+
struct snd_dma_buffer *dmab_tx_bdl,
61+
struct hdac_ext_stream *bpt_rx_stream,
62+
struct snd_dma_buffer *dmab_rx_bdl)
63+
{
64+
WARN_ONCE(1, "SoundWire BPT is disabled");
65+
return -EOPNOTSUPP;
66+
}
67+
#endif
68+
69+
#endif /* __HDA_SDW_BPT_H */

sound/soc/sof/intel/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ config SND_SOC_SOF_INTEL_LNL
268268
tristate
269269
select SND_SOC_SOF_HDA_GENERIC
270270
select SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
271+
select SND_SOF_SOF_HDA_SDW_BPT if SND_SOC_SOF_INTEL_SOUNDWIRE
271272
select SND_SOC_SOF_IPC4
272273
select SND_SOC_SOF_INTEL_MTL
273274

@@ -342,6 +343,12 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC
342343

343344
endif ## SND_SOC_SOF_HDA_GENERIC
344345

346+
config SND_SOF_SOF_HDA_SDW_BPT
347+
tristate
348+
help
349+
This option is not user-selectable but automagically handled by
350+
'select' statements at a higher level.
351+
345352
config SND_SOC_SOF_HDA_LINK_BASELINE
346353
tristate
347354
select SND_SOC_SOF_HDA if SND_SOC_SOF_HDA_LINK

sound/soc/sof/intel/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ snd-sof-intel-hda-generic-y := hda.o hda-common-ops.o
1212

1313
snd-sof-intel-hda-mlink-y := hda-mlink.o
1414

15+
snd-sof-intel-hda-sdw-bpt-objs := hda-sdw-bpt.o
16+
1517
snd-sof-intel-hda-common-$(CONFIG_SND_SOC_SOF_HDA_PROBES) += hda-probes.o
1618

1719
snd-sof-intel-hda-y := hda-codec.o
@@ -26,6 +28,8 @@ obj-$(CONFIG_SND_SOC_SOF_HDA_GENERIC) += snd-sof-intel-hda-generic.o
2628
obj-$(CONFIG_SND_SOC_SOF_HDA_MLINK) += snd-sof-intel-hda-mlink.o
2729
obj-$(CONFIG_SND_SOC_SOF_HDA) += snd-sof-intel-hda.o
2830

31+
obj-$(CONFIG_SND_SOF_SOF_HDA_SDW_BPT) += snd-sof-intel-hda-sdw-bpt.o
32+
2933
snd-sof-pci-intel-tng-y := pci-tng.o
3034
snd-sof-pci-intel-skl-y := pci-skl.o skl.o hda-loader-skl.o
3135
snd-sof-pci-intel-apl-y := pci-apl.o apl.o

0 commit comments

Comments
 (0)