Re: [PATCH v2 2/2] iio: adc: ad7944: add driver for AD7944/AD7985/AD7986

From: David Lechner
Date: Mon Feb 19 2024 - 14:14:00 EST


On Fri, Feb 16, 2024 at 1:47 PM David Lechner <dlechner@xxxxxxxxxxxx> wrote:

..

> +
> +#define AD7944_DEFINE_CHIP_INFO(_name, _t, _bits, _sign) \
> +static const struct ad7944_chip_info _name##_chip_info = { \
> + .name = #_name, \
> + .t = &_t##_timing_spec, \
> + .channels = { \
> + { \
> + .type = IIO_VOLTAGE, \
> + .indexed = 1, \
> + .differential = 1, \
> + .channel = 0, \
> + .channel2 = 1, \
> + .scan_index = 0, \
> + .scan_type.sign = _sign, \
> + .scan_type.realbits = _bits, \
> + .scan_type.storagebits = _bits > 16 ? 32 : 16, \
> + .scan_type.endianness = IIO_CPU, \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) \
> + | BIT(IIO_CHAN_INFO_SCALE), \
> + }, \
> + IIO_CHAN_SOFT_TIMESTAMP(1), \
> + }, \
> +}
> +
> +AD7944_DEFINE_CHIP_INFO(ad7944, ad7944, 14, 'u');
> +AD7944_DEFINE_CHIP_INFO(ad7985, ad7944, 16, 'u');
> +AD7944_DEFINE_CHIP_INFO(ad7986, ad7986, 18, 's');

Now that I have been enlightened [1] about pseudo-differntial inputs,
I'm thinking that AD7944 and AD7985 should not have the .differential
= 1 flag set since they are pseudo-differential inputs with a ground
sense on the negative input (and no extra supply needed since it is
always ground). Does that sound right?

AD7986 is true differential though, so should be correct already.

[1]: https://lore.kernel.org/linux-iio/CAMknhBF5mAsN1c-194Qwa5oKmqKzef2khXnqA1cSdKpWHKWp0w@xxxxxxxxxxxxxx/