dts: bindings: adc-controller: Add zephyr,differential property

Add a property that allows explicit selection of the differential
input mode for ADC channels in DTS. This is useful for controllers
that do not have configurable inputs, so the zephyr,negative-input
property that implicitly selects the differential mode is not
specified for them.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2023-07-18 14:47:39 +02:00 committed by Carles Cufí
commit ff0f389d0b
2 changed files with 10 additions and 2 deletions

View file

@ -121,6 +121,13 @@ child-binding:
hardware (e.g. when the hardware does not allow to configure the hardware (e.g. when the hardware does not allow to configure the
acquisition time). acquisition time).
zephyr,differential:
type: boolean
description: |
When set, selects differential input mode for the channel. Otherwise,
single-ended mode is used unless the zephyr,input-negative property is
specified, in which case the differential mode is selected implicitly.
zephyr,input-positive: zephyr,input-positive:
type: int type: int
description: | description: |
@ -132,8 +139,7 @@ child-binding:
description: | description: |
Negative ADC input. Used only for drivers that select Negative ADC input. Used only for drivers that select
the ADC_CONFIGURABLE_INPUTS Kconfig option. the ADC_CONFIGURABLE_INPUTS Kconfig option.
When specified, the channel is to be used in differential input mode, When specified, implies the differential input mode for the channel.
otherwise, single-ended mode is used.
zephyr,resolution: zephyr,resolution:
type: int type: int

View file

@ -231,6 +231,8 @@ IF_ENABLED(CONFIG_ADC_CONFIGURABLE_INPUTS, \
(.differential = DT_NODE_HAS_PROP(node_id, zephyr_input_negative), \ (.differential = DT_NODE_HAS_PROP(node_id, zephyr_input_negative), \
.input_positive = DT_PROP_OR(node_id, zephyr_input_positive, 0), \ .input_positive = DT_PROP_OR(node_id, zephyr_input_positive, 0), \
.input_negative = DT_PROP_OR(node_id, zephyr_input_negative, 0),)) \ .input_negative = DT_PROP_OR(node_id, zephyr_input_negative, 0),)) \
IF_ENABLED(DT_PROP(node_id, zephyr_differential), \
(.differential = true,)) \
IF_ENABLED(CONFIG_ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN, \ 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_set = DT_NODE_HAS_PROP(node_id, zephyr_current_source_pin), \
.current_source_pin = DT_PROP_OR(node_id, zephyr_current_source_pin, {0}),)) \ .current_source_pin = DT_PROP_OR(node_id, zephyr_current_source_pin, {0}),)) \