Re: [RFC PATCH] dmaengine: xilinx_dma: Fix per-channel direction reporting via device_caps
From: Folker Schwesinger
Date: Sat Mar 14 2026 - 04:46:07 EST
On Tue Feb 17, 2026 at 7:49 PM CET, Folker Schwesinger wrote:
> Since commit 7e01511443c3 ("dmaengine: xilinx_dma: Set dma_device
> directions") all channel directions are aggregated into
> dma_device.directions so that dma_get_slave_caps() works for IIO
> DMAEngine buffers.
>
> However, this caused a regression in ASoC audio on ZynqMP platforms,
> that causes cyclic playback to fail after the first buffer period,
> because ASoC dmaengine PCM expects fixed per-channel direction reporting
> from dma_get_slave_caps().
>
> Implement optional device_caps() callback and override caps->directions
> with the channel's fixed direction. This keeps device-wide direction
> reporting for IIO intact while restoring correct per-channel semantics
> for ASoC.
> Other dma_slave_caps fields are left unchanged from their respective
> values initialized from dma_get_slave_caps(). In case there should ever
> be the need to override other fields, these can be added later.
>
> Fixes: 7e01511443c3 ("dmaengine: xilinx_dma: Set dma_device directions")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Rahul Navale <rahul.navale@xxxxxxx>
> Closes: https://lore.kernel.org/dmaengine/20260211140051.8177-1-rahulnavale04@xxxxxxxxx/T/#u
> Closes: https://lore.kernel.org/dmaengine/CY1PR12MB96978AEBD6072FC469DFEAF1B762A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#u
> Signed-off-by: Folker Schwesinger <dev@xxxxxxxxxxxxxxxxxxxxx>
@Xilinx/AMD maintainers:
Even though this patch does not fix the reported regression and there
may not be an immediate need for the implementation of the device_caps()
callback, it might be an improvement to the Xilinx DMA driver. In case
you see value in that addition, let me know and I resend the patch with
the necessary editorial changes.
Also during the debugging session, the following was identified:
> From a quick trace through the code I found that in the Xilinx DMA
> residue_granularity is set for AXIDMA independently from the SG setting
> of the DMA core [1].
> However, in xilinx_dma_tx_status() one of the conditions for residue
> calculations is that SG mode is enabled [2].
>
> [1]: https://elixir.bootlin.com/linux/v6.19.3/source/drivers/dma/xilinx/xilinx_dma.c#L3284
> [2]: https://elixir.bootlin.com/linux/v6.19.3/source/drivers/dma/xilinx/xilinx_dma.c#L1293
Not sure if this needs addressing, but this could have the potential for
subtle bugs...
Best regards
Folker