]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: gts-helper: add helpers to ease searches of gain_sel and new_gain
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 30 Dec 2024 15:13:52 +0000 (16:13 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 4 Jan 2025 12:33:57 +0000 (12:33 +0000)
commit7716d085531bf797c882ed67eda184ac58a387a8
tree76c4ab5fcbda9c81c6ba6be777216084b132fd76
parent627f3c41ca005398cf1e86a312c5043147ec7ea6
iio: gts-helper: add helpers to ease searches of gain_sel and new_gain

This helper functions reduce the burden in the drivers that want to
fetch a gain and time selector for a given scale or a new optimal gain.

The former is currently achieved by calling
iio_gts_find_gain_sel_for_scale_using_time() for the current time
selector, and then iterating over the rest of time selectors if the
gain selector was not found.

The latter requires a combination of multiple iio-gts helpers to find
the new gain, look for an optimal gain if there was no exact match, and
set a minimum gain if the optimal gain is not in the range of available
gains.

Provide simpler workflows by means of functions that address common
patterns in the users of the iio-gts helpers.

Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241230-veml3235_scale-v3-1-48a5795e2f64@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-gts-helper.c
include/linux/iio/iio-gts-helper.h