]> git.hungrycats.org Git - linux/commit
iio: test: gts: test available times and gains sorting
authorMatti Vaittinen <mazziesaccount@gmail.com>
Tue, 30 Apr 2024 12:45:21 +0000 (15:45 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 27 May 2024 08:48:56 +0000 (09:48 +0100)
commit6de2f3a1f4bb6abb01c0922c753544ec7f349dd4
tree0aa555d2e7c00ea84c460b764518c865e8dd05cc
parent5acc3f971a01be48d5ff4252d8f9cdb87998cdfb
iio: test: gts: test available times and gains sorting

The iio_gts helpers build available times and scales tables based on the
times and gains arrays given from the driver. The driver should be able
to list all valid register values so that conversion from register valu
to correct gain/time works for all supported register values.

It might be more convenient for drivers to list these times and gains in
the order where they're listed in the data-sheet than ascending order.

However, for user who requests the supported scales / times it is more
convenient to get the results in asscending order. Also, listing
duplicated values is not meaning for the user.

Hence the GTS heler should do sorting and deduplication of the scales
and times when it builds the tables listing the available times/scales.
Note, currently duplicated gain values aren't handled by GTS-helpers.

Unsort the gain and time arrays in the test code, and add duplicates to
time array in order to test the sorting and deduplicating works.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/365cc6de3c17a457db738f5fdf8dd3bd6f50d5f2.1714480171.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/test/iio-test-gts.c