Skip to content

Commit aff2a52

Browse files
committed
Merge tag 'staging-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO fixes from Greg KH: "Here are a number of small staging and IIO driver fixes for reported issues for 5.5-rc2 Nothing major, a bunch of tiny IIO driver issues resolved, and some staging driver fixes for things that people ran into with 5.5-rc1. Full details are in the shortlog. All of these have been in linux-next with no reported issues" * tag 'staging-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (28 commits) fbtft: Fix the initialization from property algorithm staging: rtl8712: fix interface sanity check staging: rtl8188eu: fix interface sanity check staging: gigaset: add endpoint-type sanity check staging: gigaset: fix illegal free on probe errors staging: gigaset: fix general protection fault on probe staging: vchiq: call unregister_chrdev_region() when driver registration fails staging: exfat: fix multiple definition error of `rename_file' staging/wlan-ng: add CRC32 dependency in Kconfig staging: hp100: Fix build error without ETHERNET staging: fbtft: Do not hardcode SPI CS polarity inversion staging: exfat: properly support discard in clr_alloc_bitmap() staging/octeon: Mark Ethernet driver as BROKEN iio: adc: max9611: Fix too short conversion time delay iio: ad7949: fix channels mixups iio: imu: st_lsm6dsx: do not power-off accel if events are enabled iio: imu: st_lsm6dsx: track hw FIFO buffering with fifo_mask iio: imu: st_lsm6dsx: fix decimation factor estimation iio: imu: inv_mpu6050: fix temperature reporting using bad unit iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting ...
2 parents a1b85b3 + 4bcd9ea commit aff2a52

File tree

28 files changed

+198
-90
lines changed

28 files changed

+198
-90
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: GPL-2.0-only
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
22
%YAML 1.2
33
---
44
$id: http://devicetree.org/schemas/iio/adc/adi,ad7292.yaml#
@@ -53,7 +53,8 @@ patternProperties:
5353
description: |
5454
The channel number. It can have up to 8 channels numbered from 0 to 7.
5555
items:
56-
maximum: 7
56+
- minimum: 0
57+
maximum: 7
5758

5859
diff-channels:
5960
description: see Documentation/devicetree/bindings/iio/adc/adc.txt

drivers/iio/accel/st_accel_core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
992992
#define ST_ACCEL_TRIGGER_OPS NULL
993993
#endif
994994

995+
#ifdef CONFIG_ACPI
995996
static const struct iio_mount_matrix *
996997
get_mount_matrix(const struct iio_dev *indio_dev,
997998
const struct iio_chan_spec *chan)
@@ -1012,7 +1013,6 @@ static const struct iio_chan_spec_ext_info mount_matrix_ext_info[] = {
10121013
static int apply_acpi_orientation(struct iio_dev *indio_dev,
10131014
struct iio_chan_spec *channels)
10141015
{
1015-
#ifdef CONFIG_ACPI
10161016
struct st_sensor_data *adata = iio_priv(indio_dev);
10171017
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
10181018
struct acpi_device *adev;
@@ -1140,10 +1140,14 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
11401140
out:
11411141
kfree(buffer.pointer);
11421142
return ret;
1143+
}
11431144
#else /* !CONFIG_ACPI */
1145+
static int apply_acpi_orientation(struct iio_dev *indio_dev,
1146+
struct iio_chan_spec *channels)
1147+
{
11441148
return 0;
1145-
#endif
11461149
}
1150+
#endif
11471151

11481152
/*
11491153
* st_accel_get_settings() - get sensor settings from device name

drivers/iio/adc/ad7124.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#define AD7124_STATUS_POR_FLAG_MSK BIT(4)
4040

4141
/* AD7124_ADC_CONTROL */
42+
#define AD7124_ADC_CTRL_REF_EN_MSK BIT(8)
43+
#define AD7124_ADC_CTRL_REF_EN(x) FIELD_PREP(AD7124_ADC_CTRL_REF_EN_MSK, x)
4244
#define AD7124_ADC_CTRL_PWR_MSK GENMASK(7, 6)
4345
#define AD7124_ADC_CTRL_PWR(x) FIELD_PREP(AD7124_ADC_CTRL_PWR_MSK, x)
4446
#define AD7124_ADC_CTRL_MODE_MSK GENMASK(5, 2)
@@ -424,7 +426,10 @@ static int ad7124_init_channel_vref(struct ad7124_state *st,
424426
break;
425427
case AD7124_INT_REF:
426428
st->channel_config[channel_number].vref_mv = 2500;
427-
break;
429+
st->adc_control &= ~AD7124_ADC_CTRL_REF_EN_MSK;
430+
st->adc_control |= AD7124_ADC_CTRL_REF_EN(1);
431+
return ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL,
432+
2, st->adc_control);
428433
default:
429434
dev_err(&st->sd.spi->dev, "Invalid reference %d\n", refsel);
430435
return -EINVAL;

drivers/iio/adc/ad7606.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int ad7606_reg_access(struct iio_dev *indio_dev,
8585

8686
static int ad7606_read_samples(struct ad7606_state *st)
8787
{
88-
unsigned int num = st->chip_info->num_channels;
88+
unsigned int num = st->chip_info->num_channels - 1;
8989
u16 *data = st->data;
9090
int ret;
9191

drivers/iio/adc/ad7949.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
8989
unsigned int channel)
9090
{
9191
int ret;
92+
int i;
9293
int bits_per_word = ad7949_adc->resolution;
9394
int mask = GENMASK(ad7949_adc->resolution, 0);
9495
struct spi_message msg;
@@ -100,12 +101,23 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
100101
},
101102
};
102103

103-
ret = ad7949_spi_write_cfg(ad7949_adc,
104-
channel << AD7949_OFFSET_CHANNEL_SEL,
105-
AD7949_MASK_CHANNEL_SEL);
106-
if (ret)
107-
return ret;
104+
/*
105+
* 1: write CFG for sample N and read old data (sample N-2)
106+
* 2: if CFG was not changed since sample N-1 then we'll get good data
107+
* at the next xfer, so we bail out now, otherwise we write something
108+
* and we read garbage (sample N-1 configuration).
109+
*/
110+
for (i = 0; i < 2; i++) {
111+
ret = ad7949_spi_write_cfg(ad7949_adc,
112+
channel << AD7949_OFFSET_CHANNEL_SEL,
113+
AD7949_MASK_CHANNEL_SEL);
114+
if (ret)
115+
return ret;
116+
if (channel == ad7949_adc->current_channel)
117+
break;
118+
}
108119

120+
/* 3: write something and read actual data */
109121
ad7949_adc->buffer = 0;
110122
spi_message_init_with_transfers(&msg, tx, 1);
111123
ret = spi_sync(ad7949_adc->spi, &msg);

drivers/iio/adc/intel_mrfld_adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int mrfld_adc_probe(struct platform_device *pdev)
185185
int irq;
186186
int ret;
187187

188-
indio_dev = devm_iio_device_alloc(dev, sizeof(*indio_dev));
188+
indio_dev = devm_iio_device_alloc(dev, sizeof(struct mrfld_adc));
189189
if (!indio_dev)
190190
return -ENOMEM;
191191

drivers/iio/adc/max1027.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,13 @@ static int max1027_probe(struct spi_device *spi)
478478
st->trig->ops = &max1027_trigger_ops;
479479
st->trig->dev.parent = &spi->dev;
480480
iio_trigger_set_drvdata(st->trig, indio_dev);
481-
iio_trigger_register(st->trig);
481+
ret = devm_iio_trigger_register(&indio_dev->dev,
482+
st->trig);
483+
if (ret < 0) {
484+
dev_err(&indio_dev->dev,
485+
"Failed to register iio trigger\n");
486+
return ret;
487+
}
482488

483489
ret = devm_request_threaded_irq(&spi->dev, spi->irq,
484490
iio_trigger_generic_data_rdy_poll,

drivers/iio/adc/max9611.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
#define MAX9611_TEMP_SCALE_NUM 1000000
9090
#define MAX9611_TEMP_SCALE_DIV 2083
9191

92+
/*
93+
* Conversion time is 2 ms (typically) at Ta=25 degreeC
94+
* No maximum value is known, so play it safe.
95+
*/
96+
#define MAX9611_CONV_TIME_US_RANGE 3000, 3300
97+
9298
struct max9611_dev {
9399
struct device *dev;
94100
struct i2c_client *i2c_client;
@@ -236,11 +242,9 @@ static int max9611_read_single(struct max9611_dev *max9611,
236242
return ret;
237243
}
238244

239-
/*
240-
* need a delay here to make register configuration
241-
* stabilize. 1 msec at least, from empirical testing.
242-
*/
243-
usleep_range(1000, 2000);
245+
/* need a delay here to make register configuration stabilize. */
246+
247+
usleep_range(MAX9611_CONV_TIME_US_RANGE);
244248

245249
ret = i2c_smbus_read_word_swapped(max9611->i2c_client, reg_addr);
246250
if (ret < 0) {
@@ -507,7 +511,7 @@ static int max9611_init(struct max9611_dev *max9611)
507511
MAX9611_REG_CTRL2, 0);
508512
return ret;
509513
}
510-
usleep_range(1000, 2000);
514+
usleep_range(MAX9611_CONV_TIME_US_RANGE);
511515

512516
return 0;
513517
}

drivers/iio/humidity/hdc100x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
229229
*val2 = 65536;
230230
return IIO_VAL_FRACTIONAL;
231231
} else {
232-
*val = 100;
232+
*val = 100000;
233233
*val2 = 65536;
234234
return IIO_VAL_FRACTIONAL;
235235
}

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,62 +117,71 @@ static const struct inv_mpu6050_hw hw_info[] = {
117117
.reg = &reg_set_6050,
118118
.config = &chip_config_6050,
119119
.fifo_size = 1024,
120+
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
120121
},
121122
{
122123
.whoami = INV_MPU6500_WHOAMI_VALUE,
123124
.name = "MPU6500",
124125
.reg = &reg_set_6500,
125126
.config = &chip_config_6050,
126127
.fifo_size = 512,
128+
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
127129
},
128130
{
129131
.whoami = INV_MPU6515_WHOAMI_VALUE,
130132
.name = "MPU6515",
131133
.reg = &reg_set_6500,
132134
.config = &chip_config_6050,
133135
.fifo_size = 512,
136+
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
134137
},
135138
{
136139
.whoami = INV_MPU6000_WHOAMI_VALUE,
137140
.name = "MPU6000",
138141
.reg = &reg_set_6050,
139142
.config = &chip_config_6050,
140143
.fifo_size = 1024,
144+
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
141145
},
142146
{
143147
.whoami = INV_MPU9150_WHOAMI_VALUE,
144148
.name = "MPU9150",
145149
.reg = &reg_set_6050,
146150
.config = &chip_config_6050,
147151
.fifo_size = 1024,
152+
.temp = {INV_MPU6050_TEMP_OFFSET, INV_MPU6050_TEMP_SCALE},
148153
},
149154
{
150155
.whoami = INV_MPU9250_WHOAMI_VALUE,
151156
.name = "MPU9250",
152157
.reg = &reg_set_6500,
153158
.config = &chip_config_6050,
154159
.fifo_size = 512,
160+
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
155161
},
156162
{
157163
.whoami = INV_MPU9255_WHOAMI_VALUE,
158164
.name = "MPU9255",
159165
.reg = &reg_set_6500,
160166
.config = &chip_config_6050,
161167
.fifo_size = 512,
168+
.temp = {INV_MPU6500_TEMP_OFFSET, INV_MPU6500_TEMP_SCALE},
162169
},
163170
{
164171
.whoami = INV_ICM20608_WHOAMI_VALUE,
165172
.name = "ICM20608",
166173
.reg = &reg_set_6500,
167174
.config = &chip_config_6050,
168175
.fifo_size = 512,
176+
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
169177
},
170178
{
171179
.whoami = INV_ICM20602_WHOAMI_VALUE,
172180
.name = "ICM20602",
173181
.reg = &reg_set_icm20602,
174182
.config = &chip_config_6050,
175183
.fifo_size = 1008,
184+
.temp = {INV_ICM20608_TEMP_OFFSET, INV_ICM20608_TEMP_SCALE},
176185
},
177186
};
178187

@@ -481,12 +490,8 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
481490

482491
return IIO_VAL_INT_PLUS_MICRO;
483492
case IIO_TEMP:
484-
*val = 0;
485-
if (st->chip_type == INV_ICM20602)
486-
*val2 = INV_ICM20602_TEMP_SCALE;
487-
else
488-
*val2 = INV_MPU6050_TEMP_SCALE;
489-
493+
*val = st->hw->temp.scale / 1000000;
494+
*val2 = st->hw->temp.scale % 1000000;
490495
return IIO_VAL_INT_PLUS_MICRO;
491496
case IIO_MAGN:
492497
return inv_mpu_magn_get_scale(st, chan, val, val2);
@@ -496,11 +501,7 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
496501
case IIO_CHAN_INFO_OFFSET:
497502
switch (chan->type) {
498503
case IIO_TEMP:
499-
if (st->chip_type == INV_ICM20602)
500-
*val = INV_ICM20602_TEMP_OFFSET;
501-
else
502-
*val = INV_MPU6050_TEMP_OFFSET;
503-
504+
*val = st->hw->temp.offset;
504505
return IIO_VAL_INT;
505506
default:
506507
return -EINVAL;

0 commit comments

Comments
 (0)