Skip to content

Commit 10d48d7

Browse files
committed
Merge tag 'char-misc-6.8-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are a few small char/misc and other driver subsystem fixes for reported issues that have been in my tree. Included in here are fixes for: - iio driver fixes for reported problems - much reported bugfix for a lis3lv02d_i2c regression - comedi driver bugfix - mei new device ids - mei driver fixes - counter core fix All of these have been in linux-next with no reported issues, some for many weeks" * tag 'char-misc-6.8-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: mei: gsc_proxy: match component when GSC is on different bus misc: fastrpc: Pass proper arguments to scm call comedi: comedi_test: Prevent timers rescheduling during deletion comedi: comedi_8255: Correct error in subdevice initialization misc: lis3lv02d_i2c: Fix regulators getting en-/dis-abled twice on suspend/resume iio: accel: adxl367: fix I2C FIFO data register iio: accel: adxl367: fix DEVID read after reset iio: pressure: dlhl60d: Initialize empty DLH bytes iio: imu: inv_mpu6050: fix frequency setting when chip is off iio: pressure: Fixes BMP38x and BMP390 SPI support iio: imu: inv_mpu6050: fix FIFO parsing when empty mei: Add Meteor Lake support for IVSC device mei: me: add arrow lake point H DID mei: me: add arrow lake point S DID counter: fix privdata alignment
2 parents 563c5b0 + a0776c2 commit 10d48d7

File tree

15 files changed

+126
-30
lines changed

15 files changed

+126
-30
lines changed

drivers/comedi/drivers/comedi_8255.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static int __subdev_8255_init(struct comedi_device *dev,
159159
return -ENOMEM;
160160

161161
spriv->context = context;
162+
spriv->io = io;
162163

163164
s->type = COMEDI_SUBD_DIO;
164165
s->subdev_flags = SDF_READABLE | SDF_WRITABLE;

drivers/comedi/drivers/comedi_test.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ struct waveform_private {
8787
struct comedi_device *dev; /* parent comedi device */
8888
u64 ao_last_scan_time; /* time of previous AO scan in usec */
8989
unsigned int ao_scan_period; /* AO scan period in usec */
90+
bool ai_timer_enable:1; /* should AI timer be running? */
91+
bool ao_timer_enable:1; /* should AO timer be running? */
9092
unsigned short ao_loopbacks[N_CHANS];
9193
};
9294

@@ -236,8 +238,12 @@ static void waveform_ai_timer(struct timer_list *t)
236238
time_increment = devpriv->ai_convert_time - now;
237239
else
238240
time_increment = 1;
239-
mod_timer(&devpriv->ai_timer,
240-
jiffies + usecs_to_jiffies(time_increment));
241+
spin_lock(&dev->spinlock);
242+
if (devpriv->ai_timer_enable) {
243+
mod_timer(&devpriv->ai_timer,
244+
jiffies + usecs_to_jiffies(time_increment));
245+
}
246+
spin_unlock(&dev->spinlock);
241247
}
242248

243249
overrun:
@@ -393,9 +399,12 @@ static int waveform_ai_cmd(struct comedi_device *dev,
393399
* Seem to need an extra jiffy here, otherwise timer expires slightly
394400
* early!
395401
*/
402+
spin_lock_bh(&dev->spinlock);
403+
devpriv->ai_timer_enable = true;
396404
devpriv->ai_timer.expires =
397405
jiffies + usecs_to_jiffies(devpriv->ai_convert_period) + 1;
398406
add_timer(&devpriv->ai_timer);
407+
spin_unlock_bh(&dev->spinlock);
399408
return 0;
400409
}
401410

