Commit 5f5454af authored by Federico Vaga's avatar Federico Vaga

WIP drv: bugfix on open-drain configuration, voltage range is 1V

We have always been useing an uncalibrated DAC value whenever
we were using 'test data' or the input configuration was in open-drain.

We recently discovered that this is not true, and actually the voltage
range on the input channel is 1V.

For this reason the DAC value still needs to be fixed with eeprom calibration
data.
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
Acked-by: 's avatarDimitris Lampridis <Dimitris.Lampridis@cern.ch>
parent 0c8bfab7
......@@ -119,13 +119,12 @@ int zfad_apply_user_offset(struct fa_dev *fa, struct zio_channel *chan,
return range;
if (range == FA100M14B4C_RANGE_OPEN || fa_enable_test_data_adc) {
offset = FA_CAL_NO_OFFSET;
gain = FA_CAL_NO_GAIN;
} else {
offset = fa->calib.dac[range].offset[chan->index];
gain = fa->calib.dac[range].gain[chan->index];
range = FA100M14B4C_RANGE_1V;
}
offset = fa->calib.dac[range].offset[chan->index];
gain = fa->calib.dac[range].gain[chan->index];
hwval = uval * 0x8000 / 5000;
if (hwval == 0x8000)
hwval = 0x7fff; /* -32768 .. 32767 */
......
......@@ -218,7 +218,7 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
case ZFA_CHx_OFFSET:
chan = to_zio_chan(dev),
err = zfad_apply_user_offset(fa, chan, usr_val);
err = zfad_apply_user_offset(fa, chan, usr_val);
if (err)
return err;
fa->user_offset[chan->index] = usr_val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment