From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-iio@vger.kernel.org>,
<lars@metafoo.de>, <Michael.Hennerich@analog.com>,
<nuno.sa@analog.com>, <dragos.bogdan@analog.com>
Subject: Re: [RFC PATCH 5/5] iio: buffer-dma: add support for cyclic DMA transfers
Date: Sun, 14 Feb 2021 16:31:42 +0000 [thread overview]
Message-ID: <20210214163142.52263d58@archlinux> (raw)
In-Reply-To: <20210212102021.47276-6-alexandru.ardelean@analog.com>
On Fri, 12 Feb 2021 12:20:21 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> From: Lars-Peter Clausen <lars@metafoo.de>
>
> This change adds support for cyclic DMA transfers using the IIO buffer DMA
> infrastructure.
> To do this, userspace must set the IIO_BUFFER_BLOCK_FLAG_CYCLIC flag on the
> block when enqueueing them via the ENQUEUE_BLOCK ioctl().
We should have more than that in the way of documentation!
What is the dataflow that we end up with as a result of this?
Jonathan
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
> .../buffer/industrialio-buffer-dmaengine.c | 24 ++++++++++++-------
> include/uapi/linux/iio/buffer.h | 1 +
> 2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> index 013cc7c1ecf4..94c93a636ad4 100644
> --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> @@ -82,14 +82,22 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue,
>
> direction = dmaengine_buffer->is_tx ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
>
> - desc = dmaengine_prep_slave_single(dmaengine_buffer->chan,
> - block->phys_addr, block->block.bytes_used, direction,
> - DMA_PREP_INTERRUPT);
> - if (!desc)
> - return -ENOMEM;
> -
> - desc->callback_result = iio_dmaengine_buffer_block_done;
> - desc->callback_param = block;
> + if (block->block.flags & IIO_BUFFER_BLOCK_FLAG_CYCLIC) {
> + desc = dmaengine_prep_dma_cyclic(dmaengine_buffer->chan,
> + block->phys_addr, block->block.bytes_used,
> + block->block.bytes_used, direction, 0);
> + if (!desc)
> + return -ENOMEM;
> + } else {
> + desc = dmaengine_prep_slave_single(dmaengine_buffer->chan,
> + block->phys_addr, block->block.bytes_used, direction,
> + DMA_PREP_INTERRUPT);
> + if (!desc)
> + return -ENOMEM;
> +
> + desc->callback_result = iio_dmaengine_buffer_block_done;
> + desc->callback_param = block;
> + }
>
> cookie = dmaengine_submit(desc);
> if (dma_submit_error(cookie))
> diff --git a/include/uapi/linux/iio/buffer.h b/include/uapi/linux/iio/buffer.h
> index 70ad3aea01ea..0e0c95f1c38b 100644
> --- a/include/uapi/linux/iio/buffer.h
> +++ b/include/uapi/linux/iio/buffer.h
> @@ -13,6 +13,7 @@ struct iio_buffer_block_alloc_req {
> };
>
> #define IIO_BUFFER_BLOCK_FLAG_TIMESTAMP_VALID (1 << 0)
> +#define IIO_BUFFER_BLOCK_FLAG_CYCLIC (1 << 1)
>
> struct iio_buffer_block {
> __u32 id;
next prev parent reply other threads:[~2021-02-14 16:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 10:20 [RFC PATCH 0/5] iio: buffer: add output buffer and cyclic mode Alexandru Ardelean
2021-02-12 10:20 ` [RFC PATCH 1/5] iio: Add output buffer support Alexandru Ardelean
2021-02-14 16:21 ` Jonathan Cameron
2021-02-12 10:20 ` [RFC PATCH 2/5] iio: kfifo-buffer: " Alexandru Ardelean
2021-02-14 16:23 ` Jonathan Cameron
2021-02-12 10:20 ` [RFC PATCH 3/5] iio: buffer-dma: Allow to provide custom buffer ops Alexandru Ardelean
2021-02-12 10:20 ` [RFC PATCH 4/5] iio: buffer-dma: Add output buffer support Alexandru Ardelean
2021-02-14 16:29 ` Jonathan Cameron
2021-02-12 10:20 ` [RFC PATCH 5/5] iio: buffer-dma: add support for cyclic DMA transfers Alexandru Ardelean
2021-02-14 16:31 ` Jonathan Cameron [this message]
2021-02-14 16:32 ` [RFC PATCH 0/5] iio: buffer: add output buffer and cyclic mode Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210214163142.52263d58@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.ardelean@analog.com \
--cc=dragos.bogdan@analog.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox