From: David Lechner <dlechner@baylibre.com>
To: Marcelo Schmitt <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, devicetree@vger.kernel.org,
linux-spi@vger.kernel.org
Cc: jic23@kernel.org, Michael.Hennerich@analog.com,
nuno.sa@analog.com, eblanc@baylibre.com, andy@kernel.org,
corbet@lwn.net, robh@kernel.org, krzk+dt@kernel.org,
conor+dt@kernel.org, broonie@kernel.org,
Jonathan.Cameron@huawei.com, andriy.shevchenko@linux.intel.com,
ahaslam@baylibre.com, sergiu.cuciurean@analog.com,
marcelo.schmitt1@gmail.com
Subject: Re: [PATCH 13/15] iio: adc: ad4030: Enable dual data rate
Date: Sat, 30 Aug 2025 12:33:04 -0500 [thread overview]
Message-ID: <bb8f120b-db75-4dbf-8473-3ef6f340c38a@baylibre.com> (raw)
In-Reply-To: <47b2cf01555c31126bc2133526317c7829cb59ab.1756511030.git.marcelo.schmitt@analog.com>
On 8/29/25 7:45 PM, Marcelo Schmitt wrote:
> Set AD4030 series device to do two data bit transitions per clock cycle per
> active lane when specified by firmware. The dual data rate (DDR) feature is
> available only for host clock mode and echo clock mode.
>
> Co-developed-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> ---
> drivers/iio/adc/ad4030.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/iio/adc/ad4030.c b/drivers/iio/adc/ad4030.c
> index a5931056936a..37ba00097efe 100644
> --- a/drivers/iio/adc/ad4030.c
> +++ b/drivers/iio/adc/ad4030.c
> @@ -74,6 +74,7 @@
> (AD4030_REG_GAIN_X0_MSB + (AD4030_REG_GAIN_BYTES_NB * (ch)))
> #define AD4030_REG_MODES 0x20
> #define AD4030_REG_MODES_MASK_OUT_DATA_MODE GENMASK(2, 0)
> +#define AD4030_REG_MODES_MASK_DDR_MODE BIT(3)
> #define AD4030_REG_MODES_MASK_CLOCK_MODE GENMASK(5, 4)
> #define AD4030_REG_MODES_MASK_LANE_MODE GENMASK(7, 6)
> #define AD4030_REG_OSCILATOR 0x21
> @@ -175,6 +176,7 @@ struct ad4030_state {
> enum ad4030_out_mode mode;
> enum ad4030_lane_mode lane_mode;
> enum ad4030_clock_mode clock_mode;
> + bool ddr;
> /* offload sampling spi message */
> struct spi_transfer offload_xfer;
> struct spi_message offload_msg;
> @@ -1218,6 +1220,9 @@ static void ad4030_prepare_offload_msg(struct ad4030_state *st)
> else
> offload_bpw = data_width / (1 << st->lane_mode);
>
> + if (st->ddr)
> + offload_bpw /= 2;
> +
There is already an existing dtr_mode flag in struct spi_transfer. We should
be using that instead of providing an inaccurate bits per word value.
> st->offload_xfer.speed_hz = AD4030_SPI_MAX_REG_XFER_SPEED;
> st->offload_xfer.bits_per_word = offload_bpw;
> st->offload_xfer.len = roundup_pow_of_two(BITS_TO_BYTES(offload_bpw));
> @@ -1271,6 +1276,12 @@ static int ad4030_config(struct ad4030_state *st)
> reg_modes |= FIELD_PREP(AD4030_REG_MODES_MASK_CLOCK_MODE,
> ret >= 0 ? ret : AD4030_SPI_CLOCK_MODE);
>
> + /* DDR is only valid for echo clock and host clock modes */
> + if (ret == AD4030_ECHO_CLOCK_MODE || ret == AD4030_CLOCK_HOST_MODE) {
> + st->ddr = device_property_read_bool(dev, "adi,dual-data-rate");
As mentioned in the dt-bindings patch review, we can already get this info
from the spi controller via dtr_caps.
> + reg_modes |= FIELD_PREP(AD4030_REG_MODES_MASK_DDR_MODE, st->ddr);
> + }
> +
> ret = regmap_write(st->regmap, AD4030_REG_MODES, reg_modes);
> if (ret)
> return ret;
We will need a separate patch to add support for dtr_caps and dtr_mode to the
axi-spi-engine driver. And likely some HDL work for that as well. So I would
suggest splitting this out into a separate series.
next prev parent reply other threads:[~2025-08-30 17:33 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 0:39 [PATCH 00/15] Add SPI offload support to AD4030 Marcelo Schmitt
2025-08-30 0:40 ` [PATCH 01/15] iio: adc: ad4030: Fix _scale for when oversampling is enabled Marcelo Schmitt
2025-08-30 5:00 ` Andy Shevchenko
2025-08-30 18:43 ` Jonathan Cameron
2025-08-30 18:48 ` David Lechner
2025-09-02 13:18 ` Marcelo Schmitt
2025-08-30 0:40 ` [PATCH 02/15] dt-bindings: iio: adc: adi,ad4030: Reference spi-peripheral-props Marcelo Schmitt
2025-08-30 0:41 ` [PATCH 03/15] Documentation: iio: ad4030: Add double PWM SPI offload doc Marcelo Schmitt
2025-08-30 16:49 ` David Lechner
2025-08-30 0:41 ` [PATCH 04/15] dt-bindings: iio: adc: adi,ad4030: Add PWM Marcelo Schmitt
2025-08-30 0:42 ` [PATCH 05/15] spi: offload: types: add offset parameter Marcelo Schmitt
2025-08-30 5:01 ` Andy Shevchenko
2025-08-30 0:42 ` [PATCH 06/15] spi: spi-offload-trigger-pwm: Use duty offset Marcelo Schmitt
2025-08-30 5:02 ` Andy Shevchenko
2025-08-30 16:41 ` David Lechner
2025-08-30 0:42 ` [PATCH 07/15] iio: adc: ad4030: Add SPI offload support Marcelo Schmitt
2025-08-30 7:36 ` Andy Shevchenko
2025-08-30 12:08 ` kernel test robot
2025-08-30 19:11 ` Jonathan Cameron
2025-08-30 20:14 ` David Lechner
2025-09-02 14:52 ` Marcelo Schmitt
2025-08-30 0:43 ` [PATCH 08/15] dt-bindings: iio: adc: adi,ad4030: Add 4-lane per channel bus width option Marcelo Schmitt
2025-08-30 17:01 ` David Lechner
2025-08-30 0:43 ` [PATCH 09/15] iio: adc: ad4030: Support multiple data lanes per channel Marcelo Schmitt
2025-08-30 7:38 ` Andy Shevchenko
2025-08-30 17:19 ` David Lechner
2025-08-30 0:43 ` [PATCH 10/15] dt-bindings: iio: adc: adi,ad4030: Add adi,clock-mode Marcelo Schmitt
2025-08-30 18:02 ` David Lechner
2025-08-30 0:44 ` [PATCH 11/15] iio: adc: ad4030: Add clock mode option parse and setup Marcelo Schmitt
2025-08-30 7:42 ` Andy Shevchenko
2025-08-30 0:44 ` [PATCH 12/15] dt-bindings: iio: adc: adi,ad4030: Add adi,dual-data-rate Marcelo Schmitt
2025-08-30 17:27 ` David Lechner
2025-08-30 0:45 ` [PATCH 13/15] iio: adc: ad4030: Enable dual data rate Marcelo Schmitt
2025-08-30 7:46 ` Andy Shevchenko
2025-08-30 17:33 ` David Lechner [this message]
2025-08-30 0:45 ` [PATCH 14/15] dt-bindings: iio: adc: adi,ad4030: Add ADAQ4216 and ADAQ4224 Marcelo Schmitt
2025-08-30 18:45 ` David Lechner
2025-08-30 0:45 ` [PATCH 15/15] iio: adc: ad4030: Add support for " Marcelo Schmitt
2025-08-30 7:57 ` Andy Shevchenko
2025-09-02 15:22 ` Marcelo Schmitt
2025-08-30 19:17 ` David Lechner
2025-09-01 11:47 ` Dan Carpenter
2025-08-30 2:48 ` [PATCH 00/15] Add SPI offload support to AD4030 Marcelo Schmitt
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=bb8f120b-db75-4dbf-8473-3ef6f340c38a@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=ahaslam@baylibre.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=eblanc@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=sergiu.cuciurean@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;
as well as URLs for NNTP newsgroup(s).