Skip to contentSkip to conversation

Add support for AD4113

PATCH In review Dumitru Ceclan 2 participants 7 messages Aug 12, 2024 – Sep 9, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Add support for AD4113

This patch series adds support for the AD4113 ADC within the existing AD7173 driver.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

The part is not released yet and the documentation is not public. Register map is identical to AD4114 besides the lower width data register and the GPIO register.

Particularities of this model:
- 16 bit data register
- no temperature sensor
- no current inputs
- input buffers
- internal reference
- external reference REF-/REF+
- no second external reference REF2-/REF2+
- no AVDD2 supply
- 2 GPIO pins with config bits starting at a higher position in register
- 8 VINx inputs with voltage divider
- 16 channel registers and 8 setup registers

---
Changes in v3:
- lowercase chip ID
- add patch to correctly order chip IDs defines
- picked up RB and ACK tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- correctly set realbits and storagebits to 16 in iio_chan_spec
- describe bindings restrictions in commit message due to lack of sufficient diff context
- describe model differences better in cover letter
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dumitru Ceclan (3):
dt-bindings: adc: ad7173: add support for ad4113
iio: adc: ad7173: order chipID by value
iio: adc: ad7173: add support for ad4113

 .../devicetree/bindings/iio/adc/adi,ad7173.yaml    |  3 ++
 drivers/iio/adc/ad7173.c                           | 38 ++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

---
base-commit: 1c61e13d7dc9003662bd7fd6064dfea67e64b014
change-id: 20240725-ad4113-baa63ff99245

Best regards,

Signature · 1 line
Dumitru Ceclan <[email protected]>
#1 lore raw

PATCH v3 1/3 dt-bindings: adc: ad7173: add support for ad4113

This commit adds bindings support for AD4113.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

Added ad4113 to the compatible list and the "avdd2-supply: false" restriction.

---
 Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml +3 -0
index 17c5d39cc2c1..ad15cf9bc2ff 100644
@@ -28,6 +28,7 @@ description: |
   Datasheets for supported chips:
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD4111.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD4112.pdf
+    <AD4113: not released yet>
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD4114.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD4115.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD4116.pdf
@@ -44,6 +45,7 @@ properties:
     enum:
       - adi,ad4111
       - adi,ad4112
+      - adi,ad4113
       - adi,ad4114
       - adi,ad4115
       - adi,ad4116
@@ -331,6 +333,7 @@ allOf:
             enum:
               - adi,ad4111
               - adi,ad4112
+              - adi,ad4113
               - adi,ad4114
               - adi,ad4115
               - adi,ad4116
Signature · 1 line
2.43.0
#2 lore raw

PATCH v3 2/3 iio: adc: ad7173: order chipID by value

In reply to Dumitru Ceclan

The chipIDs defines were supposed to be ordered by value, one was out of order. Fix the order.

---
 drivers/iio/adc/ad7173.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7173.c +1 -1
index a854f2d30174..a2bfc28932a5 100644
@@ -76,8 +76,8 @@
 					(x) == AD7173_AIN_REF_NEG)
 
 #define AD7172_2_ID			0x00d0
-#define AD7175_ID			0x0cd0
 #define AD7176_ID			0x0c90
+#define AD7175_ID			0x0cd0
 #define AD7175_2_ID			0x0cd0
 #define AD7172_4_ID			0x2050
 #define AD7173_ID			0x30d0
Signature · 1 line
2.43.0
#3 lore raw

PATCH v3 3/3 iio: adc: ad7173: add support for ad4113

In reply to Dumitru Ceclan

This commit adds support for the AD4113 ADC.
The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

---
 drivers/iio/adc/ad7173.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/iio/adc/ad7173.c +35 -1
index a2bfc28932a5..42f040660fdd 100644
@@ -3,7 +3,7 @@
  * AD717x and AD411x family SPI ADC driver
  *
  * Supported devices:
- *  AD4111/AD4112/AD4114/AD4115/AD4116
+ *  AD4111/AD4112/AD4113/AD4114/AD4115/AD4116
  *  AD7172-2/AD7172-4/AD7173-8/AD7175-2
  *  AD7175-8/AD7176-2/AD7177-2
  *
@@ -84,6 +84,7 @@
 #define AD4111_ID			AD7173_ID
 #define AD4112_ID			AD7173_ID
 #define AD4114_ID			AD7173_ID
+#define AD4113_ID			0x31d0
 #define AD4116_ID			0x34d0
 #define AD4115_ID			0x38d0
 #define AD7175_8_ID			0x3cd0
@@ -170,6 +171,7 @@ struct ad7173_device_info {
 	bool has_temp;
 	/* ((AVDD1 − AVSS)/5) */
 	bool has_pow_supply_monitoring;
+	bool data_reg_only_16bit;
 	bool has_input_buf;
 	bool has_int_ref;
 	bool has_ref2;
@@ -294,6 +296,24 @@ static const struct ad7173_device_info ad4112_device_info = {
 	.num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates),
 };
 
