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

Changed files
+126 -30
drivers
+1
drivers/comedi/drivers/comedi_8255.c
··· 159 159 return -ENOMEM; 160 160 161 161 spriv->context = context; 162 + spriv->io = io; 162 163 163 164 s->type = COMEDI_SUBD_DIO; 164 165 s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
+26 -4
drivers/comedi/drivers/comedi_test.c
··· 87 87 struct comedi_device *dev; /* parent comedi device */ 88 88 u64 ao_last_scan_time; /* time of previous AO scan in usec */ 89 89 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? */ 90 92 unsigned short ao_loopbacks[N_CHANS]; 91 93 }; 92 94 ··· 238 236 time_increment = devpriv->ai_convert_time - now; 239 237 else 240 238 time_increment = 1; 241 - mod_timer(&devpriv->ai_timer, 242 - jiffies + usecs_to_jiffies(time_increment)); 239 + spin_lock(&dev->spinlock); 240 + if (devpriv->ai_timer_enable) { 241 + mod_timer(&devpriv->ai_timer, 242 + jiffies + usecs_to_jiffies(time_increment)); 243 + } 244 + spin_unlock(&dev->spinlock); 243 245 } 244 246 245 247 overrun: ··· 399 393 * Seem to need an extra jiffy here, otherwise timer expires slightly 400 394 * early! 401 395 */ 396 + spin_lock_bh(&dev->spinlock); 397 + devpriv->ai_timer_enable = true; 402 398 devpriv->ai_timer.expires = 403 399 jiffies + usecs_to_jiffies(devpriv->ai_convert_period) + 1; 404 400 add_timer(&devpriv->ai_timer); 401 + spin_unlock_bh(&dev->spinlock); 405 402 return 0; 406 403 } 407 404 ··· 413 404 { 414 405 struct waveform_private *devpriv = dev->private; 415 406 407 + spin_lock_bh(&dev->spinlock); 408 + devpriv->ai_timer_enable = false; 409 + spin_unlock_bh(&dev->spinlock); 416 410 if (in_softirq()) { 417 411 /* Assume we were called from the timer routine itself. */ 418 412 del_timer(&devpriv->ai_timer); ··· 507 495 unsigned int time_inc = devpriv->ao_last_scan_time + 508 496 devpriv->ao_scan_period - now; 509 497 510 - mod_timer(&devpriv->ao_timer, 511 - jiffies + usecs_to_jiffies(time_inc)); 498 + spin_lock(&dev->spinlock); 499 + if (devpriv->ao_timer_enable) { 500 + mod_timer(&devpriv->ao_timer, 501 + jiffies + usecs_to_jiffies(time_inc)); 502 + } 503 + spin_unlock(&dev->spinlock); 512 504 } 513 505 514 506 underrun: ··· 533 517 async->inttrig = NULL; 534 518 535 519 devpriv->ao_last_scan_time = ktime_to_us(ktime_get()); 520 + spin_lock_bh(&dev->spinlock); 521 + devpriv->ao_timer_enable = true; 536 522 devpriv->ao_timer.expires = 537 523 jiffies + usecs_to_jiffies(devpriv->ao_scan_period); 538 524 add_timer(&devpriv->ao_timer); 525 + spin_unlock_bh(&dev->spinlock); 539 526 540 527 return 1; 541 528 } ··· 623 604 struct waveform_private *devpriv = dev->private; 624 605 625 606 s->async->inttrig = NULL; 607 + spin_lock_bh(&dev->spinlock); 608 + devpriv->ao_timer_enable = false; 609 + spin_unlock_bh(&dev->spinlock); 626 610 if (in_softirq()) { 627 611 /* Assume we were called from the timer routine itself. */ 628 612 del_timer(&devpriv->ao_timer);
+4 -3
drivers/counter/counter-core.c
··· 31 31 struct counter_device counter; 32 32 33 33 /* 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). 36 37 */ 37 - unsigned long privdata[] ____cacheline_aligned; 38 + unsigned long privdata[] __aligned(ARCH_DMA_MINALIGN); 38 39 }; 39 40 40 41 static void counter_device_release(struct device *dev)
+6 -2
drivers/iio/accel/adxl367.c
··· 1429 1429 unsigned int val; 1430 1430 int ret; 1431 1431 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); 1434 1433 if (ret) 1434 + return dev_err_probe(st->dev, ret, "Failed to read dev id\n"); 1435 + 1436 + if (val != ADXL367_DEVID_AD) 1435 1437 return dev_err_probe(st->dev, -ENODEV, 1436 1438 "Invalid dev id 0x%02X, expected 0x%02X\n", 1437 1439 val, ADXL367_DEVID_AD); ··· 1511 1509 ret = regmap_write(st->regmap, ADXL367_REG_RESET, ADXL367_RESET_CODE); 1512 1510 if (ret) 1513 1511 return ret; 1512 + 1513 + fsleep(15000); 1514 1514 1515 1515 ret = adxl367_verify_devid(st); 1516 1516 if (ret)
+1 -1
drivers/iio/accel/adxl367_i2c.c
··· 11 11 12 12 #include "adxl367.h" 13 13 14 - #define ADXL367_I2C_FIFO_DATA 0x42 14 + #define ADXL367_I2C_FIFO_DATA 0x18 15 15 16 16 struct adxl367_i2c_state { 17 17 struct regmap *regmap;
+2
drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
··· 109 109 /* compute and process only all complete datum */ 110 110 nb = fifo_count / bytes_per_datum; 111 111 fifo_count = nb * bytes_per_datum; 112 + if (nb == 0) 113 + goto end_session; 112 114 /* Each FIFO data contains all sensors, so same number for FIFO and sensor data */ 113 115 fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider); 114 116 inv_sensors_timestamp_interrupt(&st->timestamp, fifo_period, nb, nb, pf->timestamp);
+5
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
··· 111 111 if (enable) { 112 112 /* reset timestamping */ 113 113 inv_sensors_timestamp_reset(&st->timestamp); 114 + inv_sensors_timestamp_apply_odr(&st->timestamp, 0, 0, 0); 114 115 /* reset FIFO */ 115 116 d = st->chip_config.user_ctrl | INV_MPU6050_BIT_FIFO_RST; 116 117 ret = regmap_write(st->map, st->reg->user_ctrl, d); ··· 185 184 if (result) 186 185 goto error_power_off; 187 186 } else { 187 + st->chip_config.gyro_fifo_enable = 0; 188 + st->chip_config.accl_fifo_enable = 0; 189 + st->chip_config.temp_fifo_enable = 0; 190 + st->chip_config.magn_fifo_enable = 0; 188 191 result = inv_mpu6050_prepare_fifo(st, false); 189 192 if (result) 190 193 goto error_power_off;
+49 -1
drivers/iio/pressure/bmp280-spi.c
··· 4 4 * 5 5 * Inspired by the older BMP085 driver drivers/misc/bmp085-spi.c 6 6 */ 7 + #include <linux/bits.h> 7 8 #include <linux/module.h> 8 9 #include <linux/spi/spi.h> 9 10 #include <linux/err.h> ··· 36 35 return spi_write_then_read(spi, reg, reg_size, val, val_size); 37 36 } 38 37 38 + static int bmp380_regmap_spi_read(void *context, const void *reg, 39 + size_t reg_size, void *val, size_t val_size) 40 + { 41 + struct spi_device *spi = to_spi_device(context); 42 + u8 rx_buf[4]; 43 + ssize_t status; 44 + 45 + /* 46 + * Maximum number of consecutive bytes read for a temperature or 47 + * pressure measurement is 3. 48 + */ 49 + if (val_size > 3) 50 + return -EINVAL; 51 + 52 + /* 53 + * According to the BMP3xx datasheets, for a basic SPI read opertion, 54 + * the first byte needs to be dropped and the rest are the requested 55 + * data. 56 + */ 57 + status = spi_write_then_read(spi, reg, 1, rx_buf, val_size + 1); 58 + if (status) 59 + return status; 60 + 61 + memcpy(val, rx_buf + 1, val_size); 62 + 63 + return 0; 64 + } 65 + 39 66 static struct regmap_bus bmp280_regmap_bus = { 40 67 .write = bmp280_regmap_spi_write, 41 68 .read = bmp280_regmap_spi_read, 69 + .reg_format_endian_default = REGMAP_ENDIAN_BIG, 70 + .val_format_endian_default = REGMAP_ENDIAN_BIG, 71 + }; 72 + 73 + static struct regmap_bus bmp380_regmap_bus = { 74 + .write = bmp280_regmap_spi_write, 75 + .read = bmp380_regmap_spi_read, 76 + .read_flag_mask = BIT(7), 42 77 .reg_format_endian_default = REGMAP_ENDIAN_BIG, 43 78 .val_format_endian_default = REGMAP_ENDIAN_BIG, 44 79 }; ··· 83 46 { 84 47 const struct spi_device_id *id = spi_get_device_id(spi); 85 48 const struct bmp280_chip_info *chip_info; 49 + struct regmap_bus *bmp_regmap_bus; 86 50 struct regmap *regmap; 87 51 int ret; 88 52 ··· 96 58 97 59 chip_info = spi_get_device_match_data(spi); 98 60 61 + switch (chip_info->chip_id[0]) { 62 + case BMP380_CHIP_ID: 63 + case BMP390_CHIP_ID: 64 + bmp_regmap_bus = &bmp380_regmap_bus; 65 + break; 66 + default: 67 + bmp_regmap_bus = &bmp280_regmap_bus; 68 + break; 69 + } 70 + 99 71 regmap = devm_regmap_init(&spi->dev, 100 - &bmp280_regmap_bus, 72 + bmp_regmap_bus, 101 73 &spi->dev, 102 74 chip_info->regmap_config); 103 75 if (IS_ERR(regmap)) {
+3 -4
drivers/iio/pressure/dlhl60d.c
··· 250 250 struct dlh_state *st = iio_priv(indio_dev); 251 251 int ret; 252 252 unsigned int chn, i = 0; 253 - __be32 tmp_buf[2]; 253 + __be32 tmp_buf[2] = { }; 254 254 255 255 ret = dlh_start_capture_and_read(st); 256 256 if (ret) 257 257 goto out; 258 258 259 259 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++], 262 262 &st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, 263 263 DLH_NUM_DATA_BYTES); 264 - i++; 265 264 } 266 265 267 266 iio_push_to_buffers(indio_dev, tmp_buf);
+6 -4
drivers/misc/fastrpc.c
··· 263 263 int domain_id; 264 264 int sesscount; 265 265 int vmcount; 266 - u64 perms; 267 266 struct qcom_scm_vmperm vmperms[FASTRPC_MAX_VMIDS]; 268 267 struct rpmsg_device *rpdev; 269 268 struct fastrpc_session_ctx session[FASTRPC_MAX_SESSIONS]; ··· 1278 1279 1279 1280 /* Map if we have any heap VMIDs associated with this ADSP Static Process. */ 1280 1281 if (fl->cctx->vmcount) { 1282 + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS); 1283 + 1281 1284 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, 1282 1285 (u64)fl->cctx->remote_heap->size, 1283 - &fl->cctx->perms, 1286 + &src_perms, 1284 1287 fl->cctx->vmperms, fl->cctx->vmcount); 1285 1288 if (err) { 1286 1289 dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d", ··· 1916 1915 1917 1916 /* Add memory to static PD pool, protection thru hypervisor */ 1918 1917 if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { 1918 + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS); 1919 + 1919 1920 err = qcom_scm_assign_mem(buf->phys, (u64)buf->size, 1920 - &fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount); 1921 + &src_perms, fl->cctx->vmperms, fl->cctx->vmcount); 1921 1922 if (err) { 1922 1923 dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", 1923 1924 buf->phys, buf->size, err); ··· 2293 2290 2294 2291 if (vmcount) { 2295 2292 data->vmcount = vmcount; 2296 - data->perms = BIT(QCOM_SCM_VMID_HLOS); 2297 2293 for (i = 0; i < data->vmcount; i++) { 2298 2294 data->vmperms[i].vmid = vmids[i]; 2299 2295 data->vmperms[i].perm = QCOM_SCM_PERM_RWX;
+13 -8
drivers/misc/lis3lv02d/lis3lv02d_i2c.c
··· 198 198 struct i2c_client *client = to_i2c_client(dev); 199 199 struct lis3lv02d *lis3 = i2c_get_clientdata(client); 200 200 201 - if (!lis3->pdata || !lis3->pdata->wakeup_flags) 201 + /* Turn on for wakeup if turned off by runtime suspend */ 202 + if (lis3->pdata && lis3->pdata->wakeup_flags) { 203 + if (pm_runtime_suspended(dev)) 204 + lis3lv02d_poweron(lis3); 205 + /* For non wakeup turn off if not already turned off by runtime suspend */ 206 + } else if (!pm_runtime_suspended(dev)) 202 207 lis3lv02d_poweroff(lis3); 208 + 203 209 return 0; 204 210 } 205 211 ··· 214 208 struct i2c_client *client = to_i2c_client(dev); 215 209 struct lis3lv02d *lis3 = i2c_get_clientdata(client); 216 210 217 - /* 218 - * pm_runtime documentation says that devices should always 219 - * be powered on at resume. Pm_runtime turns them off after system 220 - * wide resume is complete. 221 - */ 222 - if (!lis3->pdata || !lis3->pdata->wakeup_flags || 223 - pm_runtime_suspended(dev)) 211 + /* Turn back off if turned on for wakeup and runtime suspended*/ 212 + if (lis3->pdata && lis3->pdata->wakeup_flags) { 213 + if (pm_runtime_suspended(dev)) 214 + lis3lv02d_poweroff(lis3); 215 + /* For non wakeup turn back on if not runtime suspended */ 216 + } else if (!pm_runtime_suspended(dev)) 224 217 lis3lv02d_poweron(lis3); 225 218 226 219 return 0;
+5 -3
drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c
··· 96 96 * 97 97 * The function checks if the device is pci device and 98 98 * Intel VGA adapter, the subcomponent is SW Proxy 99 - * and the parent of MEI PCI and the parent of VGA are the same PCH device. 99 + * and the VGA is on the bus 0 reserved for built-in devices 100 + * to reject discrete GFX. 100 101 * 101 102 * @dev: master device 102 103 * @subcomponent: subcomponent to match (I915_COMPONENT_SWPROXY) ··· 124 123 if (subcomponent != I915_COMPONENT_GSC_PROXY) 125 124 return 0; 126 125 127 - return component_compare_dev(dev->parent, ((struct device *)data)->parent); 126 + /* Only built-in GFX */ 127 + return (pdev->bus->number == 0); 128 128 } 129 129 130 130 static int mei_gsc_proxy_probe(struct mei_cl_device *cldev, ··· 148 146 } 149 147 150 148 component_match_add_typed(&cldev->dev, &master_match, 151 - mei_gsc_proxy_component_match, cldev->dev.parent); 149 + mei_gsc_proxy_component_match, NULL); 152 150 if (IS_ERR_OR_NULL(master_match)) { 153 151 ret = -ENOMEM; 154 152 goto err_exit;
+2
drivers/misc/mei/hw-me-regs.h
··· 112 112 #define MEI_DEV_ID_RPL_S 0x7A68 /* Raptor Lake Point S */ 113 113 114 114 #define MEI_DEV_ID_MTL_M 0x7E70 /* Meteor Lake Point M */ 115 + #define MEI_DEV_ID_ARL_S 0x7F68 /* Arrow Lake Point S */ 116 + #define MEI_DEV_ID_ARL_H 0x7770 /* Arrow Lake Point H */ 115 117 116 118 /* 117 119 * MEI HW Section
+2
drivers/misc/mei/pci-me.c
··· 119 119 {MEI_PCI_DEVICE(MEI_DEV_ID_RPL_S, MEI_ME_PCH15_CFG)}, 120 120 121 121 {MEI_PCI_DEVICE(MEI_DEV_ID_MTL_M, MEI_ME_PCH15_CFG)}, 122 + {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_S, MEI_ME_PCH15_CFG)}, 123 + {MEI_PCI_DEVICE(MEI_DEV_ID_ARL_H, MEI_ME_PCH15_CFG)}, 122 124 123 125 /* required last entry */ 124 126 {0, }
+1
drivers/misc/mei/vsc-tp.c
··· 535 535 { "INTC1009" }, /* Raptor Lake */ 536 536 { "INTC1058" }, /* Tiger Lake */ 537 537 { "INTC1094" }, /* Alder Lake */ 538 + { "INTC10D0" }, /* Meteor Lake */ 538 539 {} 539 540 }; 540 541 MODULE_DEVICE_TABLE(acpi, vsc_tp_acpi_ids);