Merge tag 'iio-fixes-for-4.4a' of ssh://ra.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes: First set of IIO fixes for the 4.4 cycle. This set does not include those for issues introduced during the merge window. Fixes of those will follow in a future series. * ad5064 - Make sure the local i2c_write returns 0 on success rather than the number of bytes transfered. Otherwise we report an error on all writes. - Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on these parts. * ad7793 - The product ID on the datasheet is wrong. Fix it in the driver. * IIO_DUMMY_EVGEN - select IRQ_WORK as a dependency. * lpc32xx - make sure clock is prepared before enabling. * si7020 - data byte order was reversed. Fix it. * vf610 - Internal temperature calculation was wrong if a different reference voltage was used. Now use a linear interpolation function to make it work over the full range. - Fix a division by zero in the case of a device tree property not being present (same issue two fixes). * xilinx XADC - VREFN scale was wrong - fix it.
This commit is contained in:
@@ -106,6 +106,13 @@
|
||||
|
||||
#define DEFAULT_SAMPLE_TIME 1000
|
||||
|
||||
/* V at 25°C of 696 mV */
|
||||
#define VF610_VTEMP25_3V0 950
|
||||
/* V at 25°C of 699 mV */
|
||||
#define VF610_VTEMP25_3V3 867
|
||||
/* Typical sensor slope coefficient at all temperatures */
|
||||
#define VF610_TEMP_SLOPE_COEFF 1840
|
||||
|
||||
enum clk_sel {
|
||||
VF610_ADCIOC_BUSCLK_SET,
|
||||
VF610_ADCIOC_ALTCLK_SET,
|
||||
@@ -197,6 +204,8 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
|
||||
adc_feature->clk_div = 8;
|
||||
}
|
||||
|
||||
adck_rate = ipg_rate / adc_feature->clk_div;
|
||||
|
||||
/*
|
||||
* Determine the long sample time adder value to be used based
|
||||
* on the default minimum sample time provided.
|
||||
@@ -221,7 +230,6 @@ static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
|
||||
* BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode
|
||||
* LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles
|
||||
*/
|
||||
adck_rate = ipg_rate / info->adc_feature.clk_div;
|
||||
for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++)
|
||||
info->sample_freq_avail[i] =
|
||||
adck_rate / (6 + vf610_hw_avgs[i] *
|
||||
@@ -663,11 +671,13 @@ static int vf610_read_raw(struct iio_dev *indio_dev,
|
||||
break;
|
||||
case IIO_TEMP:
|
||||
/*
|
||||
* Calculate in degree Celsius times 1000
|
||||
* Using sensor slope of 1.84 mV/°C and
|
||||
* V at 25°C of 696 mV
|
||||
*/
|
||||
*val = 25000 - ((int)info->value - 864) * 1000000 / 1840;
|
||||
* Calculate in degree Celsius times 1000
|
||||
* Using the typical sensor slope of 1.84 mV/°C
|
||||
* and VREFH_ADC at 3.3V, V at 25°C of 699 mV
|
||||
*/
|
||||
*val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) *
|
||||
1000000 / VF610_TEMP_SLOPE_COEFF;
|
||||
|
||||
break;
|
||||
default:
|
||||
mutex_unlock(&indio_dev->mlock);
|
||||
|
Reference in New Issue
Block a user