Re: [PATCH v3 0/9] iio: adc: Add TI ADS126X ADC family support
From: David Lechner
Date: Sat Aug 08 2026 - 14:38:12 EST
On 8/7/26 10:58 PM, Kurt Borja wrote:
...
> - @David: I added support for the monitor channels, but I prefer to
> parse them from DT instead of making them static (similar to the
> ad4170-4 approach too :p).
Why? Unless there really is some property that depends on how the
system is wired up, it seems like this is just making unnecessary
work for users to be able to use the monitor channels. And if someone
decided later that they do in fact want to use the monitoring channel
and it wasn't in the devicetree, sometimes it can be very difficult
to actually change the devicetree.
The monitor inputs also have many restrictions compared to a
normal input that it would be really hard to describe correctly
in the bindings without allowing things that should not actually
be allowed. (can't have excitation current or burnout, temperature
channel requires internal reference, most should be single-channel,
etc.)
>
> - @David: About filters... As I mentioned in the previous version, the
> data_rate configuration takes precedence over the filter selection.
> If an incompatible filter (given a data rate) is selected, the chip
> resorts to a sane compatible one when doing conversions (either
> SINC1 or plain SINC5).
>
> Now, I don't know how to expose this in userspace. Should I limit
> the sampling_frequency_available attribute (given a filter)? Or
> should it be the other way around, limit the filter_type_available
> attribute (given a data rate)?.
I figured that the filter type selection would be more important than
the rate so when I implemented it for ADS112C14, I made it so that
one has to pick the filter first and everything else flows from that.
(I didn't expose sampling frequency until the same time as filter type.)
The thinking behind this is that if you do care about filtering, then
you are picking filter type and sampling rate to get certain notches
and/or frequency response of the filter rather than trying to get a
faster or slower sample rate.
And the driver also allows using an hrtimer trigger to do single-shot
samples for cases where one doesn't want to sample as fast as possible
in continuous mode. This would be more useful to someone who just cares
about sample rate and not about filtering.
Just posted the series yesterday:
https://lore.kernel.org/linux-iio/20260807-iio-adc-ti-ads112c14-filter-support-v1-0-4d3ba00caf18@xxxxxxxxxxxx/T/#t
ADS126X seems a little less complicated in this regard though
as the same sampling rates are available for all filters with
the exception of the FIR filter having a limited subset. So I
would go with the option to limit sampling rate based on filter
type, not the other way around. If a higher rate is selected
when changing to the FIR filter type, just have it go to the
max (20 SPS).