Re: [PATCH v2 4/4] iio: adc: ad7405: add ad7405 driver
From: Jonathan Cameron
Date: Sun May 11 2025 - 10:46:20 EST
> > +
> > +static const struct iio_info ad7405_iio_info = {
> > + .read_raw = &ad7405_read_raw,
> > + .write_raw = &ad7405_write_raw,
> > + .read_avail = &ad7405_read_avail,
> > +};
> > +
> > +#define AD7405_IIO_CHANNEL { \
> > + .type = IIO_VOLTAGE, \
> > + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
> > + .info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
>
> Would it make more sense to use IIO_CHAN_INFO_OVERSAMPLING_RATIO for controlling
> the decimation rate and have IIO_CHAN_INFO_SAMP_FREQ be read-only?
My initial reaction to this was that we'd be not providing one of the longest
standing and user friendly(ish) interfaces. However if it literally only affects
oversampling then indeed I think oversampling is the more informative interface.
Which is to say I started writing no then thought some more and ended up agreeing with
you ;)
As you say, a read only sampling frequency is fine. We use those when it's controlled
by some outside factor (like a clock frequency) so userspace should in theory at least
cope fine with that being RO.
> Maybe also useful to have a read-only filter_type attribute to say that the
> backend is providing a sinc3 filter?
Nice to have perhaps.
J