From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Marcelo Schmitt <marcelo.schmitt@analog.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
jic23@kernel.org, nuno.sa@analog.com, dlechner@baylibre.com,
andy@kernel.org, Michael.Hennerich@analog.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, corbet@lwn.net,
cosmin.tanislav@analog.com, marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v1 2/3] iio: adc: Initial support for AD4134
Date: Mon, 10 Nov 2025 15:13:12 +0200 [thread overview]
Message-ID: <aRHk6KZqQP-PAFuY@smile.fi.intel.com> (raw)
In-Reply-To: <86f532ae3a9b3f122b9d5dbada9c131a0c048ca7.1762777931.git.marcelo.schmitt@analog.com>
On Mon, Nov 10, 2025 at 09:45:40AM -0300, Marcelo Schmitt wrote:
> AD4134 is a 24-bit, 4-channel, simultaneous sampling, precision
> analog-to-digital converter (ADC). The device can be managed through SPI or
> direct control of pin logical levels (pin control mode). The AD4134 design
> also features a dedicated bus for ADC sample data output. Though, this
> initial driver for AD4134 only supports usual SPI connections.
>
> The different wiring configurations will likely require distinct software
> to handle.
> So, the code specific to SPI is enclosed in ad4134-spi.c, while
> functionality that may be useful to all wiring configuration is set into
> ad4134-common.h and ad4134-common.c.
This part is good for comment or cover letter, I dunno what it gives to the Git
history. Perhaps you want to rephrase it somehow?
> Add basic support for AD4134 that allows single-shot ADC sample read.
Below is my review based on the assumption that there is a good justification
for a brand new driver.
...
> +obj-$(CONFIG_AD4134_SPI) += ad4134-spi.o
This can be split also to the separate patch.
...
Please, follow IWYU principle, many are missing here.
+ array_size.h
+ bitfield.h
> +#include <linux/clk.h>
> +#include <linux/crc8.h>
> +#include <linux/delay.h>
> +#include <linux/device.h>
I don't see the use of this, rather dev_printk.h should be put here.
> +#include <linux/err.h>
+ export.h
> +#include <linux/gpio/consumer.h>
> +#include <linux/iio/iio.h>
> +#include <linux/module.h>
> +#include <linux/property.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
+ types.h
...
> +static const char * const ad4143_regulator_names[] = {
> + "avdd5", "dvdd5", "iovdd", "refin", /* Required supplies */
> + "avdd1v8", "dvdd1v8", "clkvdd", /* Required if ldoin not provided */
> + "ldoin",
Make them equal in count (2 lines by 4 in each sounds really good choice
to me).
> +};
...
> +static const char *const ad4134_clk_sel[] = {
> + "xtal1-xtal2", "clkin"
Leave trailing comma here.
> +};
...
> +#define __DRIVERS_IIO_ADC_AD4134_COMMON_H__
Do we need DRIVERS_ part?
...
> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> +#include <linux/compiler_attributes.h>
No need when we have types.h listed.
> +#include <linux/crc8.h>
Is this being used?
> +#include <linux/iio/iio.h>
+ regmap.h
> +#include <linux/units.h>
> +#include <linux/types.h>
Again, follow IWYU.
...
> +#define AD4134_RESET_TIME_US (10 * MICRO)
We have USEC_PER_SEC (include time.h for that).
...
> +#define AD4134_EXT_CLOCK_MHZ (48 * MEGA)
We have HZ_PER_MHZ.
...
> +#define AD4134_SCAN_TYPE(_realbits, _storebits) { \
> + .sign = 's', \
> + .realbits = (_realbits), \
> + .storagebits = (_storebits), \
> + .shift = ((_storebits) - (_realbits)), \
> + .endianness = IIO_BE \
Missing comma, this might make an addition churn in the future changes.
> +}
...
> +struct device;
What about struct gpio_desc?
...
> +#endif /* __DRIVERS_IIO_ADC_AD4134_COMMON_H__ */
...
+ array_size.h
> +#include <linux/bitfield.h>
> +#include <linux/bitops.h>
> +#include <linux/bits.h>
> +#include <linux/crc8.h>
> +#include <linux/device.h>
Is it being used? Perhaps dev_printk.h is enough?
> +#include <linux/delay.h>
> +#include <linux/err.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/types.h>
> +#include <linux/module.h>
+ mod_devicetable.h
> +#include <linux/spi/spi.h>
> +#include <linux/regmap.h>
> +#include <linux/types.h>
> +#include <linux/unaligned.h>
...
> +static int ad4134_calc_spi_crc(u8 inst, u8 data)
> +{
> + u8 buf[] = {inst, data};
Better
u8 buf[] = { inst, data };
> + return crc8(ad4134_spi_crc_table, buf, ARRAY_SIZE(buf),
> + AD4134_SPI_CRC_INIT_VALUE);
> +}
...
> +static const struct spi_device_id ad4134_id[] = {
> + { "ad4134", (kernel_ulong_t)&ad4134_min_io_bus_info },
> + { },
No comma for the terminator entry. It's even inconsistent with the below ID
table.
> +};
> +MODULE_DEVICE_TABLE(spi, ad4134_id);
> +
> +static const struct of_device_id ad4134_of_match[] = {
> + { .compatible = "adi,ad4134", .data = &ad4134_min_io_bus_info },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, ad4134_of_match);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-10 13:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 12:44 [PATCH v1 0/3] iio: adc: Add AD4134 minimum I/O support Marcelo Schmitt
2025-11-10 12:45 ` [PATCH v1 1/3] dt-bindings: iio: adc: Add AD4134 Marcelo Schmitt
2025-11-10 19:07 ` Conor Dooley
2025-11-13 21:56 ` Marcelo Schmitt
2025-11-14 1:43 ` Conor Dooley
2025-11-10 12:45 ` [PATCH v1 2/3] iio: adc: Initial support for AD4134 Marcelo Schmitt
2025-11-10 13:13 ` Andy Shevchenko [this message]
2025-11-11 21:11 ` Jonathan Cameron
2025-11-14 6:47 ` kernel test robot
2025-11-14 9:26 ` kernel test robot
2025-11-10 12:45 ` [PATCH v1 3/3] Docs: iio: Add AD4134 Marcelo Schmitt
2025-11-10 19:24 ` Randy Dunlap
2025-11-10 12:54 ` [PATCH v1 0/3] iio: adc: Add AD4134 minimum I/O support Andy Shevchenko
2025-11-10 15:43 ` Marcelo Schmitt
2025-11-10 14:48 ` Nuno Sá
2025-11-10 16:46 ` 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=aRHk6KZqQP-PAFuY@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=cosmin.tanislav@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@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=marcelo.schmitt1@gmail.com \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@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;
as well as URLs for NNTP newsgroup(s).