• Matti Vaittinen's avatar
    iio: test: gts: test available times and gains sorting · 6de2f3a1
    Matti Vaittinen authored
    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: default avatarMatti Vaittinen <mazziesaccount@gmail.com>
    Link: https://lore.kernel.org/r/365cc6de3c17a457db738f5fdf8dd3bd6f50d5f2.1714480171.git.mazziesaccount@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    6de2f3a1
iio-test-gts.c 14.8 KB