Merge tag 'iio-fixes-for-6.6a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

1st set of IIO fixes for 6.6

Note last minute rebase to fix up a stale Fixes tag. All patches have been
in Linux-next for some time.

adi,ad3552r
- Fix swapped device IDs for the two parts that are supported.
adi,ad7192
- Use the right reference voltage source.
adi,ad7292
- Fix additionalProperties to be false, not true.
adi,ad74413
- Add missing Kconfig depends on IIO_BUFFER and IIO_TRIGGERED_BUFFER
adi,admv1013
- Fix up some corner cases for the mixer vgate register value.
bosch,bmp280
- Fix a null pointer dereference caused by a wrong boolean operator.
bosch,bno055
- Add missing Kconfig depends on IIO_BUFFER and IIO_TRIGGERED_BUFFER
freescale,imx8eqxp
- Fix some wrong register addresses.
google,cros_ec
- Fix a use after free if very badly timed buffer disable occurs by
holding the device in buffered mode.
infineon,dps310
- Expand a timeout so we don't hit it on working parts.
meas,m5611
- Allow for a ROM CRC of 0 as it is a valid value and there are devices
out there where it happens.
murata,irsd200
- Make sure the buffer used to build up the scan is large enough to take
the timestamp.
rohm,bu27010 binding
- Add a missing required vdd-supply
vishay,vcnl4000
- Don't power down chip in wrong place.

* tag 'iio-fixes-for-6.6a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
dt-bindings: iio: adc: adi,ad7292: Fix additionalProperties on channel nodes
iio: adc: ad7192: Correct reference voltage
iio: light: vcnl4000: Don't power on/off chip in config
iio: addac: Kconfig: update ad74413r selections
iio: pressure: dps310: Adjust Timeout Settings
iio: imu: bno055: Fix missing Kconfig dependencies
iio: adc: imx8qxp: Fix address for command buffer registers
iio: cros_ec: fix an use-after-free in cros_ec_sensors_push_data()
iio: irsd200: fix -Warray-bounds bug in irsd200_trigger_handler
dt-bindings: iio: rohm,bu27010: add missing vdd-supply to example
iio: admv1013: add mixer_vgate corner cases
iio: pressure: bmp280: Fix NULL pointer exception
iio: dac: ad3552r: Correct device IDs

