dts: bindings: adc: Add configurable current source pin for ADCs

Add a property to the ADC channels which allows the configuration
of the current source pin.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig
index 6aafc83..120f4a0 100644
--- a/drivers/adc/Kconfig
+++ b/drivers/adc/Kconfig
@@ -28,6 +28,12 @@
 config ADC_CONFIGURABLE_INPUTS
 	bool
 
+# By selecting or not this option particular ADC drivers indicate if it is
+# required to explicitly specify for the excitation current source the pin
+# which should be used.
+config ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN
+	bool
+
 config ADC_ASYNC
 	bool "Asynchronous call support"
 	select POLL
diff --git a/dts/bindings/adc/adc-controller.yaml b/dts/bindings/adc/adc-controller.yaml
index 6d25065..120b9fb 100644
--- a/dts/bindings/adc/adc-controller.yaml
+++ b/dts/bindings/adc/adc-controller.yaml
@@ -146,3 +146,11 @@
         Oversampling setting to be used for the channel.
         When specified, each sample is averaged from 2^N conversion results
         (where N is the provided value).
+
+    zephyr,current-source-pin:
+      type: uint8-array
+      description: |
+        Output pin selection for the current sources. The actual
+        interpretation depends on the driver. This is used only for drivers
+        which select the ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN
+        Kconfig option.
diff --git a/include/zephyr/drivers/adc.h b/include/zephyr/drivers/adc.h
index a5b4087..8dd3af3 100644
--- a/include/zephyr/drivers/adc.h
+++ b/include/zephyr/drivers/adc.h
@@ -145,6 +145,17 @@
 	 */
 	uint8_t input_negative;
 #endif /* CONFIG_ADC_CONFIGURABLE_INPUTS */
+
+#ifdef CONFIG_ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN
+	uint8_t current_source_pin_set : 1;
+	/**
+	 * Output pin for the current sources.
+	 * This is only available if the driver enables this feature
+	 * via the hidden configuration option ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN.
+	 * The meaning itself is then defined by the driver itself.
+	 */
+	uint8_t current_source_pin[2];
+#endif /* CONFIG_ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN */
 };
 
 /**
@@ -220,6 +231,9 @@
 	(.differential    = DT_NODE_HAS_PROP(node_id, zephyr_input_negative), \
 	 .input_positive  = DT_PROP_OR(node_id, zephyr_input_positive, 0), \
 	 .input_negative  = DT_PROP_OR(node_id, zephyr_input_negative, 0),)) \
+IF_ENABLED(CONFIG_ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN, \
+	(.current_source_pin_set = DT_NODE_HAS_PROP(node_id, zephyr_current_source_pin), \
+	 .current_source_pin = DT_PROP_OR(node_id, zephyr_current_source_pin, {0}),)) \
 }
 
 /**