Lines Matching refs:time

2 /* gain-time-scale conversion helpers for IIO light sensors
45 * gain_get_scale_fraction - get the gain or time based on scale and known one
50 * @scale: Linearized scale to compute the gain/time for.
51 * @known: Either integration time or gain depending on which one is known
52 * @unknown: Pointer to variable where the computed gain/time is stored
55 * Compute either gain or time based on scale and either the gain or time
115 * @gts: Gain time scale descriptor
121 * generated by HW-gain or integration time. It is up to caller to decide what
122 * part of the total gain is due to integration time and what due to HW-gain.
141 * @gts: Gain time scale descriptor
198 * We assume all the gains for same integration time were unique.
199 * It is likely the first time table had greatest time multiplier as
261 * @gts: Gain time scale descriptor
264 * originally given gain and time tables. When both time and gain tables are
267 * integration time.
340 * @gts: Gain time scale descriptor
385 * the given time table were not unique. Else we could just
402 * iio_gts_purge_avail_time_table - free-up the available integration time table
403 * @gts: Gain time scale descriptor
418 * @gts: Gain time scale descriptor
422 * given gain and given time tables.
424 * When both time and gain tables are
427 * integration time.
458 * @gts: Gain time scale descriptor
461 * integration time and scale tables.
477 * @gts: Gain time scale descriptor
481 * given gain and given time tables.
483 * When both time and gain tables are given this results:
485 * integration time.
583 * devm_iio_init_iio_gts - Initialize the gain-time-scale helper
591 * the integration time table sorted so that the preferred
592 * integration time is in the first array index. The search
595 * from first provided time.
596 * @num_times: number of times in the time table
599 * Initialize the gain-time-scale helper for use. Note, gains, times, selectors
601 * checking. The total gain (maximum gain * maximum time multiplier) must not
624 * @gts: Gain time scale descriptor
646 * iio_gts_avail_scales_for_time - list scales for integration time
647 * @gts: Gain time scale descriptor
648 * @time: Integration time for which the scales are listed
653 * Drivers which do not allow scale setting to change integration time can
655 * time.
659 int iio_gts_avail_scales_for_time(struct iio_gts *gts, int time,
665 if (gts->itime_table[i].time_us == time)
681 * @gts: Gain time scale descriptor
704 * @gts: Gain time scale descriptor
724 * @gts: Gain time scale descriptor
744 * @gts: Gain time scale descriptor
767 * @gts: Gain time scale descriptor
829 const struct iio_itime_sel_mul *time;
831 time = iio_gts_find_itime_by_sel(gts, sel);
832 if (!time)
835 return time->mul;
839 * iio_gts_find_gain_for_scale_using_time - Find gain by time and scale
840 * @gts: Gain time scale descriptor
841 * @time_sel: Integration time selector corresponding to the time gain is
848 * corresponds given scale and integration time. Sensors which fill the
849 * gain and time tables may use this helper to retrieve the gain.
883 * @gts: Gain time scale descriptor
884 * @time_sel: Integration time selector corresponding to the time gain is
913 static int iio_gts_get_total_gain(struct iio_gts *gts, int gain, int time)
923 itime = iio_gts_find_itime_by_time(gts, time);
930 static int iio_gts_get_scale_linear(struct iio_gts *gts, int gain, int time,
936 total_gain = iio_gts_get_total_gain(gts, gain, time);
950 * iio_gts_get_scale - get scale based on integration time and HW-gain
951 * @gts: Gain time scale descriptor
953 * @time: Integration time for which the scale is computed
957 * Compute scale matching the integration time and HW-gain given as parameter.
961 int iio_gts_get_scale(struct iio_gts *gts, int gain, int time, int *scale_int,
967 ret = iio_gts_get_scale_linear(gts, gain, time, &lin_scale);
976 * iio_gts_find_new_gain_sel_by_old_gain_time - compensate for time change
977 * @gts: Gain time scale descriptor
979 * @old_time_sel: Selector corresponding previously set time
980 * @new_time_sel: Selector corresponding new time to be set
984 * time (for a light sensor) by also updating the (HW)gain. This helper computes
985 * new gain value to maintain the scale with new integration time.
1033 * iio_gts_find_new_gain_by_old_gain_time - compensate for time change
1034 * @gts: Gain time scale descriptor
1036 * @old_time: Selector corresponding previously set time
1037 * @new_time: Selector corresponding new time to be set
1041 * time (for a light sensor) by also updating the (HW)gain. This helper computes
1042 * new gain value to maintain the scale with new integration time.
1086 MODULE_DESCRIPTION("IIO light sensor gain-time-scale helpers");