From: David Lechner <dlechner@baylibre.com>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: "Mark Brown" <broonie@kernel.org>,
"Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"David Jander" <david@protonic.nl>,
"Martin Sperl" <kernel@martin.sperl.org>,
linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-pwm@vger.kernel.org,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v7 14/17] iio: adc: ad4695: Add support for SPI offload
Date: Fri, 17 Jan 2025 11:09:03 -0600 [thread overview]
Message-ID: <67dc52c4-5252-40c3-b89e-8e46e3c2df27@baylibre.com> (raw)
In-Reply-To: <ls32gl5a7nsihmmpfabxhm6ilg7idyxdhyrhbkay6e2fiokoah@o5ujfxlsq3s3>
On 1/17/25 9:47 AM, Angelo Dureghello wrote:
> Hi,
>
> noticed just one possible issue here, see below.
>
> On 13.01.2025 15:00, David Lechner 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
>>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>> Reviewed-by: Nuno Sa <nuno.sa@analog.com>
>> Signed-off-by: David Lechner <dlechner@baylibre.com>
>> ---
>>
>> v7 changes: none
>>
>> v6 changes:
>> * Fixed use of c++ style comments
>> * Moved static const struct definition out of probe function
>> * Changes bits_per_word to always be 19 for future oversampling
>> compatibility (Trevor is working on implementing oversampling support
>> on top of this patch, so we have high confidence this is the correct
>> thing to do)
>> * Fixed wrong xfer->len
>>
>> v5 changes:
>> * Register SCLK speed handling has been split out into a separate series.
>> * Add sampling_frequency_available attribute.
>> * Limit max allowed sampling frequency based on chip info.
>> * Expand explanations of offload enable/disable ordering requirements.
>> * Finish TODO to use macros for phandle arg values.
>> * Don't use dev_info() when falling back to non-offload operation.
>> * Update to accommodate changes in other patches in this series.
>>
>> v4 changes: new patch in v4
>> ---
>> drivers/iio/adc/Kconfig | 1 +
>> drivers/iio/adc/ad4695.c | 445 +++++++++++++++++++++++++++++++++++++++++++++--
>> 2 files changed, 429 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
>> index 995b9cacbaa964d26424346120c139858f93cdcd..ec60b64c46e187e2be18ab1f8ca9e6f4f03299f9 100644
>> --- a/drivers/iio/adc/Kconfig
>> +++ b/drivers/iio/adc/Kconfig
>> @@ -52,6 +52,7 @@ config AD4695
>> tristate "Analog Device AD4695 ADC Driver"
>> depends on SPI
>> select IIO_BUFFER
>> + select IIO_BUFFER_DMAENGINE
>> select IIO_TRIGGERED_BUFFER
>> select REGMAP
>> help
>> diff --git a/drivers/iio/adc/ad4695.c b/drivers/iio/adc/ad4695.c
>> index 13cf01d35301be40369571e7dd2aeac1a8148d15..c8cd73d19e869f11999608f61df5724d329b4427 100644
>> --- a/drivers/iio/adc/ad4695.c
>> +++ b/drivers/iio/adc/ad4695.c
>> @@ -19,14 +19,19 @@
>> #include <linux/device.h>
>> #include <linux/err.h>
>> #include <linux/gpio/consumer.h>
>> +#include <linux/iio/buffer-dmaengine.h>
>> #include <linux/iio/buffer.h>
>> #include <linux/iio/iio.h>
>> #include <linux/iio/triggered_buffer.h>
>> #include <linux/iio/trigger_consumer.h>
>> #include <linux/minmax.h>
>> +#include <linux/mutex.h>
>> #include <linux/property.h>
>> +#include <linux/pwm.h>
>> #include <linux/regmap.h>
>> #include <linux/regulator/consumer.h>
>> +#include <linux/spi/offload/consumer.h>
>> +#include <linux/spi/offload/provider.h>
>> #include <linux/spi/spi.h>
>> #include <linux/units.h>
>
> ...
>
>> +static int ad4695_offload_trigger_request(struct spi_offload_trigger *trigger,
>> + enum spi_offload_trigger_type type,
>> + u64 *args, u32 nargs)
>> +{
>> + struct ad4695_state *st = spi_offload_trigger_get_priv(trigger);
>> +
>> + /* Should already be validated by match, but just in case. */
>> + if (nargs != 2)
>> + return -EINVAL;
>> +
>> + /* DT tells us if BUSY event uses GP0 or GP3. */
>> + if (args[1] == AD4695_TRIGGER_PIN_GP3)
>> + return regmap_set_bits(st->regmap, AD4695_REG_GP_MODE,
>> + AD4695_REG_GP_MODE_BUSY_GP_SEL);
>> +
>> + return regmap_clear_bits(st->regmap, AD4695_REG_GPIO_CTRL,
>> + AD4695_REG_GP_MODE_BUSY_GP_SEL);
>
> This should probably be:
>
> return regmap_clear_bits(st->regmap, AD4695_REG_GPIO_MODE,
> AD4695_REG_GP_MODE_BUSY_GP_SEL);
>
Indeed, thanks! Hopefully we won't need a v8 and Jonathan can fix while
applying. :-)
>> +}
>> +
>
> Regards,
> angelo
>
next prev parent reply other threads:[~2025-01-17 17:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 21:00 [PATCH v7 00/17] spi: axi-spi-engine: add offload support David Lechner
2025-01-13 21:00 ` [PATCH v7 01/17] spi: add basic support for SPI offloading David Lechner
2025-01-13 21:00 ` [PATCH v7 02/17] spi: offload: add support for hardware triggers David Lechner
2025-01-13 21:00 ` [PATCH v7 03/17] dt-bindings: trigger-source: add generic PWM trigger source David Lechner
2025-01-13 21:00 ` [PATCH v7 04/17] spi: offload-trigger: add PWM trigger driver David Lechner
2025-01-13 21:00 ` [PATCH v7 05/17] spi: add offload TX/RX streaming APIs David Lechner
2025-01-13 21:00 ` [PATCH v7 06/17] spi: dt-bindings: axi-spi-engine: add SPI offload properties David Lechner
2025-01-13 21:00 ` [PATCH v7 07/17] spi: axi-spi-engine: implement offload support David Lechner
2025-01-13 21:00 ` [PATCH v7 08/17] iio: buffer-dmaengine: split requesting DMA channel from allocating buffer David Lechner
2025-01-13 21:00 ` [PATCH v7 09/17] iio: buffer-dmaengine: add devm_iio_dmaengine_buffer_setup_with_handle() David Lechner
2025-01-13 21:00 ` [PATCH v7 10/17] iio: adc: ad7944: don't use storagebits for sizing David Lechner
2025-01-13 21:00 ` [PATCH v7 11/17] iio: adc: ad7944: add support for SPI offload David Lechner
2025-01-13 21:00 ` [PATCH v7 12/17] doc: iio: ad7944: describe offload support David Lechner
2025-01-13 21:00 ` [PATCH v7 13/17] dt-bindings: iio: adc: adi,ad4695: add SPI offload properties David Lechner
2025-01-13 21:00 ` [PATCH v7 14/17] iio: adc: ad4695: Add support for SPI offload David Lechner
2025-01-17 15:47 ` Angelo Dureghello
2025-01-17 17:09 ` David Lechner [this message]
2025-01-17 18:18 ` Mark Brown
2025-01-18 12:30 ` Jonathan Cameron
2025-01-13 21:00 ` [PATCH v7 15/17] doc: iio: ad4695: add SPI offload support David Lechner
2025-01-13 21:00 ` [PATCH v7 16/17] iio: dac: ad5791: sort include directives David Lechner
2025-01-13 21:00 ` [PATCH v7 17/17] iio: dac: ad5791: Add offload support David Lechner
2025-02-10 16:06 ` (subset) [PATCH v7 00/17] spi: axi-spi-engine: add " Mark Brown
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=67dc52c4-5252-40c3-b89e-8e46e3c2df27@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=adureghello@baylibre.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=kernel@martin.sperl.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=ukleinek@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
all inboxes | Powered by JetHome®