iio: buffer-dma: Enable buffer write support
authorPaul Cercueil <paul@crapouillou.net>
Fri, 19 Apr 2024 08:25:36 +0000 (10:25 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 20 Apr 2024 14:36:41 +0000 (15:36 +0100)
commitfb09febafd160b7aefd9e61f710a0c50f0472403
treebad45e83ef30015df2d8435180584beea39ebac5
parent04ae3b1a76b77f98a4a0c8ed2c544007334fc680
iio: buffer-dma: Enable buffer write support

Adding write support to the buffer-dma code is easy - the write()
function basically needs to do the exact same thing as the read()
function: dequeue a block, read or write the data, enqueue the block
when entirely processed.

Therefore, the iio_buffer_dma_read() and the new iio_buffer_dma_write()
now both call a function iio_buffer_dma_io(), which will perform this
task.

Note that we preemptively reset block->bytes_used to the buffer's size
in iio_dma_buffer_request_update(), as in the future the
iio_dma_buffer_enqueue() function won't reset it.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240419-iio-backend-axi-dac-v4-3-5ca45b4de294@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/buffer/industrialio-buffer-dma.c
include/linux/iio/buffer-dma.h