@@ -404,6 +413,9 @@ static int waveform_ai_cancel(struct comedi_device *dev,
404413
{
405414
struct waveform_private *devpriv = dev->private;
406415

416+
spin_lock_bh(&dev->spinlock);
417+
devpriv->ai_timer_enable = false;
418+
spin_unlock_bh(&dev->spinlock);
407419
if (in_softirq()) {
408420
/* Assume we were called from the timer routine itself. */
409421
del_timer(&devpriv->ai_timer);
@@ -495,8 +507,12 @@ static void waveform_ao_timer(struct timer_list *t)
495507
unsigned int time_inc = devpriv->ao_last_scan_time +
496508
devpriv->ao_scan_period - now;
497509

498-
mod_timer(&devpriv->ao_timer,
499-
jiffies + usecs_to_jiffies(time_inc));
510+
spin_lock(&dev->spinlock);
511+
if (devpriv->ao_timer_enable) {
512+
mod_timer(&devpriv->ao_timer,
513+
jiffies + usecs_to_jiffies(time_inc));
514+
}
515+
spin_unlock(&dev->spinlock);
500516
}
501517

502518
underrun:
@@ -517,9 +533,12 @@ static int waveform_ao_inttrig_start(struct comedi_device *dev,
517533
async->inttrig = NULL;
518534

519535
devpriv->ao_last_scan_time = ktime_to_us(ktime_get());
536+
spin_lock_bh(&dev->spinlock);
537+
devpriv->ao_timer_enable = true;
520538
devpriv->ao_timer.expires =
521539
jiffies + usecs_to_jiffies(devpriv->ao_scan_period);
522540
add_timer(&devpriv->ao_timer);
541+
spin_unlock_bh(&dev->spinlock);
523542

524543
return 1;
525544
}
@@ -604,6 +623,9 @@ static int waveform_ao_cancel(struct comedi_device *dev,
604623
struct waveform_private *devpriv = dev->private;
605624

606625
s->async->inttrig = NULL;
626+
spin_lock_bh(&dev->spinlock);
627+
devpriv->ao_timer_enable = false;
628+
spin_unlock_bh(&dev->spinlock);
607629
if (in_softirq()) {
608630
/* Assume we were called from the timer routine itself. */
609631
del_timer(&devpriv->ao_timer);

drivers/counter/counter-core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ struct counter_device_allochelper {
3131
struct counter_device counter;
3232

3333
/*
34-
* This is cache line aligned to ensure private data behaves like if it
35-
* were kmalloced separately.
34+
* This ensures private data behaves like if it were kmalloced
35+
* separately. Also ensures the minimum alignment for safe DMA
36+
* operations (which may or may not mean cache alignment).
3637
*/
37-
unsigned long privdata[] ____cacheline_aligned;
38+
unsigned long privdata[] __aligned(ARCH_DMA_MINALIGN);
3839
};
3940

4041
static void counter_device_release(struct device *dev)

drivers/iio/accel/adxl367.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,9 +1429,11 @@ static int adxl367_verify_devid(struct adxl367_state *st)
14291429
unsigned int val;
14301430
int ret;
14311431

1432-
ret = regmap_read_poll_timeout(st->regmap, ADXL367_REG_DEVID, val,
1433-
val == ADXL367_DEVID_AD, 1000, 10000);
1432+
ret = regmap_read(st->regmap, ADXL367_REG_DEVID, &val);
14341433
if (ret)
1434+
return dev_err_probe(st->dev, ret, "Failed to read dev id\n");
1435+
1436+
if (val != ADXL367_DEVID_AD)
14351437
return dev_err_probe(st->dev, -ENODEV,
14361438
"Invalid dev id 0x%02X, expected 0x%02X\n",
14371439
val, ADXL367_DEVID_AD);
@@ -1510,6 +1512,8 @@ int adxl367_probe(struct device *dev, const struct adxl367_ops *ops,
15101512
if (ret)
15111513
return ret;
15121514

1515+
fsleep(15000);
1516+
15131517
ret = adxl367_verify_devid(st);
15141518
if (ret)
15151519
return ret;

drivers/iio/accel/adxl367_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "adxl367.h"
1313

14-
#define ADXL367_I2C_FIFO_DATA 0x42
14+
#define ADXL367_I2C_FIFO_DATA 0x18
1515

1616
struct adxl367_i2c_state {
1717
struct regmap *regmap;

drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
109109
/* compute and process only all complete datum */
110110
nb = fifo_count / bytes_per_datum;
111111
fifo_count = nb * bytes_per_datum;
112+
if (nb == 0)
113+
goto end_session;
112114
/* Each FIFO data contains all sensors, so same number for FIFO and sensor data */
113115
fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
114116
inv_sensors_timestamp_interrupt(&st->timestamp, fifo_period, nb, nb, pf->timestamp);

drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ int inv_mpu6050_prepare_fifo(struct inv_mpu6050_state *st, bool enable)
111111
if (enable) {
112112
/* reset timestamping */
113113
inv_sensors_timestamp_reset(&st->timestamp);
114+
inv_sensors_timestamp_apply_odr(&st->timestamp, 0, 0, 0);
114115
/* reset FIFO */
115116
d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST;
116117
ret = regmap_write(st->map, st->reg->user_ctrl, d);
@@ -184,6 +185,10 @@ static int inv_mpu6050_set_enable(struct iio_dev *indio_dev, bool enable)
184185
if (result)
185186
goto error_power_off;
186187
} else {
188+
st->chip_config.gyro_fifo_enable = 0;
189+
st->chip_config.accl_fifo_enable = 0;
190+
st->chip_config.temp_fifo_enable = 0;
191+
st->chip_config.magn_fifo_enable = 0;
187192
result = inv_mpu6050_prepare_fifo(st, false);
188193
if (result)
189194
goto error_power_off;

drivers/iio/pressure/bmp280-spi.c

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
* Inspired by the older BMP085 driver drivers/misc/bmp085-spi.c
66
*/
7+
#include <linux/bits.h>
78
#include <linux/module.h>
89
#include <linux/spi/spi.h>
910
#include <linux/err.h>
@@ -35,17 +36,54 @@ static int bmp280_regmap_spi_read(void *context, const void *reg,
3536
return spi_write_then_read(spi, reg, reg_size, val, val_size);
3637
}
3738

39+
static int bmp380_regmap_spi_read(void *context, const void *reg,
40+
size_t reg_size, void *val, size_t val_size)
41+
{
42+
struct spi_device *spi = to_spi_device(context);
43+
u8 rx_buf[4];
44+
ssize_t status;
45+
46+
/*
47+
* Maximum number of consecutive bytes read for a temperature or
48+
* pressure measurement is 3.
49+
*/
50+
if (val_size > 3)
51+
return -EINVAL;
52+
53+
/*
54+
* According to the BMP3xx datasheets, for a basic SPI read opertion,
55+
* the first byte needs to be dropped and the rest are the requested
56+
* data.
57+
*/
58+
status = spi_write_then_read(spi, reg, 1, rx_buf, val_size + 1);
59+
if (status)
60+
return status;
61+
62+
memcpy(val, rx_buf + 1, val_size);
63+
64+
return 0;
65+
}
66+
3867
static struct regmap_bus bmp280_regmap_bus = {
3968
.write = bmp280_regmap_spi_write,
4069
.read = bmp280_regmap_spi_read,
4170
.reg_format_endian_default = REGMAP_ENDIAN_BIG,
4271
.val_format_endian_default = REGMAP_ENDIAN_BIG,
4372
};
4473

74+
static struct regmap_bus bmp380_regmap_bus = {
75+
.write = bmp280_regmap_spi_write,
76+
.read = bmp380_regmap_spi_read,
77+
.read_flag_mask = BIT(7),
78+
.reg_format_endian_default = REGMAP_ENDIAN_BIG,
79+
.val_format_endian_default = REGMAP_ENDIAN_BIG,
80+
};
81+
4582
static int bmp280_spi_probe(struct spi_device *spi)
4683
{
4784
const struct spi_device_id *id = spi_get_device_id(spi);
4885
const struct bmp280_chip_info *chip_info;
86+
struct regmap_bus *bmp_regmap_bus;
4987
struct regmap *regmap;
5088
int ret;
5189

@@ -58,8 +96,18 @@ static int bmp280_spi_probe(struct spi_device *spi)
5896

5997
chip_info = spi_get_device_match_data(spi);
6098

99+
switch (chip_info->chip_id[0]) {
100+
case BMP380_CHIP_ID:
101+
case BMP390_CHIP_ID:
102+
bmp_regmap_bus = &bmp380_regmap_bus;
103+
break;
104+
default:
105+
bmp_regmap_bus = &bmp280_regmap_bus;
106+
break;
107+
}
108+
61109
regmap = devm_regmap_init(&spi->dev,
62-
&bmp280_regmap_bus,
110+
bmp_regmap_bus,
63111
&spi->dev,
64112
chip_info->regmap_config);
65113
if (IS_ERR(regmap)) {

drivers/iio/pressure/dlhl60d.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,17 @@ static irqreturn_t dlh_trigger_handler(int irq, void *private)
250250
struct dlh_state *st = iio_priv(indio_dev);
251251
int ret;
252252
unsigned int chn, i = 0;
253-
__be32 tmp_buf[2];
253+
__be32 tmp_buf[2] = { };
254254

255255
ret = dlh_start_capture_and_read(st);
256256
if (ret)
257257
goto out;
258258

259259
for_each_set_bit(chn, indio_dev->active_scan_mask,
260-
indio_dev->masklength) {
261-
memcpy(tmp_buf + i,
260+
indio_dev->masklength) {
261+
memcpy(&tmp_buf[i++],
262262
&st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES,
263263
DLH_NUM_DATA_BYTES);
264-
i++;
265264
}
266265

267266
iio_push_to_buffers(indio_dev, tmp_buf);

drivers/misc/fastrpc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ struct fastrpc_channel_ctx {
263263
int domain_id;
264264
int sesscount;
265265
int vmcount;
266-
u64 perms;
267266
struct qcom_scm_vmperm vmperms[FASTRPC_MAX_VMIDS];
268267
struct rpmsg_device *rpdev;
269268
struct fastrpc_session_ctx session[FASTRPC_MAX_SESSIONS];
@@ -1279,9 +1278,11 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
12791278

12801279
/* Map if we have any heap VMIDs associated with this ADSP Static Process. */
12811280
if (fl->cctx->vmcount) {
1281+
u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
1282+
12821283
err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
12831284
(u64)fl->cctx->remote_heap->size,
1284-
&fl->cctx->perms,
1285+
&src_perms,
12851286
fl->cctx->vmperms, fl->cctx->vmcount);
12861287
if (err) {
12871288
dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
@@ -1915,8 +1916,10 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
19151916

19161917
/* Add memory to static PD pool, protection thru hypervisor */
19171918
if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
1919+
u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
1920+
19181921
err = qcom_scm_assign_mem(buf->phys, (u64)buf->size,
1919-
&fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount);
1922+
&src_perms, fl->cctx->vmperms, fl->cctx->vmcount);
19201923
if (err) {
19211924
dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
19221925
buf->phys, buf->size, err);
@@ -2290,7 +2293,6 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
22902293

22912294
if (vmcount) {
22922295
data->vmcount = vmcount;
2293-
data->perms = BIT(QCOM_SCM_VMID_HLOS);
22942296
for (i = 0; i < data->vmcount; i++) {
22952297
data->vmperms[i].vmid = vmids[i];
22962298
data->vmperms[i].perm = QCOM_SCM_PERM_RWX;

0 commit comments

Comments
 (0)