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>
This commit is contained in:
Benedikt Schmidt 2023-03-07 13:49:34 +01:00 committed by Anas Nashif
commit bb679532f4
3 changed files with 28 additions and 0 deletions

View file

@ -28,6 +28,12 @@ config ADC_SHELL
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

View file

@ -146,3 +146,11 @@ child-binding:
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.

View file

@ -145,6 +145,17 @@ struct adc_channel_cfg {
*/
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 @@ IF_ENABLED(CONFIG_ADC_CONFIGURABLE_INPUTS, \
(.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}),)) \
}
/**