diff options
| author | Frank Li <Frank.Li@nxp.com> | 2026-10-05 05:37:16 -0400 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-10-09 11:41:33 +0200 |
| commit | 072975a8a578a62ea68ec1ceb8d2d7dcfb5dfefa (patch) | |
| tree | b158bc3e6acee71190694139d3eb0a4757a15690 /include | |
| parent | 11e801ccaca78c9d92b1f3a9733772bf9d2c079c (diff) | |
| download | linux-next-072975a8a578a62ea68ec1ceb8d2d7dcfb5dfefa.tar.gz linux-next-072975a8a578a62ea68ec1ceb8d2d7dcfb5dfefa.zip | |
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 <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20261005-dmaengine_prep_dma_pq-v3-3-a4a241f26fa7@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/dmaengine.h | 48 |
1 files changed, 48 insertions, 0 deletions
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 @@ -1558,6 +1558,54 @@ static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1, } /** + * 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 * @off1: first buffer offset |
