From: Eugen Hristev <eugen.hristev@microchip.com>
To: nicolas.ferre@microchip.com, ludovic.desroches@microchip.com,
linux-iio@vger.kernel.org, jic23@kernel.org,
alexandre.belloni@free-electrons.com,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, lars@metafoo.de
Cc: eugen.hristev@microchip.com
Subject: [PATCH 0/3] iio: adc: at91-sama5d2_adc: add DMA support
Date: Thu, 10 Aug 2017 15:34:56 +0300 [thread overview]
Message-ID: <1502368499-6739-1-git-send-email-eugen.hristev@microchip.com> (raw)
This patch implements the DMA support for the ADC in sam5d2 SOC.
After discussing on the mailing list, this approach is based on triggered
kfifo buffer, with DMA support added on top of it.
Thus, the trigger is enabled by the buffer. The ADC itself will not have
an IRQ enabled if using DMA. With DMA, the channels are enabled, and DMA
controller is configured to read from the data ready registers.
When DMA starts, the trigger will start the conversion (external trigger
configured), then the registers will have the conversion data ready, trigger
the DMA controller to read from the registers, the DMA will copy the data into
the software buffer, and trigger the DMA IRQ. In the bottom half, the
trigger polled and the data from the DMA buffer is pushed to buffer.
The DMA will use a cyclic buffer to write to one half, and the software can
read from the other half. The DMA operation doesn't stop until the buffer is
disabled.
The DMA coherent area is allocated when DMA is initially started, and
deallocated only if the watermark is changed to 1 (no more DMA usage). The
coherent area is large enough to cope with maximum fifo size for all possible
channels enabled.
The fifo size is set to 128 conversions by default in the driver.
The implementation uses the user watermark to decide whether DMA will be
used or not. For watermark 1, DMA will not be used. If watermark is greater,
DMA will be used.
Sysfs attributes are created to indicate whether the DMA is used,
with hwfifo_enabled, and the current DMA watermark is readable
in hwfifo_watermark. Minimum and maximum values are in hwfifo_watermark_min
and hwfifo_watermark_max.
Devicetree binding added for dma as well.
Modified devicetree for sama5d2 SoC to add connected DMA channel.
Eugen Hristev (3):
Documentation: dt: iio: at91-sama5d2_adc: add optional dma property
ARM: dts: at91: sama5d2: added dma property for ADC device
iio: adc: at91-sama5d2_adc: add support for DMA
.../bindings/iio/adc/at91-sama5d2_adc.txt | 7 +
arch/arm/boot/dts/sama5d2.dtsi | 2 +
drivers/iio/adc/at91-sama5d2_adc.c | 366 ++++++++++++++++++++-
3 files changed, 359 insertions(+), 16 deletions(-)
--
2.7.4
next reply other threads:[~2017-08-10 12:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 12:34 Eugen Hristev [this message]
2017-08-10 12:34 ` [PATCH 1/3] Documentation: dt: iio: at91-sama5d2_adc: add optional dma property Eugen Hristev
[not found] ` <1502368499-6739-2-git-send-email-eugen.hristev-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
2017-08-17 15:10 ` Rob Herring
2017-08-24 11:54 ` Alexandre Belloni
2017-08-10 12:34 ` [PATCH 2/3] ARM: dts: at91: sama5d2: added dma property for ADC device Eugen Hristev
2017-08-10 12:34 ` [PATCH 3/3] iio: adc: at91-sama5d2_adc: add support for DMA Eugen Hristev
2017-08-12 12:36 ` 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=1502368499-6739-1-git-send-email-eugen.hristev@microchip.com \
--to=eugen.hristev@microchip.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=nicolas.ferre@microchip.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;
as well as URLs for NNTP newsgroup(s).