Skip to content

Commit dd89262

Browse files
committed
Merge tag 'staging-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull IIO fixes and staging driver from Greg KH: "Here is a mix of a number of IIO driver fixes for 5.4-rc7, and a whole new staging driver. The IIO fixes resolve some reported issues, all are tiny. The staging driver addition is the vboxsf filesystem, which is the VirtualBox guest shared folder code. Hans has been trying to get filesystem reviewers to review the code for many months now, and Christoph finally said to just merge it in staging now as it is stand-alone and the filesystem people can review it easier over time that way. I know it's late for this big of an addition, but it is stand-alone. The code has been in linux-next for a while, long enough to pick up a few tiny fixes for it already so people are looking at it. All of these have been in linux-next with no reported issues" * tag 'staging-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: Fix error return code in vboxsf_fill_super() staging: vboxsf: fix dereference of pointer dentry before it is null checked staging: vboxsf: Remove unused including <linux/version.h> staging: Add VirtualBox guest shared folder (vboxsf) support iio: adc: stm32-adc: fix stopping dma iio: imu: inv_mpu6050: fix no data on MPU6050 iio: srf04: fix wrong limitation in distance measuring iio: imu: adis16480: make sure provided frequency is positive
2 parents 3de2a3e + e39fcae commit dd89262

File tree

19 files changed

+3324
-20
lines changed

19 files changed

+3324
-20
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17339,6 +17339,12 @@ F: include/linux/vbox_utils.h
1733917339
F: include/uapi/linux/vbox*.h
1734017340
F: drivers/virt/vboxguest/
1734117341

