On Fri, 2022-12-02 at 12:16 +0100, Rasmus Villemoes wrote: > Hi, > > My customer wants to be able to change the configuration of the four > channels of the ad74412 at run-time; their board can be used in > various > scenarios, and having to specify the functions in device tree is too > inflexible. > > Is there any precedent in other iio drivers for such a configuration > change, and/or is it feasible to implement this in the ad74413r.c > driver? > > I do not need to be able to change it continuously, just once after > userspace has come up and before anything actually starts making use > of > the device, but it is not possible for me to know the correct > configuration in the bootloader, so having U-Boot patch the dtb is > not > an option. A somewhat hacky way would be to build the driver as a > module, and allow module parameter(s) to overrule whatever is in > devicetree, but that doesn't really work if there was more than one > ad74412/ad74413 present, unless one invents and parses some weird > syntax > to have certain settings apply to $this-chipselect on $that-bus. > > Rasmus Hi Rasmus, I did not looked too deep into this but from what you described it sounds like a nasty hack that I'm not sure if it's feasable... Would devicetree overlays be an option for you? Some userspace daemon could decide which one to load depending on the usecase? - Nuno Sá