Skip to content

Commit ffd1f15

Browse files
committed
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
2 parents 1aa3aaf + fd39d96 commit ffd1f15

File tree

14 files changed

+51
-22
lines changed

14 files changed

+51
-22
lines changed

Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ patternProperties:
6161
required:
6262
- reg
6363

64-
additionalProperties: true
64+
additionalProperties: false
6565

6666
allOf:
6767
- $ref: /schemas/spi/spi-peripheral-props.yaml#

Documentation/devicetree/bindings/iio/light/rohm,bu27010.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ examples:
4545
light-sensor@38 {
4646
compatible = "rohm,bu27010";
4747
reg = <0x38>;
48+
vdd-supply = <&vdd>;
4849
};
4950
};

drivers/iio/adc/ad7192.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ struct ad7192_chip_info {
177177
struct ad7192_state {
178178
const struct ad7192_chip_info *chip_info;
179179
struct regulator *avdd;
180+
struct regulator *vref;
180181
struct clk *mclk;
181182
u16 int_vref_mv;
182183
u32 fclk;
@@ -1008,10 +1009,30 @@ static int ad7192_probe(struct spi_device *spi)
10081009
if (ret)
10091010
return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n");
10101011

1011-
ret = regulator_get_voltage(st->avdd);
1012-
if (ret < 0) {
1013-
dev_err(&spi->dev, "Device tree error, reference voltage undefined\n");
1014-
return ret;
1012+
st->vref = devm_regulator_get_optional(&spi->dev, "vref");
1013+
if (IS_ERR(st->vref)) {
1014+
if (PTR_ERR(st->vref) != -ENODEV)
1015+
return PTR_ERR(st->vref);
1016+
1017+
ret = regulator_get_voltage(st->avdd);
1018+
if (ret < 0)
1019+
return dev_err_probe(&spi->dev, ret,
1020+
"Device tree error, AVdd voltage undefined\n");
1021+
} else {
1022+
ret = regulator_enable(st->vref);
1023+
if (ret) {
1024+
dev_err(&spi->dev, "Failed to enable specified Vref supply\n");
1025+
return ret;
1026+
}
1027+
1028+
ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref);
1029+
if (ret)
1030+
return ret;
1031+
1032+
ret = regulator_get_voltage(st->vref);
1033+
if (ret < 0)
1034+
return dev_err_probe(&spi->dev, ret,
1035+
"Device tree error, Vref voltage undefined\n");
10151036
}
10161037
st->int_vref_mv = ret / 1000;
10171038

drivers/iio/adc/imx8qxp-adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
#define IMX8QXP_ADR_ADC_FCTRL 0x30
3939
#define IMX8QXP_ADR_ADC_SWTRIG 0x34
4040
#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)
4343
#define IMX8QXP_ADR_ADC_RESFIFO 0x300
4444
#define IMX8QXP_ADR_ADC_TST 0xffc
4545

drivers/iio/addac/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ config AD74413R
2424
depends on GPIOLIB && SPI
2525
select REGMAP_SPI
2626
select CRC8
27+
select IIO_BUFFER
28+
select IIO_TRIGGERED_BUFFER
2729
help
2830
Say yes here to build support for Analog Devices AD74412R/AD74413R
2931
quad-channel software configurable input/output solution.

drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
190190
/*
191191
* Ignore samples if the buffer is not set: it is needed if the ODR is
192192
* 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.
193196
*/
194-
if (!iio_buffer_enabled(indio_dev))
197+
if (iio_device_claim_buffer_mode(indio_dev) < 0)
195198
return 0;
196199

197200
out = (s16 *)st->samples;
@@ -210,6 +213,7 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
210213
iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
211214
timestamp + delta);
212215

216+
iio_device_release_buffer_mode(indio_dev);
213217
return 0;
214218
}
215219
EXPORT_SYMBOL_GPL(cros_ec_sensors_push_data);

drivers/iio/dac/ad3552r.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ enum ad3552r_ch_vref_select {
140140
};
141141

142142
enum ad3542r_id {
143-
AD3542R_ID = 0x4008,
144-
AD3552R_ID = 0x4009,
143+
AD3542R_ID = 0x4009,
144+
AD3552R_ID = 0x4008,
145145
};
146146

147147
enum ad3552r_ch_output_range {

drivers/iio/frequency/admv1013.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,9 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st)
351351
if (vcm < 0)
352352
return vcm;
353353

354-
if (vcm < 1800000)
354+
if (vcm <= 1800000)
355355
mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
356-
else if (vcm > 1800000 && vcm < 2600000)
356+
else if (vcm > 1800000 && vcm <= 2600000)
357357
mixer_vgate = (2375 * vcm / 1000000 + 125) / 100;
358358
else
359359
return -EINVAL;

drivers/iio/imu/bno055/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
config BOSCH_BNO055
44
tristate
5+
select IIO_BUFFER
6+
select IIO_TRIGGERED_BUFFER
57

68
config BOSCH_BNO055_SERIAL
79
tristate "Bosch BNO055 attached via UART"

drivers/iio/light/vcnl4000.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,6 @@ static int vcnl4040_write_event_config(struct iio_dev *indio_dev,
15131513

15141514
out:
15151515
mutex_unlock(&data->vcnl4000_lock);
1516-
data->chip_spec->set_power_state(data, data->ps_int || data->als_int);
15171516

15181517
return ret;
15191518
}

drivers/iio/pressure/bmp280-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ int bmp280_common_probe(struct device *dev,
21792179
* however as it happens, the BMP085 shares the chip ID of BMP180
21802180
* so we look for an IRQ if we have that.
21812181
*/
2182-
if (irq > 0 || (chip_id == BMP180_CHIP_ID)) {
2182+
if (irq > 0 && (chip_id == BMP180_CHIP_ID)) {
21832183
ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
21842184
if (ret)
21852185
return ret;

drivers/iio/pressure/dps310.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
#define DPS310_RESET_MAGIC 0x09
5858
#define DPS310_COEF_BASE 0x10
5959

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)
6262
/* Silently handle error in rate value here */
6363
#define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc))
6464

@@ -402,8 +402,8 @@ static int dps310_reset_wait(struct dps310_data *data)
402402
if (rc)
403403
return rc;
404404

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);
407407
return 0;
408408
}
409409

drivers/iio/pressure/ms5611_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static bool ms5611_prom_is_valid(u16 *prom, size_t len)
7676

7777
crc = (crc >> 12) & 0x000F;
7878

79-
return crc_orig != 0x0000 && crc == crc_orig;
79+
return crc == crc_orig;
8080
}
8181

8282
static int ms5611_read_prom(struct iio_dev *indio_dev)

drivers/iio/proximity/irsd200.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,14 @@ static irqreturn_t irsd200_trigger_handler(int irq, void *pollf)
759759
{
760760
struct iio_dev *indio_dev = ((struct iio_poll_func *)pollf)->indio_dev;
761761
struct irsd200_data *data = iio_priv(indio_dev);
762-
s16 buf = 0;
762+
s64 buf[2] = {};
763763
int ret;
764764

765-
ret = irsd200_read_data(data, &buf);
765+
ret = irsd200_read_data(data, (s16 *)buf);
766766
if (ret)
767767
goto end;
768768

769-
iio_push_to_buffers_with_timestamp(indio_dev, &buf,
769+
iio_push_to_buffers_with_timestamp(indio_dev, buf,
770770
iio_get_time_ns(indio_dev));
771771

772772
end:

0 commit comments

Comments
 (0)