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 34 unsigned int hda_sdw_bpt_get_buf_size_alignment(unsigned int dma_bandwidth); 35 #else 36 static inline int hda_sdw_bpt_open(struct device *dev, int link_id, 37 struct hdac_ext_stream **bpt_tx_stream, 38 struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes, 39 u32 tx_dma_bandwidth, struct hdac_ext_stream **bpt_rx_stream, 40 struct snd_dma_buffer *dmab_rx_bdl, u32 bpt_rx_num_bytes, 41 u32 rx_dma_bandwidth) 42 { 43 WARN_ONCE(1, "SoundWire BPT is disabled"); 44 return -EOPNOTSUPP; 45 } 46 47 static inline int hda_sdw_bpt_send_async(struct device *dev, struct hdac_ext_stream *bpt_tx_stream, 48 struct hdac_ext_stream *bpt_rx_stream) 49 { 50 WARN_ONCE(1, "SoundWire BPT is disabled"); 51 return -EOPNOTSUPP; 52 } 53 54 static inline int hda_sdw_bpt_wait(struct device *dev, struct hdac_ext_stream *bpt_tx_stream, 55 struct hdac_ext_stream *bpt_rx_stream) 56 { 57 WARN_ONCE(1, "SoundWire BPT is disabled"); 58 return -EOPNOTSUPP; 59 } 60 61 static inline int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream, 62 struct snd_dma_buffer *dmab_tx_bdl, 63 struct hdac_ext_stream *bpt_rx_stream, 64 struct snd_dma_buffer *dmab_rx_bdl) 65 { 66 WARN_ONCE(1, "SoundWire BPT is disabled"); 67 return -EOPNOTSUPP; 68 } 69 70 static inline unsigned int hda_sdw_bpt_get_buf_size_alignment(unsigned int dma_bandwidth) 71 { 72 return 0; 73 } 74 #endif 75 76 #endif /* __HDA_SDW_BPT_H */ 77