Re: [PATCH v3 3/9] iio: adc: ti-ads1262: support per-channel sampling frequency

From: Jonathan Cameron

Date: Sun Aug 16 2026 - 17:34:59 EST


On Fri, 07 Aug 2026 22:58:25 -0500
Kurt Borja <kuurtb@xxxxxxxxx> wrote:

> Add per-channel sampling frequency support. The "available" attribute is
> assigned per-channel too, in order to eventually support per-filter
> availability.
>
> Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>
Trivial things only.

> ---
> drivers/iio/adc/ti-ads1262.c | 159 ++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 158 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads1262.c b/drivers/iio/adc/ti-ads1262.c
> index d78e5e3ae13e..b3b7b1249102 100644
> --- a/drivers/iio/adc/ti-ads1262.c
> +++ b/drivers/iio/adc/ti-ads1262.c
> @@ -26,6 +26,7 @@
> #include <linux/regulator/consumer.h>
> #include <linux/spi/spi.h>
> #include <linux/types.h>
> +#include <linux/units.h>
>
> #include <asm/byteorder.h>
>
> @@ -148,6 +149,7 @@ enum {
> ADS1262_DR_14400_SPS,
> ADS1262_DR_19200_SPS,
> ADS1262_DR_38400_SPS,
> + ADS1262_DR_COUNT,

For count / terminating entries, no trailing comma as nothing should ever
come after them.

> };
>
> static int ads1262_channel_enable(struct ads1262 *st,
> const struct iio_chan_spec *spec)
> {
> + struct ads1262_channel *chan = &st->channels[spec->scan_index];
> + int ret;
> u8 val;
>
> guard(mutex)(&st->xfer_lock);
> guard(mutex)(&st->chan_lock);
>
> + val = FIELD_PREP(ADS1262_MODE2_DR_MASK, chan->data_rate);
> + ret = regmap_update_bits(st->regmap, ADS1262_MODE2_REG,
> + ADS1262_MODE2_DR_MASK, val);
Not seeing an advantage here over
ret = regmap_update_bits(st->regmap, ADS1262_MODE2_REG,
ADS1262_MODE2_DR_MASK,
FIELD_PREP(ADS1262_MODE2_DR_MASK, chan->data_rate));

It is fine to go a little over 80 chars when it helps readability. Here I think
that is the case as clear we have matching masks.

> + if (ret)
> + return ret;
> +
> val = FIELD_PREP(ADS1262_INPMUX_MUXN_MASK, spec->channel2) |
> FIELD_PREP(ADS1262_INPMUX_MUXP_MASK, spec->channel);
> return regmap_update_bits(st->regmap, ADS1262_INPMUX_REG,