summaryrefslogtreecommitdiffstats
path: root/tools/lib/python
diff options
context:
space:
mode:
authorDavid Lechner <dlechner@baylibre.com>2025-09-23 16:48:04 -0500
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-10-19 11:59:16 +0100
commit9065197e0d41b0beb4bf15b72b91fa81b14455ad (patch)
tree18b8e4935ccff81aafc5f3dbe4c9d95c6e2c9e71 /tools/lib/python
parent0649002e842000872c69caceff0d20da48b2cc44 (diff)
downloadlinux-9065197e0d41b0beb4bf15b72b91fa81b14455ad.tar.gz
linux-9065197e0d41b0beb4bf15b72b91fa81b14455ad.zip
iio: adc: ad7124: change setup reg allocation strategy
Change the allocation strategy of the 8 SETUP registers from a least- recently-used (LRU) to a first-come-first-served basis. The AD7124 chips can have up to 16 channels enabled at a time in the sequencer for buffered reads, but only have 8 SETUP configurations (namely the OFFSET, GAIN, CONFIG and FILTER registers) that must be shared among the 16 channels. This means some of the channels must use the exact same configuration parameters so that they can share a single SETUP group of registers. The previous LRU strategy did not keep track of how many different configurations were requested at the same time, so if there were more than 8 different configurations requested, some channels would end up using the incorrect configuration because the slot assigned to them would also be assigned to a different configuration that wrote over it later. Adding such tracking to solve this would make an already complex algorithm even more complex. Instead we can replace it with a simpler first-come-first-serve strategy. This makes it easy to track how many different configurations are being requested at the same time. This comes at the expense of slightly longer setup times for buffered reads since all setup registers must be written each time when a buffered read is enabled. But this is generally not considered a hot path where performance is critical, so should be acceptable. This new strategy also makes hardware debugging easier since SETUPs are now assigned in a deterministic manner and in a logical order. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions