Lines Matching full:gain

183  * Available scales with gain 1x - 1024x, timings 55, 100, 200, 400 mS
184 * Time impacts to gain: 1x, 2x, 4x, 8x.
186 * => Max total gain is HWGAIN * gain by integration time (8 * 1024) = 8192
191 * total gain 8192 will be 1953125
196 * On BU27010 available scales with gain 1x - 4096x,
197 * timings 55, 100, 200, 400 mS. Time impacts to gain: 1x, 2x, 4x, 8x.
199 * => Max total gain is HWGAIN * gain by integration time (8 * 4096)
201 * Using NANO precision for scale we must use scale 64x corresponding gain 1x
206 /* See the data sheet for the "Gain Setting" table */
296 * All the RGBC channels share the same gain.
297 * IR gain can be fine-tuned from the gain set for the RGBC by 2 bit, but this
298 * would yield quite complex gain setting. Especially since not all bit
299 * compinations are supported. And in any case setting GAIN for RGBC will
300 * always also change the IR-gain.
302 * On top of this, the selector '0' which corresponds to hw-gain 1X on RGBC,
303 * corresponds to gain 2X on IR. Rest of the selctors correspond to same gains
304 * though. This, however, makes it not possible to use shared gain for all
334 * We don't allow setting scale for IR (because of shared gain bits).
391 * Prevent changing gain/time config when scale is read/written.
393 * Prevent changing gain/time when data is read.
474 * gain and integration time settings and we need to ensure those are
504 * We do always set also the LOW bits of IR-gain because othervice we in bu27008_write_gain_sel()
505 * would risk resulting an invalid GAIN register value. in bu27008_write_gain_sel()
508 * values were such that HW could support both gain settings. in bu27008_write_gain_sel()
509 * Eg, when the shared bits were same for both gain values. in bu27008_write_gain_sel()
514 * This would end up with nasty logic for computing gain values for in bu27008_write_gain_sel()
544 * Gain 'selector' is composed of two registers. Selector is 6bit value, in bu27010_write_gain_sel()
545 * 4 high bits being the RGBC gain fieild in MODE_CONTROL1 register and in bu27010_write_gain_sel()
546 * two low bits being the channel specific gain in MODE_CONTROL2. in bu27010_write_gain_sel()
549 * the MODE_CONTROL1 value (RGBC gain part). in bu27010_write_gain_sel()
578 * If we always "lock" the gain selectors for all channels to prevent in bu27008_get_gain_sel()
604 * We always "lock" the gain selectors for all channels to prevent in bu27010_get_gain_sel()
608 * Read the channel0 gain. in bu27010_get_gain_sel()
616 /* Read the shared gain */ in bu27010_get_gain_sel()
622 * The gain selector is made as a combination of common RGBC gain and in bu27010_get_gain_sel()
623 * the channel specific gain. The channel specific gain forms the low in bu27010_get_gain_sel()
624 * bits of selector and RGBC gain is appended right after it. in bu27010_get_gain_sel()
626 * Compose the selector from channel0 gain and shared RGBC gain. in bu27010_get_gain_sel()
777 static int bu27008_get_gain(struct bu27008_data *data, struct iio_gts *gts, int *gain) in bu27008_get_gain() argument
787 dev_err(data->dev, "unknown gain value 0x%x\n", sel); in bu27008_get_gain()
791 *gain = ret; in bu27008_get_gain()
796 static int bu27008_set_gain(struct bu27008_data *data, int gain) in bu27008_set_gain() argument
800 ret = iio_gts_find_sel_by_gain(&data->gts, gain); in bu27008_set_gain()
846 int gain, ret; in _bu27008_get_scale() local
853 ret = bu27008_get_gain(data, gts, &gain); in _bu27008_get_scale()
861 return iio_gts_get_scale(gts, gain, ret, val, val2); in _bu27008_get_scale()
937 dev_dbg(data->dev, "optimal gain out of range\n"); in bu27008_try_set_int_time()
941 "Total gain increase. Risk of saturation"); in bu27008_try_set_int_time()
947 dev_dbg(data->dev, "scale changed, new gain %u\n", new_gain); in bu27008_try_set_int_time()
1071 * Red = RedData*1024 / Gain * 20 / meas_mode
1072 * Green = GreenData* 1024 / Gain * 20 / meas_mode
1073 * Blue = BlueData* 1024 / Gain * 20 / meas_mode
1074 * IR = IrData* 1024 / Gain * 20 / meas_mode
1091 #define NORM_CHAN_DATA_FOR_LX_CALC(chan, gain, time) (le16_to_cpu(chan) * \ argument
1092 1024 * 20 / (gain) / (time))
1094 unsigned int gain, unsigned int gain_ir, unsigned int time) in bu27008_calc_nlux() argument
1101 red = NORM_CHAN_DATA_FOR_LX_CALC(lux_data[BU27008_LUX_DATA_RED], gain, time); in bu27008_calc_nlux()
1102 green = NORM_CHAN_DATA_FOR_LX_CALC(lux_data[BU27008_LUX_DATA_GREEN], gain, time); in bu27008_calc_nlux()
1103 blue = NORM_CHAN_DATA_FOR_LX_CALC(lux_data[BU27008_LUX_DATA_BLUE], gain, time); in bu27008_calc_nlux()
1120 unsigned int *gain, unsigned int *gain_ir, unsigned int *time) in bu27008_get_time_n_gains() argument
1124 ret = bu27008_get_gain(data, &data->gts, gain); in bu27008_get_time_n_gains()
1151 unsigned int gain, gain_ir, time; in bu27008_buffer_fill_lux() local
1154 ret = bu27008_get_time_n_gains(data, &gain, &gain_ir, &time); in bu27008_buffer_fill_lux()
1158 raw->lux = bu27008_calc_nlux(data, raw->chan, gain, gain_ir, time); in bu27008_buffer_fill_lux()
1168 unsigned int gain, gain_ir, time; in bu27008_read_lux() local
1172 ret = bu27008_get_time_n_gains(data, &gain, &gain_ir, &time); in bu27008_read_lux()
1180 nlux = bu27008_calc_nlux(data, lux_data, gain, gain_ir, time); in bu27008_read_lux()