From: Jonathan Cameron <jic23@kernel.org>
To: Julien Stephan <jstephan@baylibre.com>
Cc: "Michael Hennerich" <michael.hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 3/5] ad7380: add support for single-ended parts
Date: Sun, 28 Jul 2024 17:23:09 +0100 [thread overview]
Message-ID: <20240728172309.13155e1b@jic23-huawei> (raw)
In-Reply-To: <20240726-ad7380-add-single-ended-chips-v1-3-2d628b60ccd1@baylibre.com>
On Fri, 26 Jul 2024 17:20:08 +0200
Julien Stephan <jstephan@baylibre.com> wrote:
> Adding ad7386/7/8 (16/14/12 bits) unsigned, dual simultaneous sampling,
> single-ended compatible parts, and the corresponding ad7386-4/7-4/8-4
> 4 channels.
>
> These parts have a 2:1 multiplexer in front of each ADC. They also include
> additional configuration registers that allow for either manual selection
> or automatic switching (sequencer mode), of the multiplexer inputs.
> This commit focus on integrating manual selection. Sequencer mode will
> be implemented later.
>
> From an IIO point of view, all inputs are exported, i.e ad7386/7/8
> export 4 channels and ad7386-4/7-4/8-4 export 8 channels.
>
> Inputs AinX0 of multiplexers correspond to the first half of IIO channels
> (i.e 0-1 or 0-3) and inputs AinX1 correspond to second half (i.e 2-3 or
> 4-7). Example for AD7386/7/8 (2 channels parts):
>
> IIO | AD7386/7/8
> | +----------------------------
> | | _____ ______
> | | | | | |
> voltage0 | AinA0 --|--->| | | |
> | | | mux |----->| ADCA |---
> voltage2 | AinA1 --|--->| | | |
> | | |_____| |_____ |
> | | _____ ______
> | | | | | |
> voltage1 | AinB0 --|--->| | | |
> | | | mux |----->| ADCB |---
> voltage3 | AinB1 --|--->| | | |
> | | |_____| |______|
> | |
> | +----------------------------
>
> When switching channel, the ADC require an additional settling time.
> According to the datasheet, data is valid on the third CS low. We already
> have an extra toggle before each read (either direct reads or buffered
> reads) to sample correct data, so we just add a single CS toggle at the
> end of the register write.
>
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Hi Julien
LGTM - only one trivial comment inline.
If nothing else comes up I can change that whilst applying.
I won't be applying today however given this is a new series and has only been
on the list since Friday.
...
> @@ -92,8 +96,24 @@ enum {
> AD7380_SCAN_TYPE_RESOLUTION_BOOST,
> };
>
> -/* Extended scan types for 14-bit chips. */
> -static const struct iio_scan_type ad7380_scan_type_14[] = {
> +/* Extended scan types for 12-bit unsigned chips. */
> +static const struct iio_scan_type ad7380_scan_type_12_u[] = {
> + [AD7380_SCAN_TYPE_NORMAL] = {
> + .sign = 'u',
> + .realbits = 12,
> + .storagebits = 16,
> + .endianness = IIO_CPU
Add trailing commas. In theory we might expand this structure
in the future. The only time we don't add trailing commas is
for 'null' terminator type entries where we know anything added
must come before them.
> + },
> + [AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
> + .sign = 'u',
> + .realbits = 14,
> + .storagebits = 16,
> + .endianness = IIO_CPU
> + },
> +};
>
> +/*
> + * Single ended parts have a 2:1 multiplexer in front of each ADC.
> + *
> + * From an IIO point of view, all inputs are exported, i.e ad7386/7/8
> + * export 4 channels and ad7386-4/7-4/8-4 export 8 channels.
> + *
> + * Inputs AinX0 of multiplexers correspond to the first half of IIO channels
> + * (i.e 0-1 or 0-3) and inputs AinX1 correspond to second half (i.e 2-3 or
> + * 4-7). Example for AD7386/7/8 (2 channels parts):
> + *
> + * IIO | AD7386/7/8
> + * | +----------------------------
> + * | | _____ ______
> + * | | | | | |
> + * voltage0 | AinA0 --|--->| | | |
> + * | | | mux |----->| ADCA |---
> + * voltage2 | AinA1 --|--->| | | |
> + * | | |_____| |_____ |
> + * | | _____ ______
> + * | | | | | |
> + * voltage1 | AinB0 --|--->| | | |
> + * | | | mux |----->| ADCB |---
> + * voltage3 | AinB1 --|--->| | | |
> + * | | |_____| |______|
> + * | |
> + * | +----------------------------
> + *
> + * Since this is simultaneous sampling for AinX0 OR AinX1 we have two separate
> + * scan masks.
> + */
Good. I always like some nice art :)
+ your implementation takes the same approach I would have done.
next prev parent reply other threads:[~2024-07-28 16:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 15:20 [PATCH 0/5] ad7380: add support for single-ended parts Julien Stephan
2024-07-26 15:20 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add single-ended compatible parts Julien Stephan
2024-07-28 10:33 ` Krzysztof Kozlowski
2024-07-28 10:34 ` Krzysztof Kozlowski
2024-07-26 15:20 ` [PATCH 2/5] ad7380: prepare driver for single-ended parts support Julien Stephan
2024-07-26 15:20 ` [PATCH 3/5] ad7380: add support for single-ended parts Julien Stephan
2024-07-28 16:23 ` Jonathan Cameron [this message]
2024-07-26 15:20 ` [PATCH 4/5] ad7380: enable sequencer " Julien Stephan
2024-07-28 16:35 ` Jonathan Cameron
2024-07-30 7:34 ` Julien Stephan
2024-07-26 15:20 ` [PATCH 5/5] docs: iio: ad7380: add support " Julien Stephan
2024-07-28 16:37 ` 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=20240728172309.13155e1b@jic23-huawei \
--to=jic23@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jstephan@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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