[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241124173523.1fc48f25@jic23-huawei>
Date: Sun, 24 Nov 2024 17:35:23 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Nuno Sá <nuno.sa@...log.com>, Uwe
Kleine-König <ukleinek@...nel.org>, Michael Hennerich
<Michael.Hennerich@...log.com>, Lars-Peter Clausen <lars@...afoo.de>, David
Jander <david@...tonic.nl>, Martin Sperl <kernel@...tin.sperl.org>,
linux-spi@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
linux-pwm@...r.kernel.org
Subject: Re: [PATCH v5 15/16] iio: adc: ad4695: Add support for SPI offload
On Fri, 15 Nov 2024 14:18:54 -0600
David Lechner <dlechner@...libre.com> wrote:
> Add support for SPI offload to the ad4695 driver. SPI offload allows
> sampling data at the max sample rate (500kSPS or 1MSPS).
>
> This is developed and tested against the ADI example FPGA design for
> this family of ADCs [1].
>
> [1]: http://analogdevicesinc.github.io/hdl/projects/ad469x_fmc/index.html
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
A few minor formatting type comments inline.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> +static bool ad4695_offload_trigger_match(struct spi_offload_trigger *trigger,
> + enum spi_offload_trigger_type type,
> + u64 *args, u32 nargs)
> +{
> + if (type != SPI_OFFLOAD_TRIGGER_DATA_READY)
> + return false;
> +
> + // args[0] is the trigger event.
> + // args[1] is the GPIO pin number.
/*
* args[0] etc
> + if (nargs != 2 || args[0] != AD4695_TRIGGER_EVENT_BUSY)
> + return false;
> +
> + return true;
> +}
> @@ -1260,12 +1639,36 @@ static int ad4695_probe(struct spi_device *spi)
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = st->iio_chan;
>
> - ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
> - iio_pollfunc_store_time,
> - ad4695_trigger_handler,
> - &ad4695_buffer_setup_ops);
> - if (ret)
> - return ret;
> + static const struct spi_offload_config ad4695_offload_config = {
Whilst we do allow declarations other than at the top for use with things
like __free() there is no strong reason for this one. So move it up to the
top of the function.
> + .capability_flags = SPI_OFFLOAD_CAP_TRIGGER
> + | SPI_OFFLOAD_CAP_RX_STREAM_DMA,
> + };
> +
> + st->offload = devm_spi_offload_get(dev, spi, &ad4695_offload_config);
>
Powered by blists - more mailing lists