On 7/9/22 19:10, Uwe Kleine-König wrote:
What we've done in the past in the IIO framework is to make the scale
property writable for such devices. Together with a scale_available property
to list valid options. This is the most flexible option as it allows to
change the setting at runtime for applications where it is required.
Which driver would you recommend me to study for that approach?
The closest to what you want is probably ti-ads1015. You need to
* implement the read_avail callback to get the possible values
* set info_mask_shared_by_all_available to BIT(IIO_CHAN_INFO_SCALE)
for the channels
* implement the write_raw callback and handle IIO_CHAN_INFO_SCALE to
update the setting
* handle IIO_CHAN_INFO_SCALE in the read_raw callback to report the
current scale