+static const struct ad7173_device_info ad4113_device_info = {
+	.name = "ad4113",
+	.id = AD4113_ID,
+	.num_voltage_in_div = 8,
+	.num_channels = 16,
+	.num_configs = 8,
+	.num_voltage_in = 8,
+	.num_gpios = 2,
+	.data_reg_only_16bit = true,
+	.higher_gpio_bits = true,
+	.has_vincom_input = true,
+	.has_input_buf = true,
+	.has_int_ref = true,
+	.clock = 2 * HZ_PER_MHZ,
+	.sinc5_data_rates = ad7173_sinc5_data_rates,
+	.num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates),
+};
+
 static const struct ad7173_device_info ad4114_device_info = {
 	.name = "ad4114",
 	.id = AD4114_ID,
@@ -988,6 +1008,13 @@ static const struct iio_info ad7173_info = {
 	.update_scan_mode = ad7173_update_scan_mode,
 };
 
+static const struct iio_scan_type ad4113_scan_type = {
+	.sign = 'u',
+	.realbits = 16,
+	.storagebits = 16,
+	.endianness = IIO_BE,
+};
+
 static const struct iio_chan_spec ad7173_channel_template = {
 	.type = IIO_VOLTAGE,
 	.indexed = 1,
@@ -1229,6 +1256,8 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
 		chan_st_priv->cfg.input_buf = st->info->has_input_buf;
 		chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF;
 		st->adc_mode |= AD7173_ADC_MODE_REF_EN;
+		if (st->info->data_reg_only_16bit)
+			chan_arr[chan_index].scan_type = ad4113_scan_type;
 
 		chan_index++;
 	}
@@ -1309,6 +1338,9 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
 			chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]);
 		}
 
+		if (st->info->data_reg_only_16bit)
+			chan_arr[chan_index].scan_type = ad4113_scan_type;
+
 		chan_index++;
 	}
 	return 0;