Changed files
+51 -22
Documentation
devicetree
bindings
drivers
iio
adc
addac
common
cros_ec_sensors
dac
frequency
imu
bno055
light
pressure
proximity
+1 -1
Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
··· 61 61 required: 62 62 - reg 63 63 64 - additionalProperties: true 64 + additionalProperties: false 65 65 66 66 allOf: 67 67 - $ref: /schemas/spi/spi-peripheral-props.yaml#
+1
Documentation/devicetree/bindings/iio/light/rohm,bu27010.yaml
··· 45 45 light-sensor@38 { 46 46 compatible = "rohm,bu27010"; 47 47 reg = <0x38>; 48 + vdd-supply = <&vdd>; 48 49 }; 49 50 };
+25 -4
drivers/iio/adc/ad7192.c
··· 177 177 struct ad7192_state { 178 178 const struct ad7192_chip_info *chip_info; 179 179 struct regulator *avdd; 180 + struct regulator *vref; 180 181 struct clk *mclk; 181 182 u16 int_vref_mv; 182 183 u32 fclk; ··· 1009 1008 if (ret) 1010 1009 return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n"); 1011 1010 1012 - ret = regulator_get_voltage(st->avdd); 1013 - if (ret < 0) { 1014 - dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); 1015 - return ret; 1011 + st->vref = devm_regulator_get_optional(&spi->dev, "vref"); 1012 + if (IS_ERR(st->vref)) { 1013 + if (PTR_ERR(st->vref) != -ENODEV) 1014 + return PTR_ERR(st->vref); 1015 + 1016 + ret = regulator_get_voltage(st->avdd); 1017 + if (ret < 0) 1018 + return dev_err_probe(&spi->dev, ret, 1019 + "Device tree error, AVdd voltage undefined\n"); 1020 + } else { 1021 + ret = regulator_enable(st->vref); 1022 + if (ret) { 1023 + dev_err(&spi->dev, "Failed to enable specified Vref supply\n"); 1024 + return ret; 1025 + } 1026 + 1027 + ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref); 1028 + if (ret) 1029 + return ret; 1030 + 1031 + ret = regulator_get_voltage(st->vref); 1032 + if (ret < 0) 1033 + return dev_err_probe(&spi->dev, ret, 1034 + "Device tree error, Vref voltage undefined\n"); 1016 1035 } 1017 1036 st->int_vref_mv = ret / 1000; 1018 1037
+2 -2
drivers/iio/adc/imx8qxp-adc.c
··· 38 38 #define IMX8QXP_ADR_ADC_FCTRL 0x30 39 39 #define IMX8QXP_ADR_ADC_SWTRIG 0x34 40 40 #define IMX8QXP_ADR_ADC_TCTRL(tid) (0xc0 + (tid) * 4) 41 - #define IMX8QXP_ADR_ADC_CMDH(cid) (0x100 + (cid) * 8) 42 - #define IMX8QXP_ADR_ADC_CMDL(cid) (0x104 + (cid) * 8) 41 + #define IMX8QXP_ADR_ADC_CMDL(cid) (0x100 + (cid) * 8) 42 + #define IMX8QXP_ADR_ADC_CMDH(cid) (0x104 + (cid) * 8) 43 43 #define IMX8QXP_ADR_ADC_RESFIFO 0x300 44 44 #define IMX8QXP_ADR_ADC_TST 0xffc 45 45
+2
drivers/iio/addac/Kconfig
··· 24 24 depends on GPIOLIB && SPI 25 25 select REGMAP_SPI 26 26 select CRC8 27 + select IIO_BUFFER 28 + select IIO_TRIGGERED_BUFFER 27 29 help 28 30 Say yes here to build support for Analog Devices AD74412R/AD74413R 29 31 quad-channel software configurable input/output solution.
+5 -1
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
··· 190 190 /* 191 191 * Ignore samples if the buffer is not set: it is needed if the ODR is 192 192 * set but the buffer is not enabled yet. 193 + * 194 + * Note: iio_device_claim_buffer_mode() returns -EBUSY if the buffer 195 + * is not enabled. 193 196 */ 194 - if (!iio_buffer_enabled(indio_dev)) 197 + if (iio_device_claim_buffer_mode(indio_dev) < 0) 195 198 return 0; 196 199 197 200 out = (s16 *)st->samples; ··· 213 210 iio_push_to_buffers_with_timestamp(indio_dev, st->samples, 214 211 timestamp + delta); 215 212 213 + iio_device_release_buffer_mode(indio_dev); 216 214 return 0; 217 215 } 218 216 EXPORT_SYMBOL_GPL(cros_ec_sensors_push_data);
+2 -2
drivers/iio/dac/ad3552r.c
··· 140 140 }; 141 141 142 142 enum ad3542r_id { 143 - AD3542R_ID = 0x4008, 144 - AD3552R_ID = 0x4009, 143 + AD3542R_ID = 0x4009, 144 + AD3552R_ID = 0x4008, 145 145 }; 146 146 147 147 enum ad3552r_ch_output_range {
+2 -2
drivers/iio/frequency/admv1013.c
··· 351 351 if (vcm < 0) 352 352 return vcm; 353 353 354 - if (vcm < 1800000) 354 + if (vcm <= 1800000) 355 355 mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100; 356 - else if (vcm > 1800000 && vcm < 2600000) 356 + else if (vcm > 1800000 && vcm <= 2600000) 357 357 mixer_vgate = (2375 * vcm / 1000000 + 125) / 100; 358 358 else 359 359 return -EINVAL;
+2
drivers/iio/imu/bno055/Kconfig
··· 2 2 3 3 config BOSCH_BNO055 4 4 tristate 5 + select IIO_BUFFER 6 + select IIO_TRIGGERED_BUFFER 5 7 6 8 config BOSCH_BNO055_SERIAL 7 9 tristate "Bosch BNO055 attached via UART"
-1
drivers/iio/light/vcnl4000.c
··· 1513 1513 1514 1514 out: 1515 1515 mutex_unlock(&data->vcnl4000_lock); 1516 - data->chip_spec->set_power_state(data, data->ps_int || data->als_int); 1517 1516 1518 1517 return ret; 1519 1518 }
+1 -1
drivers/iio/pressure/bmp280-core.c
··· 2179 2179 * however as it happens, the BMP085 shares the chip ID of BMP180 2180 2180 * so we look for an IRQ if we have that. 2181 2181 */ 2182 - if (irq > 0 || (chip_id == BMP180_CHIP_ID)) { 2182 + if (irq > 0 && (chip_id == BMP180_CHIP_ID)) { 2183 2183 ret = bmp085_fetch_eoc_irq(dev, name, irq, data); 2184 2184 if (ret) 2185 2185 return ret;
+4 -4
drivers/iio/pressure/dps310.c
··· 57 57 #define DPS310_RESET_MAGIC 0x09 58 58 #define DPS310_COEF_BASE 0x10 59 59 60 - /* Make sure sleep time is <= 20ms for usleep_range */ 61 - #define DPS310_POLL_SLEEP_US(t) min(20000, (t) / 8) 60 + /* Make sure sleep time is <= 30ms for usleep_range */ 61 + #define DPS310_POLL_SLEEP_US(t) min(30000, (t) / 8) 62 62 /* Silently handle error in rate value here */ 63 63 #define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc)) 64 64 ··· 402 402 if (rc) 403 403 return rc; 404 404 405 - /* Wait for device chip access: 2.5ms in specification */ 406 - usleep_range(2500, 12000); 405 + /* Wait for device chip access: 15ms in specification */ 406 + usleep_range(15000, 55000); 407 407 return 0; 408 408 } 409 409
+1 -1
drivers/iio/pressure/ms5611_core.c
··· 76 76 77 77 crc = (crc >> 12) & 0x000F; 78 78 79 - return crc_orig != 0x0000 && crc == crc_orig; 79 + return crc == crc_orig; 80 80 } 81 81 82 82 static int ms5611_read_prom(struct iio_dev *indio_dev)
+3 -3
drivers/iio/proximity/irsd200.c
··· 759 759 { 760 760 struct iio_dev *indio_dev = ((struct iio_poll_func *)pollf)->indio_dev; 761 761 struct irsd200_data *data = iio_priv(indio_dev); 762 - s16 buf = 0; 762 + s64 buf[2] = {}; 763 763 int ret; 764 764 765 - ret = irsd200_read_data(data, &buf); 765 + ret = irsd200_read_data(data, (s16 *)buf); 766 766 if (ret) 767 767 goto end; 768 768 769 - iio_push_to_buffers_with_timestamp(indio_dev, &buf, 769 + iio_push_to_buffers_with_timestamp(indio_dev, buf, 770 770 iio_get_time_ns(indio_dev)); 771 771 772 772 end: