I'm trying to change AGC parameters such as "adi,agc-outer-thresh-high", "adi,agc-outer-thresh-low", etc from a C userspace program. I've successfully changed them by modifying the devicetree, but I'd like to change them on the fly.
In /sys/kernel/debug/iio/device/*, all of the parameters are there, but doing an echo of a value to these parameters does not seem to change the underlying RFIC register (as checked with reading direct_reg_access). Similarly, doing a "write_sysfs_int" from iio_utils.h does not change the registers. The code below has no effect (note that ad9361-phy is iio:device0 in my setup):
write_sysfs_int("adi,mgc-rx1-ctrl-inp-enable", "/sys/kernel/debug/iio/iio:device0", 0);
write_sysfs_int("adi,agc-outer-thresh-high", "/sys/kernel/debug/iio/iio:device0", 5);
write_sysfs_int("adi,agc-outer-thresh-high-dec-steps", "/sys/kernel/debug/iio/iio:device0", 2);
I know it's possible to do this since it's done in the iio-oscilloscope advanced mode. I tried to study the iio-oscilloscope source but couldn't find what else I need to be doing.
Please advise on how it would be possible to change these. I of course could get out the register map and bit-bang the correct bits, but I've been spoiled by the IIO drivers . I would prefer to not have to use libiio.