diff options
author | Vignesh R <vigneshr@ti.com> | 2018-12-03 09:01:18 +0100 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2018-12-03 12:33:20 +0100 |
commit | 4b3ab9372ffa569827c8f7b7ffc7b69ba544a3bd (patch) | |
tree | 25e4d43f90834fc71dd5aadf768b4b654c001a16 /drivers/iio | |
parent | mfd: ti_am335x_tscadc: Use PLATFORM_DEVID_AUTO while registering mfd cells (diff) | |
download | linux-4b3ab9372ffa569827c8f7b7ffc7b69ba544a3bd.tar.xz linux-4b3ab9372ffa569827c8f7b7ffc7b69ba544a3bd.zip |
iio: adc: ti_am335x_tscadc: Improve accuracy of measurement
When performing single ended measurements with TSCADC, its recommended
to set negative input (SEL_INM_SWC_3_0) of ADC step to ADC's VREFN in the
corresponding STEP_CONFIGx register.
Also, the positive(SEL_RFP_SWC_2_0) and negative(SEL_RFM_SWC_1_0)
reference voltage for ADC step needs to be set to VREFP and VREFN
respectively in STEP_CONFIGx register.
Without these changes, there may be variation of as much as ~2% in the
ADC's digital output which is bad for precise measurement.
Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/adc/ti_am335x_adc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index cafb1dcadc48..9d984f2a8ba7 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -142,7 +142,10 @@ static void tiadc_step_config(struct iio_dev *indio_dev) stepconfig |= STEPCONFIG_MODE_SWCNT; tiadc_writel(adc_dev, REG_STEPCONFIG(steps), - stepconfig | STEPCONFIG_INP(chan)); + stepconfig | STEPCONFIG_INP(chan) | + STEPCONFIG_INM_ADCREFM | + STEPCONFIG_RFP_VREFP | + STEPCONFIG_RFM_VREFN); if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) { dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n", |