Re: [PATCH v2 2/7] iio: adc: Add ti-ads1262 driver

From: Jonathan Cameron

Date: Mon Jun 29 2026 - 20:43:34 EST


On Sun, 28 Jun 2026 00:36:03 -0500
Kurt Borja <kuurtb@xxxxxxxxx> wrote:

> Add the ti-ads1262 driver with initial support for the primary ADC
> (ADC1). The ADS1263 auxiliary ADC (ADC2) is handled by a separate driver
> and interoperability considerations were taken into account.
>
> Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>

I took a quick look and vast majority of stuff I found was already well
covered by David. I'll take a more detailed look at next version.

One trivial thing inline.

Thanks,

Jonathan

> diff --git a/drivers/iio/adc/ti-ads1262.c b/drivers/iio/adc/ti-ads1262.c
> new file mode 100644
> index 0000000000000000..6103cf5a2d1624a9
> --- /dev/null
> +++ b/drivers/iio/adc/ti-ads1262.c




> +static int ads1262_write_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan, int val,
> + int val2, long mask)
> +{
> + struct ads1262 *st = iio_priv(indio_dev);
> + struct ads1262_channel *chan_data;
> + int i;
> +
> + chan_data = &st->channels[chan->scan_index];
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_SAMP_FREQ: {
> + i = ads1262_find_two(ads1262_data_rate_avail, val, val2);
> + if (i < 0)
> + return i;
> +
> + guard(mutex)(&st->chan_lock);
> + chan_data->data_rate = i;
> +
> + break;
Trivial but might as well return 0 here and save a reader going to look for
what else happens after the switch.

> + }
> +
> + case IIO_CHAN_INFO_HARDWAREGAIN: {
> + i = ads1262_find_one(ads1262_pga_gain_avail, val);
> + if (i < 0)
> + return i;
> +
> + guard(mutex)(&st->chan_lock);
> + chan_data->gain = i;
> +
> + break;
> + }
> +
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
> +}