linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support
@ 2025-04-01 22:50 David Lechner
  2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

While developing this driver, we glossed over AD7389-4 since we didn't
have hardware to test it. However, it should be trivial enough to add
support without testing. It is basically the same as AD7380-4 but
instead of no internal reference, it has no external reference. And we
already have support for chips with internal reference only (ADAQ).

We have the typical DT bindings/driver/documentation patches for it plus
a few patches to shuffle around the existing code for supporting chips
with internal-reference-only to make it generic enough to support this
chip as well.

---
David Lechner (5):
      dt-bindings: iio: adc: ad7380: add AD7389-4
      iio: adc: ad7380: rename internal_ref_only
      iio: adc: ad7380: move internal reference voltage to chip_info
      iio: adc: ad7380: add ad7389-4
      Documentation: iio: ad7380: add AD7389-4

 .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 11 +++++
 Documentation/iio/ad7380.rst                       |  7 +++
 drivers/iio/adc/ad7380.c                           | 50 +++++++++++++++++++---
 3 files changed, 61 insertions(+), 7 deletions(-)
---
base-commit: f8ffc92ae9052e6615896052f0c5b808bfc17520
change-id: 20250401-iio-ad7380-add-ad7389-4-1f6d3d7dc749

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


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

* [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
@ 2025-04-01 22:50 ` David Lechner
  2025-04-02  8:25   ` Krzysztof Kozlowski
  2025-04-07  6:42   ` Krzysztof Kozlowski
  2025-04-01 22:50 ` [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only David Lechner
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

Add compatible and quirks for AD7389-4. This is essentially the same as
AD7380-4 but instead of having no internal reference, it has no external
reference voltage supply.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
index ff4f5c21c5482b77ee2774b01ad6d426e68cf207..8dae89ecb64d723dcf2b4af1e0505fc5db49595b 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
@@ -25,6 +25,7 @@ description: |
   * https://www.analog.com/en/products/ad7386-4.html
   * https://www.analog.com/en/products/ad7387-4.html
   * https://www.analog.com/en/products/ad7388-4.html
+  * https://www.analog.com/en/products/ad7389-4.html
   * https://www.analog.com/en/products/adaq4370-4.html
   * https://www.analog.com/en/products/adaq4380-4.html
   * https://www.analog.com/en/products/adaq4381-4.html
@@ -49,6 +50,7 @@ properties:
       - adi,ad7386-4
       - adi,ad7387-4
       - adi,ad7388-4
+      - adi,ad7389-4
       - adi,adaq4370-4
       - adi,adaq4380-4
       - adi,adaq4381-4
@@ -213,6 +215,15 @@ allOf:
       properties:
         refin-supply: false
 
+  # adi,ad7389-4 is internal reference only
+  - if:
+      properties:
+        compatible:
+          const: adi,ad7389-4
+    then:
+      properties:
+        refio-supply: false
+
   # adaq devices need more supplies and using channel to declare gain property
   # only applies to adaq devices
   - if:

-- 
2.43.0


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

* [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
  2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
@ 2025-04-01 22:50 ` David Lechner
  2025-04-03 18:53   ` Nuno Sá
  2025-04-01 22:50 ` [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info David Lechner
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

Rename adaq_internal_ref_only to internal_ref_only_adaq. There are non-
ADAQ chips in the family that are also internal reference only, so the
adaq_ prefix is misleading.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7380.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index 4fcb49fdf56639784098f0147a9faef8dcb6b0f6..18ed07275be8e031e54f3595f70afe47514084cd 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -119,7 +119,7 @@ struct ad7380_chip_info {
 	const char * const *supplies;
 	unsigned int num_supplies;
 	bool external_ref_only;
-	bool adaq_internal_ref_only;
+	bool internal_ref_only;
 	const char * const *vcm_supplies;
 	unsigned int num_vcm_supplies;
 	const unsigned long *available_scan_masks;
@@ -806,7 +806,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
-	.adaq_internal_ref_only = true,
+	.internal_ref_only = true,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -821,7 +821,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
-	.adaq_internal_ref_only = true,
+	.internal_ref_only = true,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -836,7 +836,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
-	.adaq_internal_ref_only = true,
+	.internal_ref_only = true,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -1847,7 +1847,7 @@ static int ad7380_probe(struct spi_device *spi)
 				     "Failed to enable power supplies\n");
 	fsleep(T_POWERUP_US);
 
-	if (st->chip_info->adaq_internal_ref_only) {
+	if (st->chip_info->internal_ref_only) {
 		/*
 		 * ADAQ chips use fixed internal reference but still
 		 * require a specific reference supply to power it.

-- 
2.43.0


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

* [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
  2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
  2025-04-01 22:50 ` [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only David Lechner
@ 2025-04-01 22:50 ` David Lechner
  2025-04-03 18:56   ` Nuno Sá
  2025-04-01 22:50 ` [PATCH 4/5] iio: adc: ad7380: add ad7389-4 David Lechner
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

Move the internal reference voltage value to the chip_info structure.

Before this change, only ADAQ chips could be internal_ref_only and only
non-ADAQ chips could be external_ref_only. Now, this restriction is
removed.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7380.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index 18ed07275be8e031e54f3595f70afe47514084cd..e5cd11fd7b1083af2082985f2c0226b1a97d600f 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -120,6 +120,7 @@ struct ad7380_chip_info {
 	unsigned int num_supplies;
 	bool external_ref_only;
 	bool internal_ref_only;
+	unsigned int internal_ref_mv;
 	const char * const *vcm_supplies;
 	unsigned int num_vcm_supplies;
 	const unsigned long *available_scan_masks;
@@ -609,6 +610,7 @@ static const struct ad7380_chip_info ad7380_chip_info = {
 	.num_simult_channels = 2,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.available_scan_masks = ad7380_2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
 	.max_conversion_rate_hz = 4 * MEGA,
@@ -622,6 +624,7 @@ static const struct ad7380_chip_info ad7381_chip_info = {
 	.num_simult_channels = 2,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.available_scan_masks = ad7380_2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
 	.max_conversion_rate_hz = 4 * MEGA,
@@ -637,6 +640,7 @@ static const struct ad7380_chip_info ad7383_chip_info = {
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
 	.vcm_supplies = ad7380_2_channel_vcm_supplies,
 	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.available_scan_masks = ad7380_2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
 	.max_conversion_rate_hz = 4 * MEGA,
@@ -652,6 +656,7 @@ static const struct ad7380_chip_info ad7384_chip_info = {
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
 	.vcm_supplies = ad7380_2_channel_vcm_supplies,
 	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.available_scan_masks = ad7380_2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
 	.max_conversion_rate_hz = 4 * MEGA,
@@ -665,6 +670,7 @@ static const struct ad7380_chip_info ad7386_chip_info = {
 	.num_simult_channels = 2,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
@@ -679,6 +685,7 @@ static const struct ad7380_chip_info ad7387_chip_info = {
 	.num_simult_channels = 2,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
@@ -693,6 +700,7 @@ static const struct ad7380_chip_info ad7388_chip_info = {
 	.num_simult_channels = 2,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x2_channel_scan_masks,
 	.timing_specs = &ad7380_timing,
@@ -721,6 +729,7 @@ static const struct ad7380_chip_info ad7381_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
 	.max_conversion_rate_hz = 4 * MEGA,
@@ -734,6 +743,7 @@ static const struct ad7380_chip_info ad7383_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.vcm_supplies = ad7380_4_channel_vcm_supplies,
 	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
 	.available_scan_masks = ad7380_4_channel_scan_masks,
@@ -749,6 +759,7 @@ static const struct ad7380_chip_info ad7384_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.vcm_supplies = ad7380_4_channel_vcm_supplies,
 	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
 	.available_scan_masks = ad7380_4_channel_scan_masks,
@@ -764,6 +775,7 @@ static const struct ad7380_chip_info ad7386_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -778,6 +790,7 @@ static const struct ad7380_chip_info ad7387_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -792,6 +805,7 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
 	.num_simult_channels = 4,
 	.supplies = ad7380_supplies,
 	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
 	.has_mux = true,
 	.available_scan_masks = ad7380_2x4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -807,6 +821,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
 	.internal_ref_only = true,
+	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -822,6 +837,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
 	.internal_ref_only = true,
+	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -837,6 +853,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
 	.supplies = adaq4380_supplies,
 	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
 	.internal_ref_only = true,
+	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
 	.has_hardware_gain = true,
 	.available_scan_masks = ad7380_4_channel_scan_masks,
 	.timing_specs = &ad7380_4_timing,
@@ -1855,7 +1872,7 @@ static int ad7380_probe(struct spi_device *spi)
 		 * in bulk_get_enable().
 		 */
 
-		st->vref_mv = ADAQ4380_INTERNAL_REF_MV;
+		st->vref_mv = st->chip_info->internal_ref_mv;
 
 		/* these chips don't have a register bit for this */
 		external_ref_en = false;
@@ -1880,7 +1897,8 @@ static int ad7380_probe(struct spi_device *spi)
 					     "Failed to get refio regulator\n");
 
 		external_ref_en = ret != -ENODEV;
-		st->vref_mv = external_ref_en ? ret / 1000 : AD7380_INTERNAL_REF_MV;
+		st->vref_mv = external_ref_en ? ret / 1000
+					      : st->chip_info->internal_ref_mv;
 	}
 
 	if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))

-- 
2.43.0


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

* [PATCH 4/5] iio: adc: ad7380: add ad7389-4
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
                   ` (2 preceding siblings ...)
  2025-04-01 22:50 ` [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info David Lechner
@ 2025-04-01 22:50 ` David Lechner
  2025-04-03 18:57   ` Nuno Sá
  2025-04-01 22:50 ` [PATCH 5/5] Documentation: iio: ad7380: add AD7389-4 David Lechner
  2025-04-07 18:46 ` [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support Jonathan Cameron
  5 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

Add chip info for AD7389-4 to the ad7380 driver.

This is essentially the same as ad7380-4 except that it is internal-
reference-only instead of external-reference-only.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7380.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index e5cd11fd7b1083af2082985f2c0226b1a97d600f..190ab411739feea32e189cb3ede925056ba4a87e 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -13,6 +13,7 @@
  * ad7381-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7381-4.pdf
  * ad7383/4-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7383-4-ad7384-4.pdf
  * ad7386/7/8-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7386-4-7387-4-7388-4.pdf
+ * ad7389-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7389-4.pdf
  * adaq4370-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4370-4.pdf
  * adaq4380-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4380-4.pdf
  * adaq4381-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4381-4.pdf
@@ -812,6 +813,21 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
 	.max_conversion_rate_hz = 4 * MEGA,
 };
 
+static const struct ad7380_chip_info ad7389_4_chip_info = {
+	.name = "ad7389-4",
+	.channels = ad7380_4_channels,
+	.offload_channels = ad7380_4_offload_channels,
+	.num_channels = ARRAY_SIZE(ad7380_4_channels),
+	.num_simult_channels = 4,
+	.supplies = ad7380_supplies,
+	.num_supplies = ARRAY_SIZE(ad7380_supplies),
+	.internal_ref_only = true,
+	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
+	.available_scan_masks = ad7380_4_channel_scan_masks,
+	.timing_specs = &ad7380_4_timing,
+	.max_conversion_rate_hz = 4 * MEGA,
+};
+
 static const struct ad7380_chip_info adaq4370_4_chip_info = {
 	.name = "adaq4370-4",
 	.channels = adaq4380_4_channels,
@@ -2051,6 +2067,7 @@ static const struct of_device_id ad7380_of_match_table[] = {
 	{ .compatible = "adi,ad7386-4", .data = &ad7386_4_chip_info },
 	{ .compatible = "adi,ad7387-4", .data = &ad7387_4_chip_info },
 	{ .compatible = "adi,ad7388-4", .data = &ad7388_4_chip_info },
+	{ .compatible = "adi,ad7389-4", .data = &ad7389_4_chip_info },
 	{ .compatible = "adi,adaq4370-4", .data = &adaq4370_4_chip_info },
 	{ .compatible = "adi,adaq4380-4", .data = &adaq4380_4_chip_info },
 	{ .compatible = "adi,adaq4381-4", .data = &adaq4381_4_chip_info },
@@ -2072,6 +2089,7 @@ static const struct spi_device_id ad7380_id_table[] = {
 	{ "ad7386-4", (kernel_ulong_t)&ad7386_4_chip_info },
 	{ "ad7387-4", (kernel_ulong_t)&ad7387_4_chip_info },
 	{ "ad7388-4", (kernel_ulong_t)&ad7388_4_chip_info },
+	{ "ad7389-4", (kernel_ulong_t)&ad7389_4_chip_info },
 	{ "adaq4370-4", (kernel_ulong_t)&adaq4370_4_chip_info },
 	{ "adaq4380-4", (kernel_ulong_t)&adaq4380_4_chip_info },
 	{ "adaq4381-4", (kernel_ulong_t)&adaq4381_4_chip_info },

-- 
2.43.0


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

* [PATCH 5/5] Documentation: iio: ad7380: add AD7389-4
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
                   ` (3 preceding siblings ...)
  2025-04-01 22:50 ` [PATCH 4/5] iio: adc: ad7380: add ad7389-4 David Lechner
@ 2025-04-01 22:50 ` David Lechner
  2025-04-07 18:46 ` [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support Jonathan Cameron
  5 siblings, 0 replies; 14+ messages in thread
From: David Lechner @ 2025-04-01 22:50 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc, David Lechner

Document support for AD7389-4 and it's quirks.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 Documentation/iio/ad7380.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/iio/ad7380.rst b/Documentation/iio/ad7380.rst
index 24a92a1c4371db6b59ef47edf06cee860641ebbf..d51f9ee3e939c9d33515ce79701fc7c89f5094f2 100644
--- a/Documentation/iio/ad7380.rst
+++ b/Documentation/iio/ad7380.rst
@@ -27,6 +27,7 @@ The following chips are supported by this driver:
 * `AD7386-4 <https://www.analog.com/en/products/ad7386-4.html>`_
 * `AD7387-4 <https://www.analog.com/en/products/ad7387-4.html>`_
 * `AD7388-4 <https://www.analog.com/en/products/ad7388-4.html>`_
+* `AD7389-4 <https://www.analog.com/en/products/ad7389-4.html>`_
 * `ADAQ4370-4 <https://www.analog.com/en/products/adaq4370-4.html>`_
 * `ADAQ4380-4 <https://www.analog.com/en/products/adaq4380-4.html>`_
 * `ADAQ4381-4 <https://www.analog.com/en/products/adaq4381-4.html>`_
@@ -50,6 +51,12 @@ ad7380-4
 ad7380-4 supports only an external reference voltage (2.5V to 3.3V). It must be
 declared in the device tree as ``refin-supply``.
 
+ad7389-4
+~~~~~~~~
+
+ad7389-4 supports only an internal reference voltage. ``refin-supply`` and
+``refio-supply`` properties are both omitted in this case.
+
 ADAQ devices
 ~~~~~~~~~~~~
 

-- 
2.43.0


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

* Re: [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4
  2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
@ 2025-04-02  8:25   ` Krzysztof Kozlowski
  2025-04-02 14:39     ` David Lechner
  2025-04-07  6:42   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-02  8:25 UTC (permalink / raw)
  To: David Lechner
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio, Michael Hennerich, Nuno Sá, Jonathan Corbet,
	devicetree, linux-kernel, linux-doc

On Tue, Apr 01, 2025 at 05:50:08PM -0500, David Lechner wrote:
> Add compatible and quirks for AD7389-4. This is essentially the same as
> AD7380-4 but instead of having no internal reference, it has no external
> reference voltage supply.

So neither refio nor refin, but your schema says:

> +    then:
> +      properties:
> +        refio-supply: false

So what about refin, which is also external reference?

Best regards,
Krzysztof


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

* Re: [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4
  2025-04-02  8:25   ` Krzysztof Kozlowski
@ 2025-04-02 14:39     ` David Lechner
  2025-04-07  6:41       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 14+ messages in thread
From: David Lechner @ 2025-04-02 14:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio, Michael Hennerich, Nuno Sá, Jonathan Corbet,
	devicetree, linux-kernel, linux-doc

On 4/2/25 3:25 AM, Krzysztof Kozlowski wrote:
> On Tue, Apr 01, 2025 at 05:50:08PM -0500, David Lechner wrote:
>> Add compatible and quirks for AD7389-4. This is essentially the same as
>> AD7380-4 but instead of having no internal reference, it has no external
>> reference voltage supply.
> 
> So neither refio nor refin, but your schema says:
> 
>> +    then:
>> +      properties:
>> +        refio-supply: false
> 
> So what about refin, which is also external reference?

This is already handled by the existing if statement:

  - if:
      properties:
        compatible:
          enum:
            - adi,ad7380-4
            - adi,adaq4370-4
            - adi,adaq4380-4
            - adi,adaq4381-4
    then:
      properties:
        refio-supply: false
      required:
        - refin-supply
    else:
      properties:
        refin-supply: false


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

* Re: [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only
  2025-04-01 22:50 ` [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only David Lechner
@ 2025-04-03 18:53   ` Nuno Sá
  0 siblings, 0 replies; 14+ messages in thread
From: Nuno Sá @ 2025-04-03 18:53 UTC (permalink / raw)
  To: David Lechner, Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc

On Tue, 2025-04-01 at 17:50 -0500, David Lechner wrote:
> Rename adaq_internal_ref_only to internal_ref_only_adaq. There are non-
> ADAQ chips in the family that are also internal reference only, so the
> adaq_ prefix is misleading.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7380.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> 4fcb49fdf56639784098f0147a9faef8dcb6b0f6..18ed07275be8e031e54f3595f70afe47514084cd
> 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -119,7 +119,7 @@ struct ad7380_chip_info {
>  	const char * const *supplies;
>  	unsigned int num_supplies;
>  	bool external_ref_only;
> -	bool adaq_internal_ref_only;
> +	bool internal_ref_only;
>  	const char * const *vcm_supplies;
>  	unsigned int num_vcm_supplies;
>  	const unsigned long *available_scan_masks;
> @@ -806,7 +806,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
> -	.adaq_internal_ref_only = true,
> +	.internal_ref_only = true,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -821,7 +821,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
> -	.adaq_internal_ref_only = true,
> +	.internal_ref_only = true,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -836,7 +836,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
> -	.adaq_internal_ref_only = true,
> +	.internal_ref_only = true,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -1847,7 +1847,7 @@ static int ad7380_probe(struct spi_device *spi)
>  				     "Failed to enable power supplies\n");
>  	fsleep(T_POWERUP_US);
>  
> -	if (st->chip_info->adaq_internal_ref_only) {
> +	if (st->chip_info->internal_ref_only) {
>  		/*
>  		 * ADAQ chips use fixed internal reference but still
>  		 * require a specific reference supply to power it.
> 


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

* Re: [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info
  2025-04-01 22:50 ` [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info David Lechner
@ 2025-04-03 18:56   ` Nuno Sá
  0 siblings, 0 replies; 14+ messages in thread
From: Nuno Sá @ 2025-04-03 18:56 UTC (permalink / raw)
  To: David Lechner, Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc

On Tue, 2025-04-01 at 17:50 -0500, David Lechner wrote:
> Move the internal reference voltage value to the chip_info structure.
> 
> Before this change, only ADAQ chips could be internal_ref_only and only
> non-ADAQ chips could be external_ref_only. Now, this restriction is
> removed.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7380.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> 18ed07275be8e031e54f3595f70afe47514084cd..e5cd11fd7b1083af2082985f2c0226b1a97d600f
> 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -120,6 +120,7 @@ struct ad7380_chip_info {
>  	unsigned int num_supplies;
>  	bool external_ref_only;
>  	bool internal_ref_only;
> +	unsigned int internal_ref_mv;
>  	const char * const *vcm_supplies;
>  	unsigned int num_vcm_supplies;
>  	const unsigned long *available_scan_masks;
> @@ -609,6 +610,7 @@ static const struct ad7380_chip_info ad7380_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -622,6 +624,7 @@ static const struct ad7380_chip_info ad7381_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -637,6 +640,7 @@ static const struct ad7380_chip_info ad7383_chip_info = {
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
>  	.vcm_supplies = ad7380_2_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -652,6 +656,7 @@ static const struct ad7380_chip_info ad7384_chip_info = {
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
>  	.vcm_supplies = ad7380_2_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -665,6 +670,7 @@ static const struct ad7380_chip_info ad7386_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -679,6 +685,7 @@ static const struct ad7380_chip_info ad7387_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -693,6 +700,7 @@ static const struct ad7380_chip_info ad7388_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -721,6 +729,7 @@ static const struct ad7380_chip_info ad7381_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -734,6 +743,7 @@ static const struct ad7380_chip_info ad7383_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.vcm_supplies = ad7380_4_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -749,6 +759,7 @@ static const struct ad7380_chip_info ad7384_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.vcm_supplies = ad7380_4_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -764,6 +775,7 @@ static const struct ad7380_chip_info ad7386_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -778,6 +790,7 @@ static const struct ad7380_chip_info ad7387_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -792,6 +805,7 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -807,6 +821,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -822,6 +837,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -837,6 +853,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -1855,7 +1872,7 @@ static int ad7380_probe(struct spi_device *spi)
>  		 * in bulk_get_enable().
>  		 */
>  
> -		st->vref_mv = ADAQ4380_INTERNAL_REF_MV;
> +		st->vref_mv = st->chip_info->internal_ref_mv;
>  
>  		/* these chips don't have a register bit for this */
>  		external_ref_en = false;
> @@ -1880,7 +1897,8 @@ static int ad7380_probe(struct spi_device *spi)
>  					     "Failed to get refio regulator\n");
>  
>  		external_ref_en = ret != -ENODEV;
> -		st->vref_mv = external_ref_en ? ret / 1000 :
> AD7380_INTERNAL_REF_MV;
> +		st->vref_mv = external_ref_en ? ret / 1000
> +					      : st->chip_info->internal_ref_mv;
>  	}
>  
>  	if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))
> 


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

* Re: [PATCH 4/5] iio: adc: ad7380: add ad7389-4
  2025-04-01 22:50 ` [PATCH 4/5] iio: adc: ad7380: add ad7389-4 David Lechner
@ 2025-04-03 18:57   ` Nuno Sá
  0 siblings, 0 replies; 14+ messages in thread
From: Nuno Sá @ 2025-04-03 18:57 UTC (permalink / raw)
  To: David Lechner, Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-iio
  Cc: Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc

On Tue, 2025-04-01 at 17:50 -0500, David Lechner wrote:
> Add chip info for AD7389-4 to the ad7380 driver.
> 
> This is essentially the same as ad7380-4 except that it is internal-
> reference-only instead of external-reference-only.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7380.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> e5cd11fd7b1083af2082985f2c0226b1a97d600f..190ab411739feea32e189cb3ede925056ba4a87e
> 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -13,6 +13,7 @@
>   * ad7381-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad7381-4.pdf
>   * ad7383/4-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad7383-4-ad7384-4.pdf
>   * ad7386/7/8-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad7386-4-7387-4-7388-4.pdf
> + * ad7389-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/ad7389-4.pdf
>   * adaq4370-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4370-4.pdf
>   * adaq4380-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4380-4.pdf
>   * adaq4381-4 :
> https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4381-4.pdf
> @@ -812,6 +813,21 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
>  	.max_conversion_rate_hz = 4 * MEGA,
>  };
>  
> +static const struct ad7380_chip_info ad7389_4_chip_info = {
> +	.name = "ad7389-4",
> +	.channels = ad7380_4_channels,
> +	.offload_channels = ad7380_4_offload_channels,
> +	.num_channels = ARRAY_SIZE(ad7380_4_channels),
> +	.num_simult_channels = 4,
> +	.supplies = ad7380_supplies,
> +	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_only = true,
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
> +	.available_scan_masks = ad7380_4_channel_scan_masks,
> +	.timing_specs = &ad7380_4_timing,
> +	.max_conversion_rate_hz = 4 * MEGA,
> +};
> +
>  static const struct ad7380_chip_info adaq4370_4_chip_info = {
>  	.name = "adaq4370-4",
>  	.channels = adaq4380_4_channels,
> @@ -2051,6 +2067,7 @@ static const struct of_device_id ad7380_of_match_table[] = {
>  	{ .compatible = "adi,ad7386-4", .data = &ad7386_4_chip_info },
>  	{ .compatible = "adi,ad7387-4", .data = &ad7387_4_chip_info },
>  	{ .compatible = "adi,ad7388-4", .data = &ad7388_4_chip_info },
> +	{ .compatible = "adi,ad7389-4", .data = &ad7389_4_chip_info },
>  	{ .compatible = "adi,adaq4370-4", .data = &adaq4370_4_chip_info },
>  	{ .compatible = "adi,adaq4380-4", .data = &adaq4380_4_chip_info },
>  	{ .compatible = "adi,adaq4381-4", .data = &adaq4381_4_chip_info },
> @@ -2072,6 +2089,7 @@ static const struct spi_device_id ad7380_id_table[] = {
>  	{ "ad7386-4", (kernel_ulong_t)&ad7386_4_chip_info },
>  	{ "ad7387-4", (kernel_ulong_t)&ad7387_4_chip_info },
>  	{ "ad7388-4", (kernel_ulong_t)&ad7388_4_chip_info },
> +	{ "ad7389-4", (kernel_ulong_t)&ad7389_4_chip_info },
>  	{ "adaq4370-4", (kernel_ulong_t)&adaq4370_4_chip_info },
>  	{ "adaq4380-4", (kernel_ulong_t)&adaq4380_4_chip_info },
>  	{ "adaq4381-4", (kernel_ulong_t)&adaq4381_4_chip_info },
> 


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

* Re: [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4
  2025-04-02 14:39     ` David Lechner
@ 2025-04-07  6:41       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-07  6:41 UTC (permalink / raw)
  To: David Lechner
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio, Michael Hennerich, Nuno Sá, Jonathan Corbet,
	devicetree, linux-kernel, linux-doc

On Wed, Apr 02, 2025 at 09:39:43AM GMT, David Lechner wrote:
> On 4/2/25 3:25 AM, Krzysztof Kozlowski wrote:
> > On Tue, Apr 01, 2025 at 05:50:08PM -0500, David Lechner wrote:
> >> Add compatible and quirks for AD7389-4. This is essentially the same as
> >> AD7380-4 but instead of having no internal reference, it has no external
> >> reference voltage supply.
> > 
> > So neither refio nor refin, but your schema says:
> > 
> >> +    then:
> >> +      properties:
> >> +        refio-supply: false
> > 
> > So what about refin, which is also external reference?
> 
> This is already handled by the existing if statement:
> 
>   - if:
>       properties:
>         compatible:
>           enum:
>             - adi,ad7380-4
>             - adi,adaq4370-4
>             - adi,adaq4380-4
>             - adi,adaq4381-4
>     then:
>       properties:
>         refio-supply: false
>       required:
>         - refin-supply
>     else:
>       properties:
>         refin-supply: false

The way the if-then are organized there is not how I would expect, so
thus confusion. Each if: condition has else:, so to understand what
applies to given model one has to read everything!

And you add here second method - if without else.

This is supposed to be simple:
if:
  - model_foo
then:
  ...

if:
  - model_bar
then:
  ...

if:
  - model_baz
then:
  ...


Best regards,
Krzysztof


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

* Re: [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4
  2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
  2025-04-02  8:25   ` Krzysztof Kozlowski
@ 2025-04-07  6:42   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-07  6:42 UTC (permalink / raw)
  To: David Lechner
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio, Michael Hennerich, Nuno Sá, Jonathan Corbet,
	devicetree, linux-kernel, linux-doc

On Tue, Apr 01, 2025 at 05:50:08PM GMT, David Lechner wrote:
> Add compatible and quirks for AD7389-4. This is essentially the same as
> AD7380-4 but instead of having no internal reference, it has no external
> reference voltage supply.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
>  Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support
  2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
                   ` (4 preceding siblings ...)
  2025-04-01 22:50 ` [PATCH 5/5] Documentation: iio: ad7380: add AD7389-4 David Lechner
@ 2025-04-07 18:46 ` Jonathan Cameron
  5 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2025-04-07 18:46 UTC (permalink / raw)
  To: David Lechner
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-iio,
	Michael Hennerich, Nuno Sá, Jonathan Corbet, devicetree,
	linux-kernel, linux-doc

On Tue, 01 Apr 2025 17:50:07 -0500
David Lechner <dlechner@baylibre.com> wrote:

> While developing this driver, we glossed over AD7389-4 since we didn't
> have hardware to test it. However, it should be trivial enough to add
> support without testing. It is basically the same as AD7380-4 but
> instead of no internal reference, it has no external reference. And we
> already have support for chips with internal reference only (ADAQ).
> 
> We have the typical DT bindings/driver/documentation patches for it plus
> a few patches to shuffle around the existing code for supporting chips
> with internal-reference-only to make it generic enough to support this
> chip as well.
Series applied to the togreg branch of iio.git (which I just rebased on rc1)
Will initially push out as testing though to let 0-day have a first poke
at it.

Thanks,

Jonathan

> 
> ---
> David Lechner (5):
>       dt-bindings: iio: adc: ad7380: add AD7389-4
>       iio: adc: ad7380: rename internal_ref_only
>       iio: adc: ad7380: move internal reference voltage to chip_info
>       iio: adc: ad7380: add ad7389-4
>       Documentation: iio: ad7380: add AD7389-4
> 
>  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 11 +++++
>  Documentation/iio/ad7380.rst                       |  7 +++
>  drivers/iio/adc/ad7380.c                           | 50 +++++++++++++++++++---
>  3 files changed, 61 insertions(+), 7 deletions(-)
> ---
> base-commit: f8ffc92ae9052e6615896052f0c5b808bfc17520
> change-id: 20250401-iio-ad7380-add-ad7389-4-1f6d3d7dc749
> 
> Best regards,


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

end of thread, other threads:[~2025-04-07 18:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 22:50 [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support David Lechner
2025-04-01 22:50 ` [PATCH 1/5] dt-bindings: iio: adc: ad7380: add AD7389-4 David Lechner
2025-04-02  8:25   ` Krzysztof Kozlowski
2025-04-02 14:39     ` David Lechner
2025-04-07  6:41       ` Krzysztof Kozlowski
2025-04-07  6:42   ` Krzysztof Kozlowski
2025-04-01 22:50 ` [PATCH 2/5] iio: adc: ad7380: rename internal_ref_only David Lechner
2025-04-03 18:53   ` Nuno Sá
2025-04-01 22:50 ` [PATCH 3/5] iio: adc: ad7380: move internal reference voltage to chip_info David Lechner
2025-04-03 18:56   ` Nuno Sá
2025-04-01 22:50 ` [PATCH 4/5] iio: adc: ad7380: add ad7389-4 David Lechner
2025-04-03 18:57   ` Nuno Sá
2025-04-01 22:50 ` [PATCH 5/5] Documentation: iio: ad7380: add AD7389-4 David Lechner
2025-04-07 18:46 ` [PATCH 0/5] iio: adc: ad7380: add ad7389-4 support Jonathan Cameron

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).