Re: [PATCH 4/4] iio: adc: ti-ads112c14: add measurement channel support

From: David Lechner

Date: Tue Jun 16 2026 - 11:37:52 EST


On 6/15/26 5:00 PM, David Lechner (TI) wrote:
> Add support for parsing devicetree properties for measurement channels
> and doing direct reads on these.
>
> There are quite a lot of conditions that have to be met for each
> measurement to be made, so quite a bit of state and algorithms are
> required to handle it.
>
> Channels are created dynamically since the number of possibilities is
> unreasonably large.
>

...

> static void ads112c14_populate_tables(struct ads112c14_data *data)
> {
> u32 vref_uV, fsr_bits;
> - int i;
> +
> + for (u32 i = 0; i < data->num_measurements; i++) {
> + struct ads112c14_measurement *measurement = &data->measurements[i];
> +
> + switch (measurement->vref_source) {
> + case ADS112C14_VREF_SOURCE_EXTERNAL:
> + if (data->ext_ref_ohms)
> + vref_uV = measurement->idac_current_uA *
> + measurement->iadc_count * data->ext_ref_ohms;

One thing I am considering is that if we have a resistor between
REFP and REFN rather than a voltage supply, then we should consider
the channel IIO_RESISTANCE rather than IIO_VOLTAGE.

In this case, the user doesn't care about voltage at all, but rather
the ratio of the REFP-REFN resistor to the measured resistance.