17342+
VIRTUAL BOX SHARED FOLDER VFS DRIVER:
17343+
M: Hans de Goede <[email protected]>
17344+
17345+
S: Maintained
17346+
F: drivers/staging/vboxsf/*
17347+
1734217348
VIRTUAL SERIO DEVICE DRIVER
1734317349
M: Stephen Chandler Paul <[email protected]>
1734417350
S: Maintained

drivers/iio/adc/stm32-adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static int stm32_adc_dma_start(struct iio_dev *indio_dev)
13991399
cookie = dmaengine_submit(desc);
14001400
ret = dma_submit_error(cookie);
14011401
if (ret) {
1402-
dmaengine_terminate_all(adc->dma_chan);
1402+
dmaengine_terminate_sync(adc->dma_chan);
14031403
return ret;
14041404
}
14051405

@@ -1477,7 +1477,7 @@ static void __stm32_adc_buffer_predisable(struct iio_dev *indio_dev)
14771477
stm32_adc_conv_irq_disable(adc);
14781478

14791479
if (adc->dma_chan)
1480-
dmaengine_terminate_all(adc->dma_chan);
1480+
dmaengine_terminate_sync(adc->dma_chan);
14811481

14821482
if (stm32_adc_set_trig(indio_dev, NULL))
14831483
dev_err(&indio_dev->dev, "Can't clear trigger\n");

drivers/iio/imu/adis16480.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,11 @@ static int adis16480_set_freq(struct iio_dev *indio_dev, int val, int val2)
317317
struct adis16480 *st = iio_priv(indio_dev);
318318
unsigned int t, reg;
319319

320+
if (val < 0 || val2 < 0)
321+
return -EINVAL;
322+
320323
t = val * 1000 + val2 / 1000;
321-
if (t <= 0)
324+
if (t == 0)
322325
return -EINVAL;
323326

324327
/*

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,54 +114,63 @@ static const struct inv_mpu6050_hw hw_info[] = {
114114
.name = "MPU6050",
115115
.reg = &reg_set_6050,
116116
.config = &chip_config_6050,
117+
.fifo_size = 1024,
117118
},
118119
{
119120
.whoami = INV_MPU6500_WHOAMI_VALUE,
120121
.name = "MPU6500",
121122
.reg = &reg_set_6500,
122123
.config = &chip_config_6050,
124+
.fifo_size = 512,
123125
},
124126
{
125127
.whoami = INV_MPU6515_WHOAMI_VALUE,
126128
.name = "MPU6515",
127129
.reg = &reg_set_6500,
128130
.config = &chip_config_6050,
131+
.fifo_size = 512,
129132
},
130133
{
131134
.whoami = INV_MPU6000_WHOAMI_VALUE,
132135
.name = "MPU6000",
133136
.reg = &reg_set_6050,
134137
.config = &chip_config_6050,
138+
.fifo_size = 1024,
135139
},
136140
{
137141
.whoami = INV_MPU9150_WHOAMI_VALUE,
138142
.name = "MPU9150",
139143
.reg = &reg_set_6050,
140144
.config = &chip_config_6050,
145+
.fifo_size = 1024,
141146
},
142147
{
143148
.whoami = INV_MPU9250_WHOAMI_VALUE,
144149
.name = "MPU9250",
145150
.reg = &reg_set_6500,
146151
.config = &chip_config_6050,
152+
.fifo_size = 512,
147153
},
148154
{
149155
.whoami = INV_MPU9255_WHOAMI_VALUE,
150156
.name = "MPU9255",
151157
.reg = &reg_set_6500,
152158
.config = &chip_config_6050,
159+
.fifo_size = 512,
153160
},
154161
{
155162
.whoami = INV_ICM20608_WHOAMI_VALUE,
156163
.name = "ICM20608",
157164
.reg = &reg_set_6500,
158165
.config = &chip_config_6050,
166+
.fifo_size = 512,
159167
},
160168
{
161169
.whoami = INV_ICM20602_WHOAMI_VALUE,
162170
.name = "ICM20602",
163171
.reg = &reg_set_icm20602,
164172
.config = &chip_config_6050,
173+
.fifo_size = 1008,
165174
},
166175
};
167176

drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ struct inv_mpu6050_chip_config {
100100
* @name: name of the chip.
101101
* @reg: register map of the chip.
102102
* @config: configuration of the chip.
103+
* @fifo_size: size of the FIFO in bytes.
103104
*/
104105
struct inv_mpu6050_hw {
105106
u8 whoami;
106107
u8 *name;
107108
const struct inv_mpu6050_reg_map *reg;
108109
const struct inv_mpu6050_chip_config *config;
110+
size_t fifo_size;
109111
};
110112

