Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+90 -41
+1 -1
drivers/iio/adc/ad7793.c
··· 101 101 #define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */ 102 102 103 103 /* ID Register Bit Designations (AD7793_REG_ID) */ 104 - #define AD7785_ID 0xB 104 + #define AD7785_ID 0x3 105 105 #define AD7792_ID 0xA 106 106 #define AD7793_ID 0xB 107 107 #define AD7794_ID 0xF
+16 -6
drivers/iio/adc/vf610_adc.c
··· 106 106 107 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 + 109 116 enum clk_sel { 110 117 VF610_ADCIOC_BUSCLK_SET, 111 118 VF610_ADCIOC_ALTCLK_SET, ··· 204 197 adc_feature->clk_div = 8; 205 198 } 206 199 200 + adck_rate = ipg_rate / adc_feature->clk_div; 201 + 207 202 /* 208 203 * Determine the long sample time adder value to be used based 209 204 * on the default minimum sample time provided. ··· 230 221 * BCT (Base Conversion Time): fixed to 25 ADCK cycles for 12 bit mode 231 222 * LSTAdder(Long Sample Time): 3, 5, 7, 9, 13, 17, 21, 25 ADCK cycles 232 223 */ 233 - adck_rate = ipg_rate / info->adc_feature.clk_div; 234 224 for (i = 0; i < ARRAY_SIZE(vf610_hw_avgs); i++) 235 225 info->sample_freq_avail[i] = 236 226 adck_rate / (6 + vf610_hw_avgs[i] * ··· 671 663 break; 672 664 case IIO_TEMP: 673 665 /* 674 - * Calculate in degree Celsius times 1000 675 - * Using sensor slope of 1.84 mV/°C and 676 - * V at 25°C of 696 mV 677 - */ 678 - *val = 25000 - ((int)info->value - 864) * 1000000 / 1840; 666 + * Calculate in degree Celsius times 1000 667 + * Using the typical sensor slope of 1.84 mV/°C 668 + * and VREFH_ADC at 3.3V, V at 25°C of 699 mV 669 + */ 670 + *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) * 671 + 1000000 / VF610_TEMP_SLOPE_COEFF; 672 + 679 673 break; 680 674 default: 681 675 mutex_unlock(&indio_dev->mlock);
+1
drivers/iio/adc/xilinx-xadc-core.c
··· 841 841 case XADC_REG_VCCINT: 842 842 case XADC_REG_VCCAUX: 843 843 case XADC_REG_VREFP: 844 + case XADC_REG_VREFN: 844 845 case XADC_REG_VCCBRAM: 845 846 case XADC_REG_VCCPINT: 846 847 case XADC_REG_VCCPAUX:
+64 -27
drivers/iio/dac/ad5064.c
··· 113 113 ID_AD5065, 114 114 ID_AD5628_1, 115 115 ID_AD5628_2, 116 + ID_AD5629_1, 117 + ID_AD5629_2, 116 118 ID_AD5648_1, 117 119 ID_AD5648_2, 118 120 ID_AD5666_1, 119 121 ID_AD5666_2, 120 122 ID_AD5668_1, 121 123 ID_AD5668_2, 124 + ID_AD5669_1, 125 + ID_AD5669_2, 122 126 }; 123 127 124 128 static int ad5064_write(struct ad5064_state *st, unsigned int cmd, ··· 295 291 { }, 296 292 }; 297 293 298 - #define AD5064_CHANNEL(chan, addr, bits) { \ 294 + #define AD5064_CHANNEL(chan, addr, bits, _shift) { \ 299 295 .type = IIO_VOLTAGE, \ 300 296 .indexed = 1, \ 301 297 .output = 1, \ ··· 307 303 .sign = 'u', \ 308 304 .realbits = (bits), \ 309 305 .storagebits = 16, \ 310 - .shift = 20 - bits, \ 306 + .shift = (_shift), \ 311 307 }, \ 312 308 .ext_info = ad5064_ext_info, \ 313 309 } 314 310 315 - #define DECLARE_AD5064_CHANNELS(name, bits) \ 311 + #define DECLARE_AD5064_CHANNELS(name, bits, shift) \ 316 312 const struct iio_chan_spec name[] = { \ 317 - AD5064_CHANNEL(0, 0, bits), \ 318 - AD5064_CHANNEL(1, 1, bits), \ 319 - AD5064_CHANNEL(2, 2, bits), \ 320 - AD5064_CHANNEL(3, 3, bits), \ 321 - AD5064_CHANNEL(4, 4, bits), \ 322 - AD5064_CHANNEL(5, 5, bits), \ 323 - AD5064_CHANNEL(6, 6, bits), \ 324 - AD5064_CHANNEL(7, 7, bits), \ 313 + AD5064_CHANNEL(0, 0, bits, shift), \ 314 + AD5064_CHANNEL(1, 1, bits, shift), \ 315 + AD5064_CHANNEL(2, 2, bits, shift), \ 316 + AD5064_CHANNEL(3, 3, bits, shift), \ 317 + AD5064_CHANNEL(4, 4, bits, shift), \ 318 + AD5064_CHANNEL(5, 5, bits, shift), \ 319 + AD5064_CHANNEL(6, 6, bits, shift), \ 320 + AD5064_CHANNEL(7, 7, bits, shift), \ 325 321 } 326 322 327 - #define DECLARE_AD5065_CHANNELS(name, bits) \ 323 + #define DECLARE_AD5065_CHANNELS(name, bits, shift) \ 328 324 const struct iio_chan_spec name[] = { \ 329 - AD5064_CHANNEL(0, 0, bits), \ 330 - AD5064_CHANNEL(1, 3, bits), \ 325 + AD5064_CHANNEL(0, 0, bits, shift), \ 326 + AD5064_CHANNEL(1, 3, bits, shift), \ 331 327 } 332 328 333 - static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); 334 - static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); 335 - static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); 329 + static DECLARE_AD5064_CHANNELS(ad5024_channels, 12, 8); 330 + static DECLARE_AD5064_CHANNELS(ad5044_channels, 14, 6); 331 + static DECLARE_AD5064_CHANNELS(ad5064_channels, 16, 4); 336 332 337 - static DECLARE_AD5065_CHANNELS(ad5025_channels, 12); 338 - static DECLARE_AD5065_CHANNELS(ad5045_channels, 14); 339 - static DECLARE_AD5065_CHANNELS(ad5065_channels, 16); 333 + static DECLARE_AD5065_CHANNELS(ad5025_channels, 12, 8); 334 + static DECLARE_AD5065_CHANNELS(ad5045_channels, 14, 6); 335 + static DECLARE_AD5065_CHANNELS(ad5065_channels, 16, 4); 336 + 337 + static DECLARE_AD5064_CHANNELS(ad5629_channels, 12, 4); 338 + static DECLARE_AD5064_CHANNELS(ad5669_channels, 16, 0); 340 339 341 340 static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { 342 341 [ID_AD5024] = { ··· 389 382 .channels = ad5024_channels, 390 383 .num_channels = 8, 391 384 }, 385 + [ID_AD5629_1] = { 386 + .shared_vref = true, 387 + .internal_vref = 2500000, 388 + .channels = ad5629_channels, 389 + .num_channels = 8, 390 + }, 391 + [ID_AD5629_2] = { 392 + .shared_vref = true, 393 + .internal_vref = 5000000, 394 + .channels = ad5629_channels, 395 + .num_channels = 8, 396 + }, 392 397 [ID_AD5648_1] = { 393 398 .shared_vref = true, 394 399 .internal_vref = 2500000, ··· 435 416 .shared_vref = true, 436 417 .internal_vref = 5000000, 437 418 .channels = ad5064_channels, 419 + .num_channels = 8, 420 + }, 421 + [ID_AD5669_1] = { 422 + .shared_vref = true, 423 + .internal_vref = 2500000, 424 + .channels = ad5669_channels, 425 + .num_channels = 8, 426 + }, 427 + [ID_AD5669_2] = { 428 + .shared_vref = true, 429 + .internal_vref = 5000000, 430 + .channels = ad5669_channels, 438 431 .num_channels = 8, 439 432 }, 440 433 }; ··· 628 597 unsigned int addr, unsigned int val) 629 598 { 630 599 struct i2c_client *i2c = to_i2c_client(st->dev); 600 + int ret; 631 601 632 602 st->data.i2c[0] = (cmd << 4) | addr; 633 603 put_unaligned_be16(val, &st->data.i2c[1]); 634 - return i2c_master_send(i2c, st->data.i2c, 3); 604 + 605 + ret = i2c_master_send(i2c, st->data.i2c, 3); 606 + if (ret < 0) 607 + return ret; 608 + 609 + return 0; 635 610 } 636 611 637 612 static int ad5064_i2c_probe(struct i2c_client *i2c, ··· 653 616 } 654 617 655 618 static const struct i2c_device_id ad5064_i2c_ids[] = { 656 - {"ad5629-1", ID_AD5628_1}, 657 - {"ad5629-2", ID_AD5628_2}, 658 - {"ad5629-3", ID_AD5628_2}, /* similar enough to ad5629-2 */ 659 - {"ad5669-1", ID_AD5668_1}, 660 - {"ad5669-2", ID_AD5668_2}, 661 - {"ad5669-3", ID_AD5668_2}, /* similar enough to ad5669-2 */ 619 + {"ad5629-1", ID_AD5629_1}, 620 + {"ad5629-2", ID_AD5629_2}, 621 + {"ad5629-3", ID_AD5629_2}, /* similar enough to ad5629-2 */ 622 + {"ad5669-1", ID_AD5669_1}, 623 + {"ad5669-2", ID_AD5669_2}, 624 + {"ad5669-3", ID_AD5669_2}, /* similar enough to ad5669-2 */ 662 625 {} 663 626 }; 664 627 MODULE_DEVICE_TABLE(i2c, ad5064_i2c_ids);
+4 -4
drivers/iio/humidity/si7020.c
··· 50 50 51 51 switch (mask) { 52 52 case IIO_CHAN_INFO_RAW: 53 - ret = i2c_smbus_read_word_data(*client, 54 - chan->type == IIO_TEMP ? 55 - SI7020CMD_TEMP_HOLD : 56 - SI7020CMD_RH_HOLD); 53 + ret = i2c_smbus_read_word_swapped(*client, 54 + chan->type == IIO_TEMP ? 55 + SI7020CMD_TEMP_HOLD : 56 + SI7020CMD_RH_HOLD); 57 57 if (ret < 0) 58 58 return ret; 59 59 *val = ret >> 2;
+2 -1
drivers/staging/iio/Kconfig
··· 18 18 source "drivers/staging/iio/trigger/Kconfig" 19 19 20 20 config IIO_DUMMY_EVGEN 21 - tristate 21 + tristate 22 + select IRQ_WORK 22 23 23 24 config IIO_SIMPLE_DUMMY 24 25 tristate "An example driver with no hardware requirements"
+2 -2
drivers/staging/iio/adc/lpc32xx_adc.c
··· 76 76 77 77 if (mask == IIO_CHAN_INFO_RAW) { 78 78 mutex_lock(&indio_dev->mlock); 79 - clk_enable(info->clk); 79 + clk_prepare_enable(info->clk); 80 80 /* Measurement setup */ 81 81 __raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, 82 82 LPC32XX_ADC_SELECT(info->adc_base)); ··· 84 84 __raw_writel(AD_PDN_CTRL | AD_STROBE, 85 85 LPC32XX_ADC_CTRL(info->adc_base)); 86 86 wait_for_completion(&info->completion); /* set by ISR */ 87 - clk_disable(info->clk); 87 + clk_disable_unprepare(info->clk); 88 88 *val = info->value; 89 89 mutex_unlock(&indio_dev->mlock); 90 90