Lines Matching full:gain
98 * Available scales with gain 1x - 1024x, timings 55, 100, 200, 400 mS
99 * Time impacts to gain: 1x, 2x, 4x, 8x.
101 * => Max total gain is HWGAIN * gain by integration time (8 * 1024) = 8192
102 * if 1x gain is scale 1, scale for 2x gain is 0.5, 4x => 0.25,
105 * Using NANO precision for scale, we must use scale 16x corresponding gain 1x
110 /* See the data sheet for the "Gain Setting" table */
118 /* Available gain settings */
130 * multiplying impact to the data register values (similar to gain).
133 * the scale is doubled. Eg, time impact to total gain is x1, x2, x4, x8.
199 * Protect gain and time during scale adjustment and data reading.
276 static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain) in bu27034_get_gain() argument
288 dev_err(data->dev, "chan %u: unknown gain value 0x%x\n", chan, in bu27034_get_gain()
294 *gain = ret; in bu27034_get_gain()
314 int gain, ret; in _bu27034_get_scale() local
316 ret = bu27034_get_gain(data, channel, &gain); in _bu27034_get_scale()
324 return iio_gts_get_scale(&data->gts, gain, ret, val, val2); in _bu27034_get_scale()
362 static int bu27034_set_gain(struct bu27034_data *data, int chan, int gain) in bu27034_set_gain() argument
366 ret = iio_gts_find_sel_by_gain(&data->gts, gain); in bu27034_set_gain()
388 * given channels by adjusting gain so that it compensates the time change.
447 "optimal gain out of range for chan %u\n", in bu27034_try_set_int_time()
452 "Total gain increase. Risk of saturation"); in bu27034_try_set_int_time()
460 dev_dbg(data->dev, "chan %u new gain %u\n", in bu27034_try_set_int_time()
499 struct bu27034_gain_check gain; in bu27034_set_scale() local
507 gain.chan = BU27034_CHAN_DATA1; in bu27034_set_scale()
509 gain.chan = BU27034_CHAN_DATA0; in bu27034_set_scale()
511 ret = bu27034_get_gain(data, gain.chan, &gain.old_gain); in bu27034_set_scale()
535 &data->gts, gain.old_gain, time_sel, in bu27034_set_scale()
536 new_time_sel, &gain.new_gain); in bu27034_set_scale()
549 ret = bu27034_set_gain(data, gain.chan, gain.new_gain); in bu27034_set_scale()
605 static inline u64 gain_mul_div_helper(u64 val, unsigned int gain, in gain_mul_div_helper() argument
609 * Max gain for a channel is 4096. The max u64 (0xffffffffffffffffULL) in gain_mul_div_helper()
612 * with the gain, no matter what gain is set. in gain_mul_div_helper()
614 * So, multiplication with max gain may overflow if val is greater than in gain_mul_div_helper()
620 val *= gain; in gain_mul_div_helper()
624 val *= gain; in gain_mul_div_helper()
679 unsigned int gain) in bu27034_fixp_calc_t23() argument
685 return helper / gain; in bu27034_fixp_calc_t23()
688 do_div(helper64, gain); in bu27034_fixp_calc_t23()
766 * any gain / integration time configuration registers) The bit gets
1191 * The maximum Milli lux value we get with gain 1x time in bu27034_buffer_thread()