aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ad7793.c2
-rw-r--r--drivers/iio/adc/vf610_adc.c22
-rw-r--r--drivers/iio/adc/xilinx-xadc-core.c1
3 files changed, 18 insertions, 7 deletions
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index eea0c79111e7..4d960d3b93c0 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -101,7 +101,7 @@
101#define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */ 101#define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */
102 102
103/* ID Register Bit Designations (AD7793_REG_ID) */ 103/* ID Register Bit Designations (AD7793_REG_ID) */
104#define AD7785_ID 0xB 104#define AD7785_ID 0x3
105#define AD7792_ID 0xA 105#define AD7792_ID 0xA
106#define AD7793_ID 0xB 106#define AD7793_ID 0xB
107#define AD7794_ID 0xF 107#define AD7794_ID 0xF
diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index 599cde3d03a1..b10f629cc44b 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -106,6 +106,13 @@
106 106
107#define DEFAULT_SAMPLE_TIME 1000 107#define DEFAULT_SAMPLE_TIME 1000
108 108
109/* V at 25°C of 696 mV */
110#define VF610_VTEMP25_3V0 950
111/* V at 25°C of 699 mV */
112#define VF610_VTEMP25_3V3 867
113/* Typical sensor slope coefficient at all temperatures */
114#define VF610_TEMP_SLOPE_COEFF 1840
115
109enum clk_sel { 116enum clk_sel {
110 VF610_ADCIOC_BUSCLK_SET, 117 VF610_ADCIOC_BUSCLK_SET,
111 VF610_ADCIOC_ALTCLK_SET, 118 VF610_ADCIOC_ALTCLK_SET,
@@ -197,6 +204,8 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
197 adc_feature->clk_div = 8; 204 adc_feature->clk_div = 8;
198 } 205 }
199 206
207 adck_rate = ipg_rate / adc_feature->clk_div;
208
200 /* 209 /*
201 * Determine the long sample time adder value to be used based 210 * Determine the long sample time adder value to be used based
202 * on the default minimum sample time provided. 211 * on the default minimum sample time provided.
@@ -221,7 +230,6 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
221 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode 230 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
222 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles 231 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles
223 */ 232 */
224 adck_rate = ipg_rate / info->adc_feature.clk_div;
225 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++) 233 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
226 info->sample_freq_avail[i] = 234 info->sample_freq_avail[i] =
227 adck_rate / (6 + vf610_hw_avgs[i] * 235 adck_rate / (6 + vf610_hw_avgs[i] *
@@ -663,11 +671,13 @@ static int vf610_read_raw(struct iio_dev *indio_dev,
663 break; 671 break;
664 case IIO_TEMP: 672 case IIO_TEMP:
665 /* 673 /*
666 * Calculate in degree Celsius times 1000 674 * Calculate in degree Celsius times 1000
667 * Using sensor slope of 1.84 mV/°C and 675 * Using the typical sensor slope of 1.84 mV/°C
668 * V at 25°C of 696 mV 676 * and VREFH_ADC at 3.3V, V at 25°C of 699 mV
669 */ 677 */
670 *val = 25000 - ((int)info->value - 864) * 1000000 / 1840; 678 *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) *
679 1000000 / VF610_TEMP_SLOPE_COEFF;
680
671 break; 681 break;
672 default: 682 default:
673 mutex_unlock(&indio_dev->mlock); 683 mutex_unlock(&indio_dev->mlock);
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 0370624a35db..02e636a1c49a 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -841,6 +841,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev,
841 case XADC_REG_VCCINT: 841 case XADC_REG_VCCINT:
842 case XADC_REG_VCCAUX: 842 case XADC_REG_VCCAUX:
843 case XADC_REG_VREFP: 843 case XADC_REG_VREFP:
844 case XADC_REG_VREFN:
844 case XADC_REG_VCCBRAM: 845 case XADC_REG_VCCBRAM:
845 case XADC_REG_VCCPINT: 846 case XADC_REG_VCCPINT:
846 case XADC_REG_VCCPAUX: 847 case XADC_REG_VCCPAUX: