Re: [PATCH v8 7/8] iio: adc: ad4030: Add support for ADAQ4216 and ADAQ4224
From: Andy Shevchenko
Date: Sun Feb 08 2026 - 09:01:28 EST
On Fri, Feb 06, 2026 at 04:02:19PM -0300, Marcelo Schmitt wrote:
> ADAQ4216 and ADAQ4224 are similar to AD4030, but feature a PGA circuitry
> that scales the analog input signal prior to it reaching the ADC. The PGA
> is controlled through a pair of pins (A0 and A1) whose state define the
> gain that is applied to the input signal.
>
> Add support for ADAQ4216 and ADAQ4224. Provide a list of PGA options
> through the IIO device channel scale available interface and enable control
> of the PGA through the channel scale interface.
...
> +/*
> + * Gains computed as fractions of 1000 so they can be expressed by integers.
> + */
> +static const int adaq4216_hw_gains_vpv[] = {
> + 1 * MILLI / 3, /* 333 */
> + 5 * MILLI / 9, /* 555 */
> + 20 * MILLI / 9, /* 2222 */
> + 20 * MILLI / 3, /* 6666 */
In case you would need a new version, or Jonathan is okay to tweak, I think
it's better to use float in the comments. The above comment explains the
MILL multiplier for the values.
1 * MILLI / 3, /* 0.333 */
5 * MILLI / 9, /* 0.555 */
20 * MILLI / 9, /* 0.2222 */
20 * MILLI / 3, /* 0.6666 */
> +};
Btw, if this true (if I am not mistaken in the gain values), the question is
why 0.2222 is much higher than 0.555.
--
With Best Regards,
Andy Shevchenko