History

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 ...

Linus Torvalds committed 6 years ago

Commit aff2a522 parents a1b85b3 4bcd9ea28 files · +198 −90Browse files

Unified · Split

28 files
  1. Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml +3 −2
  2. drivers/iio/accel/st_accel_core.c +6 −2
  3. drivers/iio/adc/ad7124.c +6 −1
  4. drivers/iio/adc/ad7606.c +1 −1
  5. drivers/iio/adc/ad7949.c +17 −5
  6. drivers/iio/adc/intel_mrfld_adc.c +1 −1
  7. drivers/iio/adc/max1027.c +7 −1
  8. drivers/iio/adc/max9611.c +10 −6
  9. drivers/iio/humidity/hdc100x.c +1 −1
  10. drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +12 −11
  11. drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +12 −4
  12. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h +2 −4
  13. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +32 −18
  14. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +28 −6
  15. drivers/iio/temperature/ltc2983.c +4 −2
  16. drivers/staging/exfat/exfat.h +2 −2
  17. drivers/staging/exfat/exfat_core.c +6 −4
  18. drivers/staging/exfat/exfat_super.c +2 −2
  19. drivers/staging/fbtft/fb_uc1611.c +9 −3
  20. drivers/staging/fbtft/fb_watterott.c +10 −3
  21. drivers/staging/fbtft/fbtft-core.c +3 −3
  22. drivers/staging/hp/Kconfig +1 −0
  23. drivers/staging/isdn/gigaset/usb-gigaset.c +18 −5
  24. drivers/staging/octeon/Kconfig +1 −0
  25. drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 −1
  26. drivers/staging/rtl8712/usb_intf.c +1 −1
  27. drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +1 −1
  28. drivers/staging/wlan-ng/Kconfig +1 −0
Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml+3−2
@@ -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: · 48 unmodified lines
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+6−2
@@ -992,6 +992,7 @@ static const struct iio_trigger_ops st_accel_trigger_ops = { · 991 unmodified lines
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[] = { · 14 unmodified lines
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, · 121 unmodified lines
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+6−1
@@ -39,6 +39,8 @@ · 38 unmodified lines
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, · 379 unmodified lines
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+1−1
@@ -85,7 +85,7 @@ err_unlock: · 84 unmodified lines
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+17−5
@@ -89,6 +89,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val, · 88 unmodified lines
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, · 5 unmodified lines
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+1−1
@@ -185,7 +185,7 @@ static int mrfld_adc_probe(struct platform_device *pdev) · 184 unmodified lines
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+7−1
@@ -478,7 +478,13 @@ static int max1027_probe(struct spi_device *spi) · 477 unmodified lines
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+10−6
@@ -89,6 +89,12 @@ · 88 unmodified lines
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, · 141 unmodified lines
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) · 260 unmodified lines
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+1−1
@@ -229,7 +229,7 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, · 228 unmodified lines
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+12−11
@@ -117,6 +117,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 116 unmodified lines
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,
@@ -124,6 +125,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -131,6 +133,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -138,6 +141,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -145,6 +149,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -152,6 +157,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -159,6 +165,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -166,6 +173,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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,
@@ -173,6 +181,7 @@ static const struct inv_mpu6050_hw hw_info[] = { · 1 unmodified line
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, · 302 unmodified lines
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, · 3 unmodified lines
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;
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h+12−4
@@ -107,6 +107,7 @@ struct inv_mpu6050_chip_config { · 106 unmodified lines
107107 * @reg: register map of the chip.
108108 * @config: configuration of the chip.
109109 * @fifo_size: size of the FIFO in bytes.
110+ * @temp: offset and scale to apply to raw temperature.
110111 */
111112 struct inv_mpu6050_hw {
112113 u8 whoami;
@@ -114,6 +115,10 @@ struct inv_mpu6050_hw { · 1 unmodified line
114115 const struct inv_mpu6050_reg_map *reg;
115116 const struct inv_mpu6050_chip_config *config;
116117 size_t fifo_size;
118+ struct {
119+ int offset;
120+ int scale;
121+ } temp;
117122 };
118123
119124 /*
@@ -279,16 +284,19 @@ struct inv_mpu6050_state { · 159 unmodified lines
279284 #define INV_MPU6050_REG_UP_TIME_MIN 5000
280285 #define INV_MPU6050_REG_UP_TIME_MAX 10000
281286
282−#define INV_MPU6050_TEMP_OFFSET 12421
283−#define INV_MPU6050_TEMP_SCALE 2941
287+#define INV_MPU6050_TEMP_OFFSET 12420
288+#define INV_MPU6050_TEMP_SCALE 2941176
284289 #define INV_MPU6050_MAX_GYRO_FS_PARAM 3
285290 #define INV_MPU6050_MAX_ACCL_FS_PARAM 3
286291 #define INV_MPU6050_THREE_AXIS 3
287292 #define INV_MPU6050_GYRO_CONFIG_FSR_SHIFT 3
288293 #define INV_MPU6050_ACCL_CONFIG_FSR_SHIFT 3
289294
290−#define INV_ICM20602_TEMP_OFFSET 8170
291−#define INV_ICM20602_TEMP_SCALE 3060
295+#define INV_MPU6500_TEMP_OFFSET 7011
296+#define INV_MPU6500_TEMP_SCALE 2995178
297+
298+#define INV_ICM20608_TEMP_OFFSET 8170
299+#define INV_ICM20608_TEMP_SCALE 3059976
292300
293301 /* 6 + 6 + 7 (for MPU9x50) = 19 round up to 24 and plus 8 */
294302 #define INV_MPU6050_OUTPUT_DATA_SIZE 32
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h+2−4
@@ -320,7 +320,6 @@ enum st_lsm6dsx_fifo_mode { · 319 unmodified lines
320320 * @odr: Output data rate of the sensor [Hz].
321321 * @watermark: Sensor watermark level.
322322 * @sip: Number of samples in a given pattern.
323− * @decimator: FIFO decimation factor.
324323 * @ts_ref: Sensor timestamp reference for hw one.
325324 * @ext_info: Sensor settings if it is connected to i2c controller
326325 */
@@ -334,7 +333,6 @@ struct st_lsm6dsx_sensor { · 7 unmodified lines
334333
335334 u16 watermark;
336335 u8 sip;
337− u8 decimator;
338336 s64 ts_ref;
339337
340338 struct {
@@ -351,9 +349,9 @@ struct st_lsm6dsx_sensor { · 10 unmodified lines
351349 * @fifo_lock: Mutex to prevent concurrent access to the hw FIFO.
352350 * @conf_lock: Mutex to prevent concurrent FIFO configuration update.
353351 * @page_lock: Mutex to prevent concurrent memory page configuration.
354− * @fifo_mode: FIFO operating mode supported by the device.
355352 * @suspend_mask: Suspended sensor bitmask.
356353 * @enable_mask: Enabled sensor bitmask.
354+ * @fifo_mask: Enabled hw FIFO bitmask.
357355 * @ts_gain: Hw timestamp rate after internal calibration.
358356 * @ts_sip: Total number of timestamp samples in a given pattern.
359357 * @sip: Total number of samples (acc/gyro/ts) in a given pattern.
@@ -373,9 +371,9 @@ struct st_lsm6dsx_hw { · 13 unmodified lines
373371 struct mutex conf_lock;
374372 struct mutex page_lock;
375373
376− enum st_lsm6dsx_fifo_mode fifo_mode;
377374 u8 suspend_mask;
378375 u8 enable_mask;
376+ u8 fifo_mask;
379377 s64 ts_gain;
380378 u8 ts_sip;
381379 u8 sip;
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c+32−18
@@ -78,14 +78,20 @@ struct st_lsm6dsx_decimator_entry st_lsm6dsx_decimator_table[] = { · 77 unmodified lines
7878 { 32, 0x7 },
7979 };
8080
81−static int st_lsm6dsx_get_decimator_val(u8 val)
81+static int
82+st_lsm6dsx_get_decimator_val(struct st_lsm6dsx_sensor *sensor, u32 max_odr)
8283 {
8384 const int max_size = ARRAY_SIZE(st_lsm6dsx_decimator_table);
85+ u32 decimator = max_odr / sensor->odr;
8486 int i;
8587
86− for (i = 0; i < max_size; i++)
87− if (st_lsm6dsx_decimator_table[i].decimator == val)
88+ if (decimator > 1)
89+ decimator = round_down(decimator, 2);
90+
91+ for (i = 0; i < max_size; i++) {
92+ if (st_lsm6dsx_decimator_table[i].decimator == decimator)
8893 break;
94+ }
8995
9096 return i == max_size ? 0 : st_lsm6dsx_decimator_table[i].val;
9197 }
@@ -111,6 +117,13 @@ static void st_lsm6dsx_get_max_min_odr(struct st_lsm6dsx_hw *hw, · 19 unmodified lines
111117 }
112118 }
113119
120+static u8 st_lsm6dsx_get_sip(struct st_lsm6dsx_sensor *sensor, u32 min_odr)
121+{
122+ u8 sip = sensor->odr / min_odr;
123+
124+ return sip > 1 ? round_down(sip, 2) : sip;
125+}
126+
114127 static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw)
115128 {
116129 const struct st_lsm6dsx_reg *ts_dec_reg;
@@ -131,12 +144,10 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw) · 14 unmodified lines
131144 sensor = iio_priv(hw->iio_devs[i]);
132145 /* update fifo decimators and sample in pattern */
133146 if (hw->enable_mask & BIT(sensor->id)) {
134− sensor->sip = sensor->odr / min_odr;
135− sensor->decimator = max_odr / sensor->odr;
136− data = st_lsm6dsx_get_decimator_val(sensor->decimator);
147+ sensor->sip = st_lsm6dsx_get_sip(sensor, min_odr);
148+ data = st_lsm6dsx_get_decimator_val(sensor, max_odr);
137149 } else {
138150 sensor->sip = 0;
139− sensor->decimator = 0;
140151 data = 0;
141152 }
142153 ts_sip = max_t(u16, ts_sip, sensor->sip);
@@ -176,17 +187,10 @@ int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw, · 33 unmodified lines
176187 enum st_lsm6dsx_fifo_mode fifo_mode)
177188 {
178189 unsigned int data;
179− int err;
180190
181191 data = FIELD_PREP(ST_LSM6DSX_FIFO_MODE_MASK, fifo_mode);
182− err = st_lsm6dsx_update_bits_locked(hw, ST_LSM6DSX_REG_FIFO_MODE_ADDR,
183− ST_LSM6DSX_FIFO_MODE_MASK, data);
184− if (err < 0)
185− return err;
186−
187− hw->fifo_mode = fifo_mode;
188−
189− return 0;
192+ return st_lsm6dsx_update_bits_locked(hw, ST_LSM6DSX_REG_FIFO_MODE_ADDR,
193+ ST_LSM6DSX_FIFO_MODE_MASK, data);
190194 }
191195
192196 static int st_lsm6dsx_set_fifo_odr(struct st_lsm6dsx_sensor *sensor,
@@ -608,11 +612,17 @@ int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw) · 415 unmodified lines
608612 int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
609613 {
610614 struct st_lsm6dsx_hw *hw = sensor->hw;
615+ u8 fifo_mask;
611616 int err;
612617
613618 mutex_lock(&hw->conf_lock);
614619
615− if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS) {
620+ if (enable)
621+ fifo_mask = hw->fifo_mask | BIT(sensor->id);
622+ else
623+ fifo_mask = hw->fifo_mask & ~BIT(sensor->id);
624+
625+ if (hw->fifo_mask) {
616626 err = st_lsm6dsx_flush_fifo(hw);
617627 if (err < 0)
618628 goto out;
@@ -642,15 +652,19 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable) · 23 unmodified lines
642652 if (err < 0)
643653 goto out;
644654
645− if (hw->enable_mask) {
655+ if (fifo_mask) {
646656 /* reset hw ts counter */
647657 err = st_lsm6dsx_reset_hw_ts(hw);
648658 if (err < 0)
649659 goto out;
650660
651661 err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
662+ if (err < 0)
663+ goto out;
652664 }
653665
666+ hw->fifo_mask = fifo_mask;
667+
654668 out:
655669 mutex_unlock(&hw->conf_lock);
656670
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c+28−6
@@ -1447,8 +1447,9 @@ st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u32 req_odr) · 1446 unmodified lines
14471447 return st_lsm6dsx_update_bits_locked(hw, reg->addr, reg->mask, data);
14481448 }
14491449
1450−int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
1451− bool enable)
1450+static int
1451+__st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
1452+ bool enable)
14521453 {
14531454 struct st_lsm6dsx_hw *hw = sensor->hw;
14541455 u32 odr = enable ? sensor->odr : 0;
@@ -1466,6 +1467,26 @@ int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor, · 11 unmodified lines
14661467 return 0;
14671468 }
14681469
1470+static int
1471+st_lsm6dsx_check_events(struct st_lsm6dsx_sensor *sensor, bool enable)
1472+{
1473+ struct st_lsm6dsx_hw *hw = sensor->hw;
1474+
1475+ if (sensor->id == ST_LSM6DSX_ID_GYRO || enable)
1476+ return 0;
1477+
1478+ return hw->enable_event;
1479+}
1480+
1481+int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
1482+ bool enable)
1483+{
1484+ if (st_lsm6dsx_check_events(sensor, enable))
1485+ return 0;
1486+
1487+ return __st_lsm6dsx_sensor_set_enable(sensor, enable);
1488+}
1489+
14691490 static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
14701491 u8 addr, int *val)
14711492 {
@@ -1661,7 +1682,7 @@ st_lsm6dsx_write_event_config(struct iio_dev *iio_dev, · 189 unmodified lines
16611682 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
16621683 struct st_lsm6dsx_hw *hw = sensor->hw;
16631684 u8 enable_event;
1664− int err = 0;
1685+ int err;
16651686
16661687 if (type != IIO_EV_TYPE_THRESH)
16671688 return -EINVAL;
@@ -1689,7 +1710,8 @@ st_lsm6dsx_write_event_config(struct iio_dev *iio_dev, · 21 unmodified lines
16891710 return err;
16901711
16911712 mutex_lock(&hw->conf_lock);
1692− err = st_lsm6dsx_sensor_set_enable(sensor, state);
1713+ if (enable_event || !(hw->fifo_mask & BIT(sensor->id)))
1714+ err = __st_lsm6dsx_sensor_set_enable(sensor, state);
16931715 mutex_unlock(&hw->conf_lock);
16941716 if (err < 0)
16951717 return err;
@@ -2300,7 +2322,7 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) · 604 unmodified lines
23002322 hw->suspend_mask |= BIT(sensor->id);
23012323 }
23022324
2303− if (hw->fifo_mode != ST_LSM6DSX_FIFO_BYPASS)
2325+ if (hw->fifo_mask)
23042326 err = st_lsm6dsx_flush_fifo(hw);
23052327
23062328 return err;
@@ -2336,7 +2358,7 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev) · 29 unmodified lines
23362358 hw->suspend_mask &= ~BIT(sensor->id);
23372359 }
23382360
2339− if (hw->enable_mask)
2361+ if (hw->fifo_mask)
23402362 err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
23412363
23422364 return err;
drivers/iio/temperature/ltc2983.c+4−2
@@ -444,8 +444,10 @@ static struct ltc2983_custom_sensor *__ltc2983_custom_sensor_new( · 443 unmodified lines
444444 else
445445 temp = __convert_to_raw(temp, resolution);
446446 } else {
447− of_property_read_u32_index(np, propname, index,
448− (u32 *)&temp);
447+ u32 t32;
448+
449+ of_property_read_u32_index(np, propname, index, &t32);
450+ temp = t32;
449451 }
450452
451453 for (j = 0; j < n_size; j++)
drivers/staging/exfat/exfat.h+2−2
@@ -805,8 +805,8 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, · 804 unmodified lines
805805 s32 create_file(struct inode *inode, struct chain_t *p_dir,
806806 struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid);
807807 void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry);
808−s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
809− struct uni_name_t *p_uniname, struct file_id_t *fid);
808+s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
809+ struct uni_name_t *p_uniname, struct file_id_t *fid);
810810 s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
811811 struct chain_t *p_newdir, struct uni_name_t *p_uniname,
812812 struct file_id_t *fid);
drivers/staging/exfat/exfat_core.c+6−4
@@ -192,8 +192,6 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) · 191 unmodified lines
192192
193193 exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b);
194194
195− return sector_write(sb, sector, p_fs->vol_amap[i], 0);
196−
197195 #ifdef CONFIG_EXFAT_DISCARD
198196 if (opts->discard) {
199197 ret = sb_issue_discard(sb, START_SECTOR(clu),
@@ -202,9 +200,13 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) · 2 unmodified lines
202200 if (ret == -EOPNOTSUPP) {
203201 pr_warn("discard not supported by device, disabling");
204202 opts->discard = 0;
203+ } else {
204+ return ret;
205205 }
206206 }
207207 #endif /* CONFIG_EXFAT_DISCARD */
208+
209+ return sector_write(sb, sector, p_fs->vol_amap[i], 0);
208210 }
209211
210212 static u32 test_alloc_bitmap(struct super_block *sb, u32 clu)
@@ -2322,8 +2324,8 @@ void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry) · 2111 unmodified lines
23222324 fs_func->delete_dir_entry(sb, p_dir, entry, 0, num_entries);
23232325 }
23242326
2325−s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
2326− struct uni_name_t *p_uniname, struct file_id_t *fid)
2327+s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
2328+ struct uni_name_t *p_uniname, struct file_id_t *fid)
23272329 {
23282330 s32 ret, newentry = -1, num_old_entries, num_new_entries;
23292331 sector_t sector_old, sector_new;
drivers/staging/exfat/exfat_super.c+2−2
@@ -1262,8 +1262,8 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, · 1261 unmodified lines
12621262 fs_set_vol_flags(sb, VOL_DIRTY);
12631263
12641264 if (olddir.dir == newdir.dir)
1265− ret = rename_file(new_parent_inode, &olddir, dentry, &uni_name,
1266− fid);
1265+ ret = exfat_rename_file(new_parent_inode, &olddir, dentry,
1266+ &uni_name, fid);
12671267 else
12681268 ret = move_file(new_parent_inode, &olddir, dentry, &newdir,
12691269 &uni_name, fid);
drivers/staging/fbtft/fb_uc1611.c+9−3
@@ -63,11 +63,17 @@ static int init_display(struct fbtft_par *par) · 62 unmodified lines
6363 {
6464 int ret;
6565
66− /* Set CS active high */
67− par->spi->mode |= SPI_CS_HIGH;
66+ /*
67+ * Set CS active inverse polarity: just setting SPI_CS_HIGH does not
68+ * work with GPIO based chip selects that are logically active high
69+ * but inverted inside the GPIO library, so enforce inverted
70+ * semantics.
71+ */
72+ par->spi->mode ^= SPI_CS_HIGH;
6873 ret = spi_setup(par->spi);
6974 if (ret) {
70− dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
75+ dev_err(par->info->device,
76+ "Could not set inverse CS polarity\n");
7177 return ret;
7278 }
7379
drivers/staging/fbtft/fb_watterott.c+10−3
@@ -150,10 +150,17 @@ static int init_display(struct fbtft_par *par) · 149 unmodified lines
150150
151151 /* enable SPI interface by having CS and MOSI low during reset */
152152 save_mode = par->spi->mode;
153− par->spi->mode |= SPI_CS_HIGH;
154− ret = spi_setup(par->spi); /* set CS inactive low */
153+ /*
154+ * Set CS active inverse polarity: just setting SPI_CS_HIGH does not
155+ * work with GPIO based chip selects that are logically active high
156+ * but inverted inside the GPIO library, so enforce inverted
157+ * semantics.
158+ */
159+ par->spi->mode ^= SPI_CS_HIGH;
160+ ret = spi_setup(par->spi);
155161 if (ret) {
156− dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
162+ dev_err(par->info->device,
163+ "Could not set inverse CS polarity\n");
157164 return ret;
158165 }
159166 write_reg(par, 0x00); /* make sure mode is set */
drivers/staging/fbtft/fbtft-core.c+3−3
@@ -913,7 +913,7 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) · 912 unmodified lines
913913 if (count == 0)
914914 return -EINVAL;
915915
916− values = kmalloc_array(count, sizeof(*values), GFP_KERNEL);
916+ values = kmalloc_array(count + 1, sizeof(*values), GFP_KERNEL);
917917 if (!values)
918918 return -ENOMEM;
919919
@@ -926,9 +926,9 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) · 6 unmodified lines
926926 gpiod_set_value(par->gpio.cs, 0); /* Activate chip */
927927
928928 index = -1;
929− while (index < count) {
930− val = values[++index];
929+ val = values[++index];
931930
931+ while (index < count) {
932932 if (val & FBTFT_OF_INIT_CMD) {
933933 val &= 0xFFFF;
934934 i = 0;
drivers/staging/hp/Kconfig+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 config NET_VENDOR_HP
77 bool "HP devices"
88 default y
9+ depends on ETHERNET
910 depends on ISA || EISA || PCI
1011 ---help---
1112 If you have a network (Ethernet) card belonging to this class, say Y.
drivers/staging/isdn/gigaset/usb-gigaset.c+18−5
@@ -571,8 +571,7 @@ static int gigaset_initcshw(struct cardstate *cs) · 570 unmodified lines
571571 {
572572 struct usb_cardstate *ucs;
573573
574− cs->hw.usb = ucs =
575− kmalloc(sizeof(struct usb_cardstate), GFP_KERNEL);
574+ cs->hw.usb = ucs = kzalloc(sizeof(struct usb_cardstate), GFP_KERNEL);
576575 if (!ucs) {
577576 pr_err("out of memory\n");
578577 return -ENOMEM;
@@ -584,9 +583,6 @@ static int gigaset_initcshw(struct cardstate *cs) · 5 unmodified lines
584583 ucs->bchars[3] = 0;
585584 ucs->bchars[4] = 0x11;
586585 ucs->bchars[5] = 0x13;
587− ucs->bulk_out_buffer = NULL;
588− ucs->bulk_out_urb = NULL;
589− ucs->read_urb = NULL;
590586 tasklet_init(&cs->write_tasklet,
591587 gigaset_modem_fill, (unsigned long) cs);
592588
@@ -685,6 +681,11 @@ static int gigaset_probe(struct usb_interface *interface, · 92 unmodified lines
685681 return -ENODEV;
686682 }
687683
684+ if (hostif->desc.bNumEndpoints < 2) {
685+ dev_err(&interface->dev, "missing endpoints\n");
686+ return -ENODEV;
687+ }
688+
688689 dev_info(&udev->dev, "%s: Device matched ... !\n", __func__);
689690
690691 /* allocate memory for our device state and initialize it */
@@ -704,6 +705,12 @@ static int gigaset_probe(struct usb_interface *interface, · 13 unmodified lines
704705
705706 endpoint = &hostif->endpoint[0].desc;
706707
708+ if (!usb_endpoint_is_bulk_out(endpoint)) {
709+ dev_err(&interface->dev, "missing bulk-out endpoint\n");
710+ retval = -ENODEV;
711+ goto error;
712+ }
713+
707714 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
708715 ucs->bulk_out_size = buffer_size;
709716 ucs->bulk_out_epnum = usb_endpoint_num(endpoint);
@@ -723,6 +730,12 @@ static int gigaset_probe(struct usb_interface *interface, · 13 unmodified lines
723730
724731 endpoint = &hostif->endpoint[1].desc;
725732
733+ if (!usb_endpoint_is_int_in(endpoint)) {
734+ dev_err(&interface->dev, "missing int-in endpoint\n");
735+ retval = -ENODEV;
736+ goto error;
737+ }
738+
726739 ucs->busy = 0;
727740
728741 ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL);
drivers/staging/octeon/Kconfig+1−0
@@ -3,6 +3,7 @@ config OCTEON_ETHERNET · 2 unmodified lines
33 tristate "Cavium Networks Octeon Ethernet support"
44 depends on CAVIUM_OCTEON_SOC || COMPILE_TEST
55 depends on NETDEVICES
6+ depends on BROKEN
67 select PHYLIB
78 select MDIO_OCTEON
89 help
drivers/staging/rtl8188eu/os_dep/usb_intf.c+1−1
@@ -70,7 +70,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) · 69 unmodified lines
7070 phost_conf = pusbd->actconfig;
7171 pconf_desc = &phost_conf->desc;
7272
73− phost_iface = &usb_intf->altsetting[0];
73+ phost_iface = usb_intf->cur_altsetting;
7474 piface_desc = &phost_iface->desc;
7575
7676 pdvobjpriv->NumInterfaces = pconf_desc->bNumInterfaces;
drivers/staging/rtl8712/usb_intf.c+1−1
@@ -247,7 +247,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter) · 246 unmodified lines
247247
248248 pdvobjpriv->padapter = padapter;
249249 padapter->eeprom_address_size = 6;
250− phost_iface = &pintf->altsetting[0];
250+ phost_iface = pintf->cur_altsetting;
251251 piface_desc = &phost_iface->desc;
252252 pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints;
253253 if (pusbd->speed == USB_SPEED_HIGH) {
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c+1−1
@@ -3309,7 +3309,7 @@ static int __init vchiq_driver_init(void) · 3308 unmodified lines
33093309 return 0;
33103310
33113311 region_unregister:
3312− platform_driver_unregister(&vchiq_driver);
3312+ unregister_chrdev_region(vchiq_devid, 1);
33133313
33143314 class_destroy:
33153315 class_destroy(vchiq_class);
drivers/staging/wlan-ng/Kconfig+1−0
@@ -4,6 +4,7 @@ config PRISM2_USB · 3 unmodified lines
44 depends on WLAN && USB && CFG80211
55 select WIRELESS_EXT
66 select WEXT_PRIV
7+ select CRC32
78 help
89 This is the wlan-ng prism 2.5/3 USB driver for a wide range of
910 old USB wireless devices.