Skip to content

Commit

Permalink
ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pierre-Louis Bossart authored and Vinod Koul committed Mar 10, 2025
1 parent 7f17a73 commit 5d5cb86
Show file tree
Hide file tree
Showing 4 changed files with 399 additions and 0 deletions.
69 changes: 69 additions & 0 deletions include/sound/hda-sdw-bpt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
/*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* Copyright(c) 2025 Intel Corporation.
*/

#ifndef __HDA_SDW_BPT_H
#define __HDA_SDW_BPT_H

#include <linux/device.h>

struct hdac_ext_stream;
struct snd_dma_buffer;

#if IS_ENABLED(CONFIG_SND_SOF_SOF_HDA_SDW_BPT)
int hda_sdw_bpt_open(struct device *dev, int link_id, struct hdac_ext_stream **bpt_tx_stream,
struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes,
u32 tx_dma_bandwidth, struct hdac_ext_stream **bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl, u32 bpt_rx_num_bytes,
u32 rx_dma_bandwidth);

int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
struct hdac_ext_stream *bpt_rx_stream);

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,
struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl);
#else
static inline int hda_sdw_bpt_open(struct device *dev, int link_id,
struct hdac_ext_stream **bpt_tx_stream,
struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes,
u32 tx_dma_bandwidth, struct hdac_ext_stream **bpt_rx_stream,
struct snd_dma_buffer *dmab_rx_bdl, u32 bpt_rx_num_bytes,
u32 rx_dma_bandwidth)
{
WARN_ONCE(1, "SoundWire BPT is disabled");
return -EOPNOTSUPP;
}

static inline int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
struct hdac_ext_stream *bpt_rx_stream)
{
WARN_ONCE(1, "SoundWire BPT is disabled");
return -EOPNOTSUPP;
}

static inline int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream,
struct hdac_ext_stream *bpt_rx_stream)
{
WARN_ONCE(1, "SoundWire BPT is disabled");
return -EOPNOTSUPP;
}

static inline int hda_sdw_bpt_close(struct device *dev, 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)
{
WARN_ONCE(1, "SoundWire BPT is disabled");
return -EOPNOTSUPP;
}
#endif

#endif /* __HDA_SDW_BPT_H */
7 changes: 7 additions & 0 deletions sound/soc/sof/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ config SND_SOC_SOF_INTEL_LNL
tristate
select SND_SOC_SOF_HDA_GENERIC
select SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
select SND_SOF_SOF_HDA_SDW_BPT if SND_SOC_SOF_INTEL_SOUNDWIRE
select SND_SOC_SOF_IPC4
select SND_SOC_SOF_INTEL_MTL

Expand Down Expand Up @@ -342,6 +343,12 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC

endif ## SND_SOC_SOF_HDA_GENERIC

config SND_SOF_SOF_HDA_SDW_BPT
tristate
help
This option is not user-selectable but automagically handled by
'select' statements at a higher level.

config SND_SOC_SOF_HDA_LINK_BASELINE
tristate
select SND_SOC_SOF_HDA if SND_SOC_SOF_HDA_LINK
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/sof/intel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ snd-sof-intel-hda-generic-y := hda.o hda-common-ops.o

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

snd-sof-intel-hda-sdw-bpt-objs := hda-sdw-bpt.o

snd-sof-intel-hda-common-$(CONFIG_SND_SOC_SOF_HDA_PROBES) += hda-probes.o

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

obj-$(CONFIG_SND_SOF_SOF_HDA_SDW_BPT) += snd-sof-intel-hda-sdw-bpt.o

snd-sof-pci-intel-tng-y := pci-tng.o
snd-sof-pci-intel-skl-y := pci-skl.o skl.o hda-loader-skl.o
snd-sof-pci-intel-apl-y := pci-apl.o apl.o
Expand Down
Loading

0 comments on commit 5d5cb86

Please sign in to comment.