Re: [PATCH v2 7/8] iio: adc: ti-ads112c14: implement gain on internal short SYS_MON channel

From: Jonathan Cameron

Date: Wed Jul 01 2026 - 16:02:15 EST


On Thu, 25 Jun 2026 16:55:09 -0500
"David Lechner (TI)" <dlechner@xxxxxxxxxxxx> wrote:

> Implement support for the programmable gain amplifier on the internal
> short SYS_MON channel. This channel is used for calibration, so it is
> useful to be able to set the PGA to the same gain as the external
> channels. The gain setting is implemented via the `_scale` attribute.
>
> In the future, we may want to support different reference voltages for
> this channel, so the scale_available table is populated during probe
> rather than being a static table.
>
> Signed-off-by: David Lechner (TI) <dlechner@xxxxxxxxxxxx>
Trivial stuff again.

> ---
> v2 changes:
> * Make some changes to reduce diff in next patch.
> * Add some local variables to reduce line wrap.
> ---
> drivers/iio/adc/ti-ads112c14.c | 144 ++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 141 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads112c14.c b/drivers/iio/adc/ti-ads112c14.c
> index c61d47244732..0e775dbc8d50 100644
> --- a/drivers/iio/adc/ti-ads112c14.c
> +++ b/drivers/iio/adc/ti-ads112c14.c
> @@ -124,6 +124,26 @@
> #define ADS112C14_INT_REF0_mV 1250
> #define ADS112C14_INT_REF1_mV 2500
>
> +/* Available gains as tenths (x10) */
> +static const u32 ads112c14_pga_gains_x10[] = {
> + 5, /* 0.5 */
Not sure it is worth commenting all of them!

> + 10, /* 1 */
> + 20, /* 2 */
> + 40, /* 4 */
> + 50, /* 5 */
> + 80, /* 8 */
> + 100, /* 10 */
> + 160, /* 16 */
> + 200, /* 20 */
> + 320, /* 32 */
> + 500, /* 50 */
> + 640, /* 64 */
> + 1000, /* 100 */
> + 1280, /* 128 */
> + 2000, /* 200 */
> + 2560, /* 256 */
> +};