On Mon, 3 Oct 2022 13:59:01 +0300 Ibrahim Tilki <Ibrahim.Tilki@xxxxxxxxxx> wrote: > Adding support for max11410 24-bit, 1.9ksps delta-sigma adc which > has 3 differential reference and 10 differential channel inputs. > Inputs and references can be buffered internally. Inputs can also > be amplified with internal PGA. > > Device has four digital filter modes: FIR50/60, FIR50, FIR60 and SINC4. > FIR 50Hz and 60Hz rejections can be enabled/disabled separately. > Digital filter selection affects sampling frequency range so driver > has to consider the configured filter when configuring sampling frequency. > > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@xxxxxxxxxx> One small thing inline that I tidied up whilst applying. > +static int max11410_configure_channel(struct max11410_state *st, > + struct iio_chan_spec const *chan) > +{ > + struct max11410_channel_config cfg = st->channels[chan->address]; > + unsigned int regval; > + int ret; > + > + if (chan->differential) > + ret = max11410_set_input_mux(st, chan->channel, chan->channel2); > + else > + ret = max11410_set_input_mux(st, chan->channel, > + MAX11410_AINN_GND); > + > + if (ret) > + return ret; > + > + regval = FIELD_PREP(MAX11410_CTRL_VREFP_BUF_BIT, cfg.buffered_vrefp) | > + FIELD_PREP(MAX11410_CTRL_VREFN_BUF_BIT, cfg.buffered_vrefn) | > + FIELD_PREP(MAX11410_CTRL_REFSEL_MASK, cfg.refsel) | > + FIELD_PREP(MAX11410_CTRL_UNIPOLAR_BIT, !cfg.bipolar); drivers/iio/adc/max11410.c:370:18: warning: dubious: x & !y I've fixed it with ... cfg.bipolar ? 0 : 1); Shout if that's an issue (I've gotten these backwards in the past ;)