[PATCH v4 08/10] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers

Andy Shevchenko andriy.shevchenko at intel.com
Mon Sep 14 01:12:09 PDT 2026


On Fri, Sep 11, 2026 at 06:25:43PM +0100, Nuno Sá wrote:
> Use the dma_slave_caps bus width helpers instead of reading the legacy
> src_addr_widths and dst_addr_widths masks directly.
> 
> Keep the existing default assumption of 1, 2 and 4 byte widths when the
> DMA channel does not report slave capabilities.

...

> int snd_dmaengine_pcm_refine_runtime_hwparams(
>  	struct snd_pcm_hardware *hw,
>  	struct dma_chan *chan)
>  {
> +	enum dma_slave_buswidth default_widths[] = {
> +		DMA_SLAVE_BUSWIDTH_1_BYTE,
> +		DMA_SLAVE_BUSWIDTH_2_BYTES,
> +		DMA_SLAVE_BUSWIDTH_4_BYTES,
> +	};
>  	struct dma_slave_caps dma_caps;
> -	u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> -			  BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> -			  BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);

> +	dma_buswidth_mask_t bus_widths = {};

Do you really need the zeroing?

>  	snd_pcm_format_t i;
>  	int ret = 0;

>  	if (!hw || !chan || !dma_data)
>  		return -EINVAL;
>  
> +	ret = dma_bus_width_set_many(bus_widths, default_widths,
> +				     ARRAY_SIZE(default_widths));
> +	if (ret)
> +		return ret;

I assume that if ret == 0, bus_widths should be set accordingly.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list