Lines Matching full:gain
97 * Available scales with gain 1x - 1024x, timings 55, 100, 200, 400 mS
98 * Time impacts to gain: 1x, 2x, 4x, 8x.
100 * => Max total gain is HWGAIN * gain by integration time (8 * 1024) = 8192
101 * if 1x gain is scale 1, scale for 2x gain is 0.5, 4x => 0.25,
104 * Using NANO precision for scale, we must use scale 16x corresponding gain 1x
109 /* See the data sheet for the "Gain Setting" table */
117 /* Available gain settings */
129 * multiplying impact to the data register values (similar to gain).
132 * the scale is doubled. Eg, time impact to total gain is x1, x2, x4, x8.
198 * Protect gain and time during scale adjustment and data reading.
275 static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain) in bu27034_get_gain() argument
287 dev_err(data->dev, "chan %u: unknown gain value 0x%x\n", chan, in bu27034_get_gain()
293 *gain = ret; in bu27034_get_gain()
313 int gain, ret; in _bu27034_get_scale() local
315 ret = bu27034_get_gain(data, channel, &gain); in _bu27034_get_scale()
323 return iio_gts_get_scale(&data->gts, gain, ret, val, val2); in _bu27034_get_scale()
361 static int bu27034_set_gain(struct bu27034_data *data, int chan, int gain) in bu27034_set_gain() argument
365 ret = iio_gts_find_sel_by_gain(&data->gts, gain); in bu27034_set_gain()
387 * given channels by adjusting gain so that it compensates the time change.
450 "optimal gain out of range for chan %u\n", in bu27034_try_set_int_time()
455 "Total gain increase. Risk of saturation"); in bu27034_try_set_int_time()
463 dev_dbg(data->dev, "chan %u new gain %u\n", in bu27034_try_set_int_time()
507 struct bu27034_gain_check gain; in bu27034_set_scale() local
515 gain.chan = BU27034_CHAN_DATA1; in bu27034_set_scale()
517 gain.chan = BU27034_CHAN_DATA0; in bu27034_set_scale()
519 ret = bu27034_get_gain(data, gain.chan, &gain.old_gain); in bu27034_set_scale()
543 &data->gts, gain.old_gain, time_sel, in bu27034_set_scale()
544 new_time_sel, &gain.new_gain); in bu27034_set_scale()
559 ret = bu27034_set_gain(data, gain.chan, gain.new_gain); in bu27034_set_scale()
619 static inline u64 gain_mul_div_helper(u64 val, unsigned int gain, in gain_mul_div_helper() argument
623 * Max gain for a channel is 4096. The max u64 (0xffffffffffffffffULL) in gain_mul_div_helper()
626 * with the gain, no matter what gain is set. in gain_mul_div_helper()
628 * So, multiplication with max gain may overflow if val is greater than in gain_mul_div_helper()
634 val *= gain; in gain_mul_div_helper()
638 val *= gain; in gain_mul_div_helper()
693 unsigned int gain) in bu27034_fixp_calc_t23() argument
699 return helper / gain; in bu27034_fixp_calc_t23()
702 do_div(helper64, gain); in bu27034_fixp_calc_t23()
780 * any gain / integration time configuration registers) The bit gets
1205 * The maximum Milli lux value we get with gain 1x time in bu27034_buffer_thread()