From 072975a8a578a62ea68ec1ceb8d2d7dcfb5dfefa Mon Sep 17 00:00:00 2001 From: Frank Li Date: Mon, 5 Oct 2026 05:37:16 -0400 Subject: dmaengine: add dmaengine_get_copy_align() and related alignment getter helpers Add dmaengine_get_copy_align(), dmaengine_get_xor_align(), dmaengine_get_pq_align(), and dmaengine_get_fill_align() inline helpers to retrieve the alignment requirement of a DMA channel as a power-of-2 exponent. These complement the existing dmaengine_is_*_aligned() test helpers by providing direct access to the alignment value, which is useful when callers need to propagate or compare alignment constraints. Signed-off-by: Frank Li Link: https://patch.msgid.link/20261005-dmaengine_prep_dma_pq-v3-3-a4a241f26fa7@nxp.com Signed-off-by: Vinod Koul --- include/linux/dmaengine.h | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'include/linux') diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 07fe91bdd8d7..efe421503501 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1557,6 +1557,54 @@ static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1, return dmaengine_check_align(dev->fill_align, off1, off2, len); } +/** + * dmaengine_get_copy_align - get copy alignment requirement of a DMA channel + * @chan: DMA channel + * + * Return the copy alignment requirement of @chan as a power-of-2 exponent. + */ +static inline enum dmaengine_alignment +dmaengine_get_copy_align(struct dma_chan *chan) +{ + return chan->device->copy_align; +} + +/** + * dmaengine_get_xor_align - get xor alignment requirement of a DMA channel + * @chan: DMA channel + * + * Return the xor alignment requirement of @chan as a power-of-2 exponent. + */ +static inline enum dmaengine_alignment +dmaengine_get_xor_align(struct dma_chan *chan) +{ + return chan->device->xor_align; +} + +/** + * dmaengine_get_pq_align - get pq alignment requirement of a DMA channel + * @chan: DMA channel + * + * Return the pq alignment requirement of @chan as a power-of-2 exponent. + */ +static inline enum dmaengine_alignment +dmaengine_get_pq_align(struct dma_chan *chan) +{ + return chan->device->pq_align; +} + +/** + * dmaengine_get_fill_align - get fill alignment requirement of a DMA channel + * @chan: DMA channel + * + * Return the fill alignment requirement of @chan as a power-of-2 exponent. + */ +static inline enum dmaengine_alignment +dmaengine_get_fill_align(struct dma_chan *chan) +{ + return chan->device->fill_align; +} + /** * dmaengine_is_copy_aligned - test copy alignment * @chan: DMA channel -- cgit v1.2.3