Lines Matching full:scale
2 /* gain-time-scale conversion helpers for IIO light sensors
22 * iio_gts_get_gain - Convert scale to total gain
24 * Internal helper for converting scale to total gain.
26 * @max: Maximum linearized scale. As an example, when scale is created
27 * in magnitude of NANOs and max scale is 64.1 - The linearized
28 * scale is 64 100 000 000.
29 * @scale: Linearized scale to compute the gain for.
31 * Return: (floored) gain corresponding to the scale. -EINVAL if scale
34 static int iio_gts_get_gain(const u64 max, const u64 scale) in iio_gts_get_gain() argument
38 if (scale > full || !scale) in iio_gts_get_gain()
41 return div64_u64(full, scale); in iio_gts_get_gain()
45 * gain_get_scale_fraction - get the gain or time based on scale and known one
47 * @max: Maximum linearized scale. As an example, when scale is created
48 * in magnitude of NANOs and max scale is 64.1 - The linearized
49 * scale is 64 100 000 000.
50 * @scale: Linearized scale to compute the gain/time for.
55 * Compute either gain or time based on scale and either the gain or time
60 static int gain_get_scale_fraction(const u64 max, u64 scale, int known, in gain_get_scale_fraction() argument
65 tot_gain = iio_gts_get_gain(max, scale); in gain_get_scale_fraction()
101 * Expect scale to be (mostly) NANO or MICRO. Divide divider instead of in iio_gts_linearize()
114 * iio_gts_total_gain_to_scale - convert gain to scale
115 * @gts: Gain time scale descriptor
117 * @scale_int: Pointer to integral part of the scale (typically val1)
118 * @scale_nano: Pointer to fractional part of the scale (nano or ppb)
120 * Convert the total gain value to scale. NOTE: This does not separate gain
140 * iio_gts_purge_avail_scale_table - free-up the available scale tables
141 * @gts: Gain time scale descriptor
261 * @gts: Gain time scale descriptor
342 * @gts: Gain time scale descriptor
408 * @gts: Gain time scale descriptor
423 * @gts: Gain time scale descriptor
463 * @gts: Gain time scale descriptor
466 * integration time and scale tables.
482 * @gts: Gain time scale descriptor
588 * devm_iio_init_iio_gts - Initialize the gain-time-scale helper
591 * @max_scale_int: integer part of the maximum scale value
592 * @max_scale_nano: fraction part of the maximum scale value
604 * Initialize the gain-time-scale helper for use. Note, gains, times, selectors
629 * @gts: Gain time scale descriptor
631 * @type: Type of returned scale values
652 * @gts: Gain time scale descriptor
655 * @type: Type of returned scale values
658 * Drivers which do not allow scale setting to change integration time can
686 * @gts: Gain time scale descriptor
688 * @type: Type of returned scale values
709 * @gts: Gain time scale descriptor
729 * @gts: Gain time scale descriptor
749 * @gts: Gain time scale descriptor
772 * @gts: Gain time scale descriptor
844 * iio_gts_find_gain_for_scale_using_time - Find gain by time and scale
845 * @gts: Gain time scale descriptor
848 * @scale_int: Integral part of the scale (typically val1)
849 * @scale_nano: Fractional part of the scale (nano or ppb)
853 * corresponds given scale and integration time. Sensors which fill the
888 * @gts: Gain time scale descriptor
891 * @scale_int: Integral part of the scale (typically val1)
892 * @scale_nano: Fractional part of the scale (nano or ppb)
919 * iio_gts_find_gain_time_sel_for_scale - Fetch gain and time selectors for scale
920 * @gts: Gain time scale descriptor
921 * @scale_int: Integral part of the scale (typically val1)
922 * @scale_nano: Fractional part of the scale (nano or ppb)
927 * gain and time selectors for a given scale.
955 * @gts: Gain time scale descriptor
980 u64 *scale) in iio_gts_get_scale_linear() argument
993 *scale = tmp; in iio_gts_get_scale_linear()
999 * iio_gts_get_scale - get scale based on integration time and HW-gain
1000 * @gts: Gain time scale descriptor
1001 * @gain: HW-gain for which the scale is computed
1002 * @time: Integration time for which the scale is computed
1003 * @scale_int: Integral part of the scale (typically val1)
1004 * @scale_nano: Fractional part of the scale (nano or ppb)
1006 * Compute scale matching the integration time and HW-gain given as parameter.
1026 * @gts: Gain time scale descriptor
1032 * We may want to mitigate the scale change caused by setting a new integration
1034 * new gain value to maintain the scale with new integration time.
1042 * gain required to maintain the scale would not be an integer. In this case,
1051 u64 scale; in iio_gts_find_new_gain_sel_by_old_gain_time() local
1065 &scale); in iio_gts_find_new_gain_sel_by_old_gain_time()
1069 ret = gain_get_scale_fraction(gts->max_scale, scale, itime_new->mul, in iio_gts_find_new_gain_sel_by_old_gain_time()
1083 * @gts: Gain time scale descriptor
1089 * We may want to mitigate the scale change caused by setting a new integration
1091 * new gain value to maintain the scale with new integration time.
1099 * gain required to maintain the scale would not be an integer. In this case,
1108 u64 scale; in iio_gts_find_new_gain_by_old_gain_time() local
1117 ret = iio_gts_get_scale_linear(gts, old_gain, old_time, &scale); in iio_gts_find_new_gain_by_old_gain_time()
1121 ret = gain_get_scale_fraction(gts->max_scale, scale, itime_new->mul, in iio_gts_find_new_gain_by_old_gain_time()
1135 * @gts: Gain time scale descriptor
1177 MODULE_DESCRIPTION("IIO light sensor gain-time-scale helpers");