Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: SOF: Intel: export hda_sdw_bpt_get_buf_size_aligment

The dma buffer need to be a multiple of data block size and
the fifo size. Export a function to return the LCM of data
block size and the fifo size.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://patch.msgid.link/20251014031450.3781789-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Bard Liao and committed by
Vinod Koul
167efc6d 57b3a7b2

+20
+7
include/sound/hda-sdw-bpt.h
··· 30 30 int hda_sdw_bpt_close(struct device *dev, struct hdac_ext_stream *bpt_tx_stream, 31 31 struct snd_dma_buffer *dmab_tx_bdl, struct hdac_ext_stream *bpt_rx_stream, 32 32 struct snd_dma_buffer *dmab_rx_bdl); 33 + 34 + unsigned int hda_sdw_bpt_get_buf_size_alignment(unsigned int dma_bandwidth); 33 35 #else 34 36 static inline int hda_sdw_bpt_open(struct device *dev, int link_id, 35 37 struct hdac_ext_stream **bpt_tx_stream, ··· 65 63 { 66 64 WARN_ONCE(1, "SoundWire BPT is disabled"); 67 65 return -EOPNOTSUPP; 66 + } 67 + 68 + static inline unsigned int hda_sdw_bpt_get_buf_size_alignment(unsigned int dma_bandwidth) 69 + { 70 + return 0; 68 71 } 69 72 #endif 70 73
+13
sound/soc/sof/intel/hda-sdw-bpt.c
··· 10 10 * Hardware interface for SoundWire BPT support with HDA DMA 11 11 */ 12 12 13 + #include <linux/lcm.h> 13 14 #include <sound/hdaudio_ext.h> 14 15 #include <sound/hda-mlink.h> 15 16 #include <sound/hda-sdw-bpt.h> ··· 236 235 237 236 return ret; 238 237 } 238 + 239 + #define FIFO_ALIGNMENT 64 240 + 241 + unsigned int hda_sdw_bpt_get_buf_size_alignment(unsigned int dma_bandwidth) 242 + { 243 + unsigned int num_channels = DIV_ROUND_UP(dma_bandwidth, BPT_FREQUENCY * 32); 244 + unsigned int data_block = num_channels * 4; 245 + unsigned int alignment = lcm(data_block, FIFO_ALIGNMENT); 246 + 247 + return alignment; 248 + } 249 + EXPORT_SYMBOL_NS(hda_sdw_bpt_get_buf_size_alignment, "SND_SOC_SOF_INTEL_HDA_SDW_BPT"); 239 250 240 251 int hda_sdw_bpt_open(struct device *dev, int link_id, struct hdac_ext_stream **bpt_tx_stream, 241 252 struct snd_dma_buffer *dmab_tx_bdl, u32 bpt_tx_num_bytes,