@@ -1437,6 +1469,7 @@ static int ad7173_probe(struct spi_device *spi)
 static const struct of_device_id ad7173_of_match[] = {
 	{ .compatible = "adi,ad4111",	.data = &ad4111_device_info },
 	{ .compatible = "adi,ad4112",	.data = &ad4112_device_info },
+	{ .compatible = "adi,ad4113",	.data = &ad4113_device_info },
 	{ .compatible = "adi,ad4114",	.data = &ad4114_device_info },
 	{ .compatible = "adi,ad4115",	.data = &ad4115_device_info },
 	{ .compatible = "adi,ad4116",	.data = &ad4116_device_info },
@@ -1454,6 +1487,7 @@ MODULE_DEVICE_TABLE(of, ad7173_of_match);
 static const struct spi_device_id ad7173_id_table[] = {
 	{ "ad4111",   (kernel_ulong_t)&ad4111_device_info },
 	{ "ad4112",   (kernel_ulong_t)&ad4112_device_info },
+	{ "ad4113",   (kernel_ulong_t)&ad4113_device_info },
 	{ "ad4114",   (kernel_ulong_t)&ad4114_device_info },
 	{ "ad4115",   (kernel_ulong_t)&ad4115_device_info },
 	{ "ad4116",   (kernel_ulong_t)&ad4116_device_info },
Signature · 1 line
2.43.0
maintainer
#4 lore raw
In reply to Dumitru Ceclan
Quoted 24 lines · On Mon, 12 Aug 2024 11:13:13 +0300 Dumitru Ceclan via B4 Relay…

This patch series adds support for the AD4113 ADC within the existing AD7173 driver.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

The part is not released yet and the documentation is not public. Register map is identical to AD4114 besides the lower width data register and the GPIO register.

Particularities of this model:
- 16 bit data register
- no temperature sensor
- no current inputs
- input buffers
- internal reference
- external reference REF-/REF+
- no second external reference REF2-/REF2+
- no AVDD2 supply
- 2 GPIO pins with config bits starting at a higher position in register
- 8 VINx inputs with voltage divider
- 16 channel registers and 8 setup registers

Quoted 1 line

Hi.

Series is fine, but I don't yet have the fix [PATCH] iio: adc: ad7173: Fix incorrect compatible string in the upstream of my togreg branch.

Hence this will have to wait a little while for that to be present. Otherwise this will create a fiddly merge for linux-next etc.

Jonathan

Quoted 28 lines

---
Changes in v3:
- lowercase chip ID
- add patch to correctly order chip IDs defines
- picked up RB and ACK tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- correctly set realbits and storagebits to 16 in iio_chan_spec
- describe bindings restrictions in commit message due to lack of sufficient diff context
- describe model differences better in cover letter
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dumitru Ceclan (3):
dt-bindings: adc: ad7173: add support for ad4113
iio: adc: ad7173: order chipID by value
iio: adc: ad7173: add support for ad4113

 .../devicetree/bindings/iio/adc/adi,ad7173.yaml    |  3 ++
 drivers/iio/adc/ad7173.c                           | 38 ++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

---
base-commit: 1c61e13d7dc9003662bd7fd6064dfea67e64b014
change-id: 20240725-ad4113-baa63ff99245

Best regards,

maintainer
#5 lore raw
Quoted 28 lines · On Sat, 17 Aug 2024 11:19:02 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 24 lines · On Mon, 12 Aug 2024 11:13:13 +0300 Dumitru Ceclan via B4 Relay…

This patch series adds support for the AD4113 ADC within the existing AD7173 driver.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

The part is not released yet and the documentation is not public. Register map is identical to AD4114 besides the lower width data register and the GPIO register.

Particularities of this model:
- 16 bit data register
- no temperature sensor
- no current inputs
- input buffers
- internal reference
- external reference REF-/REF+
- no second external reference REF2-/REF2+
- no AVDD2 supply
- 2 GPIO pins with config bits starting at a higher position in register
- 8 VINx inputs with voltage divider
- 16 channel registers and 8 setup registers

Quoted 1 line
Quoted 8 lines

Hi.

Series is fine, but I don't yet have the fix [PATCH] iio: adc: ad7173: Fix incorrect compatible string in the upstream of my togreg branch.

Hence this will have to wait a little while for that to be present. Otherwise this will create a fiddly merge for linux-next etc.

Tree juggling didn't go entirely according to plan so unfortunately this has slipped back to next cycle unless there is a delay in the 6.12 merge window opening.

Sorry about that, and I'll make sure to queued it up nice and early after rc1.

Quoted 33 lines

Jonathan

Quoted 28 lines

---
Changes in v3:
- lowercase chip ID
- add patch to correctly order chip IDs defines
- picked up RB and ACK tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- correctly set realbits and storagebits to 16 in iio_chan_spec
- describe bindings restrictions in commit message due to lack of sufficient diff context
- describe model differences better in cover letter
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dumitru Ceclan (3):
dt-bindings: adc: ad7173: add support for ad4113
iio: adc: ad7173: order chipID by value
iio: adc: ad7173: add support for ad4113

 .../devicetree/bindings/iio/adc/adi,ad7173.yaml    |  3 ++
 drivers/iio/adc/ad7173.c                           | 38 ++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

---
base-commit: 1c61e13d7dc9003662bd7fd6064dfea67e64b014
change-id: 20240725-ad4113-baa63ff99245

Best regards,

maintainer
#6 lore raw
Quoted 40 lines · On Sun, 8 Sep 2024 11:41:43 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 28 lines · On Sat, 17 Aug 2024 11:19:02 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 24 lines · On Mon, 12 Aug 2024 11:13:13 +0300 Dumitru Ceclan via B4 Relay…

This patch series adds support for the AD4113 ADC within the existing AD7173 driver.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital converter (ADC) that integrates an analog front end (AFE) for four fully differential or eight single-ended inputs.

The part is not released yet and the documentation is not public. Register map is identical to AD4114 besides the lower width data register and the GPIO register.

Particularities of this model:
- 16 bit data register
- no temperature sensor
- no current inputs
- input buffers
- internal reference
- external reference REF-/REF+
- no second external reference REF2-/REF2+
- no AVDD2 supply
- 2 GPIO pins with config bits starting at a higher position in register
- 8 VINx inputs with voltage divider
- 16 channel registers and 8 setup registers

Quoted 1 line
Quoted 8 lines

Hi.

Series is fine, but I don't yet have the fix [PATCH] iio: adc: ad7173: Fix incorrect compatible string in the upstream of my togreg branch.

Hence this will have to wait a little while for that to be present. Otherwise this will create a fiddly merge for linux-next etc.

Quoted 6 lines

Tree juggling didn't go entirely according to plan so unfortunately this has slipped back to next cycle unless there is a delay in the 6.12 merge window opening.

Sorry about that, and I'll make sure to queued it up nice and early after rc1.

Applied now. Given Linus wasn't super clear on whether he plans to do an rc8 I might still send a speculative pull request in case there is a delay. If so I'll do that in a few days after this as first sat in my testing branch for 0-day to look then togreg branch hence Linux-next for a day or two after that.

Jonathan

Quoted 36 lines
Quoted 34 lines

Jonathan

Quoted 28 lines

---
Changes in v3:
- lowercase chip ID
- add patch to correctly order chip IDs defines
- picked up RB and ACK tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- correctly set realbits and storagebits to 16 in iio_chan_spec
- describe bindings restrictions in commit message due to lack of sufficient diff context
- describe model differences better in cover letter
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dumitru Ceclan (3):
dt-bindings: adc: ad7173: add support for ad4113
iio: adc: ad7173: order chipID by value
iio: adc: ad7173: add support for ad4113

 .../devicetree/bindings/iio/adc/adi,ad7173.yaml    |  3 ++
 drivers/iio/adc/ad7173.c                           | 38 ++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

---
base-commit: 1c61e13d7dc9003662bd7fd6064dfea67e64b014
change-id: 20240725-ad4113-baa63ff99245

Best regards,