Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: adc: ad4080: add support for AD4883
@ 2026-07-20 13:37 Antoniu Miclaus
  2026-07-20 13:37 ` [PATCH 1/2] dt-bindings: iio: adc: ad4080: add AD4883 support Antoniu Miclaus
  2026-07-20 13:37 ` [PATCH 2/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
  0 siblings, 2 replies; 4+ messages in thread
From: Antoniu Miclaus @ 2026-07-20 13:37 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
	Jonathan Cameron, Alexandru Ardelean, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-iio, devicetree,
	linux-kernel

Add support for the AD4883, a dual-channel, 16-bit, 40 MSPS SAR ADC in
the AD4080 family. Like the AD4880, each of its two independent ADC
channels has its own SPI configuration interface, so the part requires
two chip selects and two io-backends.

The first patch adds the devicetree binding compatible string; the
second adds the driver support (chip ID, channel spec, chip info and
device-table entries).

Antoniu Miclaus (2):
  dt-bindings: iio: adc: ad4080: add AD4883 support
  iio: adc: ad4080: add support for AD4883

 .../bindings/iio/adc/adi,ad4080.yaml           |  2 ++
 drivers/iio/adc/ad4080.c                       | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)


base-commit: 7961435cd21903f761712cdf8fe3ed5ea24ebdc7
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] dt-bindings: iio: adc: ad4080: add AD4883 support
  2026-07-20 13:37 [PATCH 0/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
@ 2026-07-20 13:37 ` Antoniu Miclaus
  2026-07-20 13:37 ` [PATCH 2/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
  1 sibling, 0 replies; 4+ messages in thread
From: Antoniu Miclaus @ 2026-07-20 13:37 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
	Jonathan Cameron, Alexandru Ardelean, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-iio, devicetree,
	linux-kernel

Add AD4883 compatible string to the AD4080 devicetree binding.

The AD4883 is a dual-channel, 16-bit, 40 MSPS SAR ADC, sharing the same
register map and interface as the AD4080 family. Like the AD4880, it
requires two SPI chip selects and two io-backends for its independent
ADC channels. The AD4883 differs from the AD4880 in resolution (16-bit
vs 20-bit), which requires distinct channel configuration in the driver,
precluding a fallback compatible.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml
index 4a3f7d3e05c3..db8467b98e67 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad4080.yaml
@@ -39,6 +39,7 @@ properties:
       - adi,ad4087
       - adi,ad4088
       - adi,ad4880
+      - adi,ad4883
       - adi,ad4884
 
   reg:
@@ -102,6 +103,7 @@ allOf:
           contains:
             enum:
               - adi,ad4880
+              - adi,ad4883
               - adi,ad4884
     then:
       properties:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] iio: adc: ad4080: add support for AD4883
  2026-07-20 13:37 [PATCH 0/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
  2026-07-20 13:37 ` [PATCH 1/2] dt-bindings: iio: adc: ad4080: add AD4883 support Antoniu Miclaus
@ 2026-07-20 13:37 ` Antoniu Miclaus
  2026-07-20 13:58   ` sashiko-bot
  1 sibling, 1 reply; 4+ messages in thread
From: Antoniu Miclaus @ 2026-07-20 13:37 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Antoniu Miclaus,
	Jonathan Cameron, Alexandru Ardelean, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-iio, devicetree,
	linux-kernel

Add support for the AD4883, a dual-channel, 16-bit, 40 MSPS SAR ADC.

The AD4883 is the dual-channel variant of the AD4083, sharing the same
register map and SPI interface as the rest of the AD4080 family. Like
the AD4880, it uses two independent ADC channels, each with its own SPI
configuration interface.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/adc/ad4080.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/iio/adc/ad4080.c b/drivers/iio/adc/ad4080.c
index c7ecf6971be4..543728c7e88c 100644
--- a/drivers/iio/adc/ad4080.c
+++ b/drivers/iio/adc/ad4080.c
@@ -135,6 +135,7 @@
 #define AD4087_CHIP_ID						0x0057
 #define AD4088_CHIP_ID						0x0058
 #define AD4880_CHIP_ID						0x0059
+#define AD4883_CHIP_ID						0x005B
 #define AD4884_CHIP_ID						0x005C
 
 #define AD4080_MAX_CHANNELS					2
@@ -541,6 +542,11 @@ static const struct iio_chan_spec ad4880_channels[] = {
 	AD4880_CHANNEL_DEFINE(20, 32, 1),
 };
 
+static const struct iio_chan_spec ad4883_channels[] = {
+	AD4880_CHANNEL_DEFINE(16, 16, 0),
+	AD4880_CHANNEL_DEFINE(16, 16, 1),
+};
+
 static const struct iio_chan_spec ad4884_channels[] = {
 	AD4880_CHANNEL_DEFINE(16, 16, 0),
 	AD4880_CHANNEL_DEFINE(16, 16, 1),
@@ -646,6 +652,16 @@ static const struct ad4080_chip_info ad4880_chip_info = {
 	.lvds_cnv_clk_cnt_max = AD4080_LVDS_CNV_CLK_CNT_MAX,
 };
 
+static const struct ad4080_chip_info ad4883_chip_info = {
+	.name = "ad4883",
+	.product_id = AD4883_CHIP_ID,
+	.scale_table = ad4080_scale_table,
+	.num_scales = ARRAY_SIZE(ad4080_scale_table),
+	.num_channels = 2,
+	.channels = ad4883_channels,
+	.lvds_cnv_clk_cnt_max = 5,
+};
+
 static const struct ad4080_chip_info ad4884_chip_info = {
 	.name = "ad4884",
 	.product_id = AD4884_CHIP_ID,
@@ -858,6 +874,7 @@ static const struct spi_device_id ad4080_id[] = {
 	{ .name = "ad4087", .driver_data = (kernel_ulong_t)&ad4087_chip_info },
 	{ .name = "ad4088", .driver_data = (kernel_ulong_t)&ad4088_chip_info },
 	{ .name = "ad4880", .driver_data = (kernel_ulong_t)&ad4880_chip_info },
+	{ .name = "ad4883", .driver_data = (kernel_ulong_t)&ad4883_chip_info },
 	{ .name = "ad4884", .driver_data = (kernel_ulong_t)&ad4884_chip_info },
 	{ }
 };
@@ -874,6 +891,7 @@ static const struct of_device_id ad4080_of_match[] = {
 	{ .compatible = "adi,ad4087", &ad4087_chip_info },
 	{ .compatible = "adi,ad4088", &ad4088_chip_info },
 	{ .compatible = "adi,ad4880", &ad4880_chip_info },
+	{ .compatible = "adi,ad4883", &ad4883_chip_info },
 	{ .compatible = "adi,ad4884", &ad4884_chip_info },
 	{ }
 };
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iio: adc: ad4080: add support for AD4883
  2026-07-20 13:37 ` [PATCH 2/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
@ 2026-07-20 13:58   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-07-20 13:58 UTC (permalink / raw)
  To: Antoniu Miclaus; +Cc: robh, devicetree, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The `ad4080_get_scale` function calculates the fractional part of the scale in micro units but returns `IIO_VAL_INT_PLUS_NANO`, causing the userspace scale value to be off by a factor of 1000.
--

--- Patch [2]: [PATCH 2/2] iio: adc: ad4080: add support for AD4883 ---
commit 1f80e540484a260f71b5515f8af8d43748391d9e
Author: Antoniu Miclaus <antoniu.miclaus@analog.com>

iio: adc: ad4080: add support for AD4883

This commit adds support for the AD4883, a dual-channel, 16-bit, 40 MSPS
SAR ADC. It shares the register map and SPI interface with the AD4080
family and provides two independent ADC channels.

> diff --git a/drivers/iio/adc/ad4080.c b/drivers/iio/adc/ad4080.c
> index c7ecf6971be45..543728c7e88c0 100644
> --- a/drivers/iio/adc/ad4080.c
> +++ b/drivers/iio/adc/ad4080.c

[ ... ]

> @@ -646,6 +652,16 @@ static const struct ad4080_chip_info ad4880_chip_info = {
>  	.lvds_cnv_clk_cnt_max = AD4080_LVDS_CNV_CLK_CNT_MAX,
>  };
>  
> +static const struct ad4080_chip_info ad4883_chip_info = {
> +	.name = "ad4883",
> +	.product_id = AD4883_CHIP_ID,
> +	.scale_table = ad4080_scale_table,

[Severity: High]
This isn't a bug introduced by this patch, but looking at how the scale table
is used in ad4080_get_scale(), is there a mismatch in the units returned?

drivers/iio/adc/ad4080.c:ad4080_get_scale() {
	...
	tmp = (st->info->scale_table[0][0] * 1000000ULL) >>
		    st->info->channels[0].scan_type.realbits;
	*val = tmp / 1000000;
	*val2 = tmp % 1000000;

	return IIO_VAL_INT_PLUS_NANO;
}

Since the fractional part is calculated using modulo 1000000 (micro units)
but returned as IIO_VAL_INT_PLUS_NANO, the IIO core will format it as a
nano-scale value. Does this cause the scale exposed to userspace to be off
by a factor of 1000?

Should this return IIO_VAL_INT_PLUS_MICRO instead, or calculate with
1000000000ULL to match the NANO return type?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720133707.103366-1-antoniu.miclaus@analog.com?part=2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-20 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 13:37 [PATCH 0/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
2026-07-20 13:37 ` [PATCH 1/2] dt-bindings: iio: adc: ad4080: add AD4883 support Antoniu Miclaus
2026-07-20 13:37 ` [PATCH 2/2] iio: adc: ad4080: add support for AD4883 Antoniu Miclaus
2026-07-20 13:58   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox