[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef452c01679bee2c8bdbefe1df4775c432f8b345.camel@gmail.com>
Date: Wed, 15 Oct 2025 11:36:20 +0100
From: Nuno Sá <noname.nuno@...il.com>
To: David Lechner <dlechner@...libre.com>, Mark Brown <broonie@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Marcelo Schmitt
<marcelo.schmitt@...log.com>, Michael Hennerich
<michael.hennerich@...log.com>, Nuno Sá
<nuno.sa@...log.com>, Jonathan Cameron <jic23@...nel.org>, Andy Shevchenko
<andy@...nel.org>
Cc: Sean Anderson <sean.anderson@...ux.dev>, linux-spi@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [PATCH 6/6] iio: adc: ad7380: Add support for multiple SPI buses
On Tue, 2025-10-14 at 17:02 -0500, David Lechner wrote:
> Add support for multiple SPI buses to increase throughput. The AD7380
> family of ADCs have multiple SDO lines on the chip that can be used to
> read each channel on a separate SPI bus. If wired up to a SPI controller
> that supports it, the driver will now take advantage of this feature.
> This allows reaching the maximum sample rate advertised in the datasheet
> when combined with SPI offloading.
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
> ---
One minor thing. With it,
Reviewed-by: Nuno Sá <nuno.sa@...log.com>
> drivers/iio/adc/ad7380.c | 41 ++++++++++++++++++++++++++++-------------
> 1 file changed, 28 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> bfd908deefc0f40b42bd8a44bfce7a2510b2fdf1..36abe95852006a81f7e31f8034699e59292a
> f79e 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -77,8 +77,7 @@
> #define AD7380_CONFIG1_REFSEL BIT(1)
> #define AD7380_CONFIG1_PMODE BIT(0)
>
> -#define AD7380_CONFIG2_SDO2 GENMASK(9, 8)
> -#define AD7380_CONFIG2_SDO BIT(8)
> +#define AD7380_CONFIG2_SDO GENMASK(9, 8)
> #define AD7380_CONFIG2_RESET GENMASK(7, 0)
>
> #define AD7380_CONFIG2_RESET_SOFT 0x3C
> @@ -92,11 +91,6 @@
> #define T_CONVERT_X_NS 500 /* xth conversion start time
> (oversampling) */
> #define T_POWERUP_US 5000 /* Power up */
>
> -/*
> - * AD738x support several SDO lines to increase throughput, but driver
> currently
> - * supports only 1 SDO line (standard SPI transaction)
> - */
> -#define AD7380_NUM_SDO_LINES 1
> #define AD7380_DEFAULT_GAIN_MILLI 1000
>
> /*
> @@ -1084,7 +1078,7 @@ static int ad7380_set_ch(struct ad7380_state *st,
> unsigned int ch)
> if (oversampling_ratio > 1)
> xfer.delay.value = T_CONVERT_0_NS +
> T_CONVERT_X_NS * (oversampling_ratio - 1) *
> - st->chip_info->num_simult_channels /
> AD7380_NUM_SDO_LINES;
> + st->chip_info->num_simult_channels / st->spi-
> >num_data_bus;
>
> return spi_sync_transfer(st->spi, &xfer, 1);
> }
> @@ -1113,7 +1107,7 @@ static int ad7380_update_xfers(struct ad7380_state *st,
> if (oversampling_ratio > 1)
> t_convert = T_CONVERT_0_NS + T_CONVERT_X_NS *
> (oversampling_ratio - 1) *
> - st->chip_info->num_simult_channels /
> AD7380_NUM_SDO_LINES;
> + st->chip_info->num_simult_channels / st->spi-
> >num_data_bus;
>
> if (st->seq) {
> xfer[0].delay.value = xfer[1].delay.value = t_convert;
> @@ -1124,6 +1118,7 @@ static int ad7380_update_xfers(struct ad7380_state *st,
> AD7380_SPI_BYTES(scan_type) *
> st->chip_info->num_simult_channels;
> xfer[3].rx_buf = xfer[2].rx_buf + xfer[2].len;
> + xfer[3].multi_bus_mode = xfer[2].multi_bus_mode;
Why not doing the above once during probe?
- Nuno Sá
Powered by blists - more mailing lists