111113
/*

drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
180180
"failed to ack interrupt\n");
181181
goto flush_fifo;
182182
}
183-
/* handle fifo overflow by reseting fifo */
184-
if (int_status & INV_MPU6050_BIT_FIFO_OVERFLOW_INT)
185-
goto flush_fifo;
186183
if (!(int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT)) {
187184
dev_warn(regmap_get_device(st->map),
188185
"spurious interrupt with status 0x%x\n", int_status);
@@ -211,6 +208,18 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
211208
if (result)
212209
goto end_session;
213210
fifo_count = get_unaligned_be16(&data[0]);
211+
212+
/*
213+
* Handle fifo overflow by resetting fifo.
214+
* Reset if there is only 3 data set free remaining to mitigate
215+
* possible delay between reading fifo count and fifo data.
216+
*/
217+
nb = 3 * bytes_per_datum;
218+
if (fifo_count >= st->hw->fifo_size - nb) {
219+
dev_warn(regmap_get_device(st->map), "fifo overflow reset\n");
220+
goto flush_fifo;
221+
}
222+
214223
/* compute and process all complete datum */
215224
nb = fifo_count / bytes_per_datum;
216225
inv_mpu6050_update_period(st, pf->timestamp, nb);

drivers/iio/proximity/srf04.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int srf04_read(struct srf04_data *data)
110110
udelay(data->cfg->trigger_pulse_us);
111111
gpiod_set_value(data->gpiod_trig, 0);
112112

113-
/* it cannot take more than 20 ms */
113+
/* it should not take more than 20 ms until echo is rising */
114114
ret = wait_for_completion_killable_timeout(&data->rising, HZ/50);
115115
if (ret < 0) {
116116
mutex_unlock(&data->lock);
@@ -120,7 +120,8 @@ static int srf04_read(struct srf04_data *data)
120120
return -ETIMEDOUT;
121121
}
122122

123-
ret = wait_for_completion_killable_timeout(&data->falling, HZ/50);
123+
/* it cannot take more than 50 ms until echo is falling */
124+
ret = wait_for_completion_killable_timeout(&data->falling, HZ/20);
124125
if (ret < 0) {
125126
mutex_unlock(&data->lock);
126127
return ret;
@@ -135,19 +136,19 @@ static int srf04_read(struct srf04_data *data)
135136

136137
dt_ns = ktime_to_ns(ktime_dt);
137138
/*
138-
* measuring more than 3 meters is beyond the capabilities of
139-
* the sensor
139+
* measuring more than 6,45 meters is beyond the capabilities of
140+
* the supported sensors
140141
* ==> filter out invalid results for not measuring echos of
141142
* another us sensor
142143
*
143144
* formula:
144-
* distance 3 m
145-
* time = ---------- = --------- = 9404389 ns
146-
* speed 319 m/s
145+
* distance 6,45 * 2 m
146+
* time = ---------- = ------------ = 40438871 ns
147+
* speed 319 m/s
147148
*
148149
* using a minimum speed at -20 °C of 319 m/s
149150
*/
150-
if (dt_ns > 9404389)
151+
if (dt_ns > 40438871)
151152
return -EIO;
152153

153154
time_ns = dt_ns;
@@ -159,20 +160,20 @@ static int srf04_read(struct srf04_data *data)
159160
* with Temp in °C
160161
* and speed in m/s
161162
*
162-
* use 343 m/s as ultrasonic speed at 20 °C here in absence of the
163+
* use 343,5 m/s as ultrasonic speed at 20 °C here in absence of the
163164
* temperature
164165
*
165166
* therefore:
166-
* time 343
167-
* distance = ------ * -----
168-
* 10^6 2
167+
* time 343,5 time * 106
168+
* distance = ------ * ------- = ------------
169+
* 10^6 2 617176
169170
* with time in ns
170171
* and distance in mm (one way)
171172
*
172-
* because we limit to 3 meters the multiplication with 343 just
173+
* because we limit to 6,45 meters the multiplication with 106 just
173174
* fits into 32 bit
174175
*/
175-
distance_mm = time_ns * 343 / 2000000;
176+
distance_mm = time_ns * 106 / 617176;
176177

177178
return distance_mm;
178179
}

drivers/staging/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,6 @@ source "drivers/staging/exfat/Kconfig"
125125

126126
source "drivers/staging/qlge/Kconfig"
127127

128+
source "drivers/staging/vboxsf/Kconfig"
129+
128130
endif # STAGING

drivers/staging/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ obj-$(CONFIG_UWB) += uwb/
5353
obj-$(CONFIG_USB_WUSB) += wusbcore/
5454
obj-$(CONFIG_EXFAT_FS) += exfat/
5555
obj-$(CONFIG_QLGE) += qlge/
56+
obj-$(CONFIG_VBOXSF_FS) += vboxsf/

drivers/staging/vboxsf/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
config VBOXSF_FS
2+
tristate "VirtualBox guest shared folder (vboxsf) support"
3+
depends on X86 && VBOXGUEST
4+
select NLS
5+
help
6+
VirtualBox hosts can share folders with guests, this driver
7+
implements the Linux-guest side of this allowing folders exported
8+
by the host to be mounted under Linux.
9+
10+
If you want to use shared folders in VirtualBox guests, answer Y or M.

0 commit comments

Comments
 (0)