From: Jonathan Cameron <jic23@kernel.org>
To: Trevor Gamblin <tgamblin@baylibre.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"David Lechner" <dlechner@baylibre.com>,
"Uwe Kleine-Konig" <u.kleine-koenig@baylibre.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v3 2/3] iio: adc: ad7625: add driver
Date: Fri, 23 Aug 2024 19:48:52 +0100 [thread overview]
Message-ID: <20240823194852.4d855eb3@jic23-huawei> (raw)
In-Reply-To: <20240819-ad7625_r1-v3-2-75d5217c76b5@baylibre.com>
On Mon, 19 Aug 2024 10:11:44 -0400
Trevor Gamblin <tgamblin@baylibre.com> wrote:
> Add a driver for the AD762x and AD796x family of ADCs. These are
> pin-compatible devices using an LVDS interface for data transfer,
> capable of sampling at rates of 6 (AD7625), 10 (AD7626), and 5
> (AD7960/AD7961) MSPS, respectively. They also feature multiple voltage
> reference options based on the configuration of the EN1/EN0 pins, which
> can be set in the devicetree.
>
> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Hi Trevor
A few really minor things in here. Given we are waiting on the
PWM set anyway, I haven't just tidied them up whilst applying.
> ---
> MAINTAINERS | 1 +
> drivers/iio/adc/Kconfig | 15 ++
> drivers/iio/adc/Makefile | 1 +
> drivers/iio/adc/ad7625.c | 688 +++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 705 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2361f92751dd..a90972e1c5c5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1268,6 +1268,7 @@ S: Supported
> W: https://ez.analog.com/linux-software-drivers
> W: http://analogdevicesinc.github.io/hdl/projects/pulsar_lvds/index.html
> F: Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml
> +F: drivers/iio/adc/ad7625.c
>
> ANALOG DEVICES INC AD7768-1 DRIVER
> M: Michael Hennerich <Michael.Hennerich@analog.com>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index f60fe85a30d5..e25fb505f545 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -219,6 +219,21 @@ config AD7606_IFACE_SPI
> To compile this driver as a module, choose M here: the
> module will be called ad7606_spi.
>
> +config AD7625
> + tristate "Analog Devices AD7625/AD7626 High Speed ADC driver"
> + select IIO_BACKEND
> + help
> + Say yes here to build support for Analog Devices:
> + * AD7625 16-Bit, 6 MSPS PulSAR Analog-to-Digital Converter
Looks like some tabs mixed in with otherwise spaces.
Should be tabs + spaces as per entry above.
> + * AD7626 16-Bit, 10 MSPS PulSAR Analog-to-Digital Converter
> + * AD7960 18-Bit, 5 MSPS PulSAR Analog-to-Digital Converter
> + * AD7961 16-Bit, 5 MSPS PulSAR Analog-to-Digital Converter
> +
> + The driver requires the assistance of the AXI ADC IP core to operate.
> +
> + To compile this driver as a module, choose M here: the module will be
> + called ad7625.
> +
> config AD7766
> tristate "Analog Devices AD7766/AD7767 ADC driver"
> depends on SPI_MASTER
> diff --git a/drivers/iio/adc/ad7625.c b/drivers/iio/adc/ad7625.c
> new file mode 100644
> index 000000000000..3ac3c56d43eb
> --- /dev/null
> +++ b/drivers/iio/adc/ad7625.c
> @@ -0,0 +1,688 @@
> +
> +struct ad7625_chip_info {
> + const char *name;
> + const unsigned int max_sample_rate_hz;
> + const struct ad7625_timing_spec *timing_spec;
> + const struct iio_chan_spec chan_spec;
> + const bool has_power_down_state;
> + const bool has_bandwidth_control;
> + const bool has_internal_vref;
Not sure I'd bother marking these bools const. Unlikely the compiler
can do anything with that info it can't do without it. I guess it does no
real harm thowever.
> +};
> +static int ad7625_probe(struct platform_device *pdev)
> +{
...
> + /*
> + * Set the initial sampling frequency to the maximum, unless the
> + * AD796x device is limited to narrow bandwidth by EN2 == 1, in
> + * which case the sampling frequency should be limited to 2MSPS
> + */
> + if (!st->info->has_bandwidth_control) {
> + default_sample_freq = st->info->max_sample_rate_hz;
> + } else {
> + default_sample_freq = !st->can_wide_bandwidth ?
Flip the logic.
default_sample_freq = st->can_wide_bandwidth ?
st->info->max_sample_rate_hz :
AD7960_MAX_NBW_FREQ;
seems simpler or set a default and override it.
default_sample_freq = st->info_max_sample_rate_hz;
if (st->info->has_bandwidth_control &&
!st->can_wide_bandwidth)
default_sampling_freq = AD7960_MAX_NBW_FREQ;
> + AD7960_MAX_NBW_FREQ :
> + st->info->max_sample_rate_hz;
> + }
next prev parent reply other threads:[~2024-08-23 18:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 14:11 [PATCH v3 0/3] iio: adc: add new ad7625 driver Trevor Gamblin
2024-08-19 14:11 ` [PATCH v3 1/3] dt-bindings: iio: adc: add AD762x/AD796x ADCs Trevor Gamblin
2024-08-19 16:31 ` Conor Dooley
2024-08-19 14:11 ` [PATCH v3 2/3] iio: adc: ad7625: add driver Trevor Gamblin
2024-08-20 7:19 ` kernel test robot
2024-08-20 21:07 ` Trevor Gamblin
2024-09-04 7:58 ` Uwe Kleine-König
2024-09-04 15:00 ` Trevor Gamblin
2024-08-23 18:48 ` Jonathan Cameron [this message]
2024-08-19 14:11 ` [PATCH v3 3/3] docs: iio: new docs for ad7625 driver Trevor Gamblin
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=20240823194852.4d855eb3@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@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=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=tgamblin@baylibre.com \
--cc=u.kleine-koenig@baylibre.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