Lines Matching refs:gain

100  * Available scales with gain 1x - 4096x, timings 55, 100, 200, 400 mS
101 * Time impacts to gain: 1x, 2x, 4x, 8x.
103 * => Max total gain is HWGAIN * gain by integration time (8 * 4096) = 32768
105 * Using NANO precision for scale we must use scale 64x corresponding gain 1x
122 /* Available gain settings */
142 * multiplying impact to the register values (similar to gain).
145 * the scale is doubled. Eg, time impact to total gain is x1, x2, x4, x8.
212 * Protect gain and time during scale adjustment and data reading.
307 * The data2 channel gain is composed by 5 non continuous bits
319 static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain)
331 dev_err(data->dev, "chan %u: unknown gain value 0x%x\n", chan,
337 *gain = ret;
357 int gain, ret;
359 ret = bu27034_get_gain(data, channel, &gain);
367 return iio_gts_get_scale(&data->gts, gain, ret, val, val2);
408 * We keep the same gain for channel 2 as we set for channel 0
416 * gain changed when chan 0 gain is changed.
426 * hope such user can also cope with the gain changes.
431 * The D2 gain bits are directly the lowest bits of selector.
440 static int bu27034_set_gain(struct bu27034_data *data, int chan, int gain)
445 * We don't allow setting channel 2 gain as it messes up the
446 * gain for channel 0 - which shares the high bits
451 ret = iio_gts_find_sel_by_gain(&data->gts, gain);
473 * given channels by adjusting gain so that it compensates the time change.
536 "optimal gain out of range for chan %u\n",
541 "Total gain increase. Risk of saturation");
549 dev_dbg(data->dev, "chan %u new gain %u\n",
596 struct bu27034_gain_check gain;
602 * gets the same gain as chan0, so we only need to explicitly
606 gain.chan = BU27034_CHAN_DATA1;
608 gain.chan = BU27034_CHAN_DATA0;
610 ret = bu27034_get_gain(data, gain.chan, &gain.old_gain);
634 &data->gts, gain.old_gain, time_sel,
635 new_time_sel, &gain.new_gain);
650 ret = bu27034_set_gain(data, gain.chan, gain.new_gain);
796 static inline u64 gain_mul_div_helper(u64 val, unsigned int gain,
800 * Max gain for a channel is 4096. The max u64 (0xffffffffffffffffULL)
803 * with the gain, no matter what gain is set.
805 * So, multiplication with max gain may overflow if val is greater than
811 val *= gain;
815 val *= gain;
870 unsigned int gain)
876 return helper / gain;
879 do_div(helper64, gain);
962 * any gain / integration time configuration registers) The bit gets
1380 * The maximum Milli lux value we get with gain 1x time