]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: buffer: support getting dma channel from the buffer
authorNuno Sá <nuno.sa@analog.com>
Tue, 7 Oct 2025 09:15:21 +0000 (10:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:24:57 +0000 (06:24 +0900)
commitaf8a7abca453d476d1e418149564b4f0d09f12c2
tree2b6ad39a95572b59307847d0d42d185a151c8690
parent6717a94824203ac80384770bd27d85edb7e11444
iio: buffer: support getting dma channel from the buffer

commit a514bb109eada64f798f1c86c17182229cc20fe7 upstream.

Add a new buffer accessor .get_dma_dev() in order to get the
struct device responsible for actually providing the dma channel. We
cannot assume that we can use the parent of the IIO device for mapping
the DMA buffer. This becomes important on systems (like the Xilinx/AMD
zynqMP Ultrascale) where memory (or part of it) is mapped above the
32 bit range. On such systems and given that a device by default has
a dma mask of 32 bits we would then need to rely on bounce buffers (to
swiotlb) for mapping memory above the dma mask limit.

In the process, add an iio_buffer_get_dma_dev() helper function to get
the proper DMA device.

Cc: stable@vger.kernel.org
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/industrialio-buffer.c
include/linux/iio/buffer_impl.h