Re: [PATCH 6/6] iio: adc: ad7173: Add support for AD411x devices

David Lechner
2024-04-02T14:00:23Z

On Mon, Apr 1, 2024 at 2:45 PM David Lechner <dlechner@baylibre.com> wrote:
>
> On Mon, Apr 1, 2024 at 10:10 AM Dumitru Ceclan via B4 Relay
> <devnull+dumitru.ceclan.analog.com@kernel.org> wrote:
> >
> > From: Dumitru Ceclan <dumitru.ceclan@analog.com>
> >
> > Add support for AD4111/AD4112/AD4114/AD4115/AD4116.
> >

...

> > @@ -1028,15 +1204,22 @@ static int ad7173_fw_parse_channel_config(struct iio_dev *indio_dev)
> > *chan = ad7173_channel_template;
> > chan->address = chan_index;
> > chan->scan_index = chan_index;
> > - chan->channel = ain[0];
> > - chan->channel2 = ain[1];
> > - chan->differential = true;
> >
> > - chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]);
> > + if (reg >= AD4111_CURRENT_CHAN_CUTOFF) {
> > + chan->type = IIO_CURRENT;
> > + chan->channel = ain[0];
> > + chan_st_priv->ain = ad4111_current_channel_config[ain[0]];
> > + } else {
> > + chan->channel = ain[0];
> > + chan->channel2 = ain[1];
> > + chan->differential = true;
>
> Expecting chan->differential = false when ADCIN15 is configured for
> pseudo-differential inputs.
>
> Also, perhaps missed in previous reviews, I would expect
> chan->differential = false when channels are used as single-ended.
>

After sleeping on it, I came to the concision that these parts are
probably too complex to try to worry about differential vs.
pseudo-differential/single-ended (what the datasheet calls
single-ended is really pseudo-differential).

So I take back my comments about expecting differential = false in those cases.