Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: gts-helper: export iio_gts_get_total_gain()

Export this function in preparation for the fix in veml6030.c, where the
total gain can be used to ease the calculation of the processed value of
the IIO_LIGHT channel compared to acquiring the scale in NANO.

Suggested-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/20250127-veml6030-scale-v3-1-4f32ba03df94@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Javier Carrasco and committed by
Jonathan Cameron
dbd2e08f ec08c395

+11 -1
+10 -1
drivers/iio/industrialio-gts-helper.c
··· 1026 1026 } 1027 1027 EXPORT_SYMBOL_NS_GPL(iio_gts_find_gain_time_sel_for_scale, "IIO_GTS_HELPER"); 1028 1028 1029 - static int iio_gts_get_total_gain(struct iio_gts *gts, int gain, int time) 1029 + /** 1030 + * iio_gts_get_total_gain - Fetch total gain for given HW-gain and time 1031 + * @gts: Gain time scale descriptor 1032 + * @gain: HW-gain for which the total gain is searched for 1033 + * @time: Integration time for which the total gain is searched for 1034 + * 1035 + * Return: total gain on success and -EINVAL on error. 1036 + */ 1037 + int iio_gts_get_total_gain(struct iio_gts *gts, int gain, int time) 1030 1038 { 1031 1039 const struct iio_itime_sel_mul *itime; 1032 1040 ··· 1050 1042 1051 1043 return gain * itime->mul; 1052 1044 } 1045 + EXPORT_SYMBOL_NS_GPL(iio_gts_get_total_gain, "IIO_GTS_HELPER"); 1053 1046 1054 1047 static int iio_gts_get_scale_linear(struct iio_gts *gts, int gain, int time, 1055 1048 u64 *scale)
+1
include/linux/iio/iio-gts-helper.h
··· 208 208 int *length); 209 209 int iio_gts_avail_scales_for_time(struct iio_gts *gts, int time, 210 210 const int **vals, int *type, int *length); 211 + int iio_gts_get_total_gain(struct iio_gts *gts, int gain, int time); 211 212 212 213 #endif