Re: [PATCH v2] meson saradc: add iio device attrib to switch channel 7 mux

From: Martin Blumenstingl
Date: Mon May 29 2023 - 16:04:35 EST


Hi George,

On Sun, May 28, 2023 at 11:52 PM George Stark <GNStark@xxxxxxxxxxxxxx> wrote:
[...]
> > Based on the limited description we have here, I'm not understanding why
> > you don't just express this as a set of channels. One channel per mux
> > setting, with the in_voltageX_label providing the information on what the
> > channel is connected to.
> >
> > This is an interesting facility, so good to enable for high precision calibration
> > but we still want to map it to standards signals. Userspace doesn't
> > care that these are all being measured via the same input 7 - which
> > is itself probably an input to a MUX.
> >
> > Jonathan
>
> Hello Jonathan
>
> Thanks for the review.
>
> Your idea of exposing the mux setting as iio channels is very
> interesting and at least worth trying.
> The sysfs approach was chosen because of the code changes are simple and
> neat (compare to channels approach).
> Also calibration by using those mux inputs are already supported in the
> driver (performed at probe stage) so I expect very special usecases for
> those mux settings like debug or device production stage tests. In those
> usescases hardware specific knowledge is required anyway.
Another downside to the debugfs approach is user support:
If someone reports odd values on ADC channel 7 then we need to make
sure to double check if the mux has been altered from userspace (the
calibration during initialization ensures to leave channel 7 in a
consistent state, while a user may change the mux, forget about it and
then complain that values are wrong).


Best regards,
Martin