Skip to content

Commit 6cf62f0

Browse files
committed
Merge tag 'char-misc-6.18-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc / IIO fixes from Greg KH: "Here are some much-delayed char/misc/iio driver fixes for 6.18-rc8. Fixes in here include: - lots of iio driver bugfixes for reported issues. - counter driver bugfix - slimbus driver bugfix - mei tiny bugfix - nvmem layout uevent bugfix All of these have been in linux-next for a while, but due to travel on my side, I haven't had a chance to get them to you" * tag 'char-misc-6.18-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (23 commits) nvmem: layouts: fix nvmem_layout_bus_uevent iio: accel: bmc150: Fix irq assumption regression most: usb: fix double free on late probe failure slimbus: ngd: Fix reference count leak in qcom_slim_ngd_notify_slaves firmware: stratix10-svc: fix bug in saving controller data mei: fix error flow in probe iio: st_lsm6dsx: Fixed calibrated timestamp calculation iio: humditiy: hdc3020: fix units for thresholds and hysteresis iio: humditiy: hdc3020: fix units for temperature and humidity measurement iio: imu: st_lsm6dsx: fix array size for st_lsm6dsx_settings fields iio: accel: fix ADXL355 startup race condition iio: adc: ad7124: fix temperature channel iio:common:ssp_sensors: Fix an error handling path ssp_probe() iio: adc: ad7280a: fix ad7280_store_balance_timer() iio: buffer-dmaengine: enable .get_dma_dev() iio: buffer-dma: support getting the DMA channel iio: buffer: support getting dma channel from the buffer iio: pressure: bmp280: correct meas_time_us calculation iio: adc: stm32-dfsdm: fix st,adc-alt-channel property handling iio: adc: ad7380: fix SPI offload trigger rate ...
2 parents dabf127 + 03bc483 commit 6cf62f0

27 files changed

Lines changed: 214 additions & 113 deletions

drivers/counter/microchip-tcb-capture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ static void mchp_tc_irq_remove(void *ptr)
451451
static int mchp_tc_irq_enable(struct counter_device *const counter, int irq)
452452
{
453453
struct mchp_tc_data *const priv = counter_priv(counter);
454-
int ret = devm_request_irq(counter->parent, irq, mchp_tc_isr, 0,
454+
int ret = devm_request_irq(counter->parent, irq, mchp_tc_isr, IRQF_SHARED,
455455
dev_name(counter->parent), counter);
456456

457457
if (ret < 0)

drivers/firmware/stratix10-svc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct stratix10_svc_data {
134134
* @complete_status: state for completion
135135
* @svc_fifo_lock: protect access to service message data queue
136136
* @invoke_fn: function to issue secure monitor call or hypervisor call
137+
* @svc: manages the list of client svc drivers
137138
*
138139
* This struct is used to create communication channels for service clients, to
139140
* handle secure monitor or hypervisor call.
@@ -150,6 +151,7 @@ struct stratix10_svc_controller {
150151
struct completion complete_status;
151152
spinlock_t svc_fifo_lock;
152153
svc_invoke_fn *invoke_fn;
154+
struct stratix10_svc *svc;
153155
};
154156

155157
/**
@@ -1206,6 +1208,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12061208
ret = -ENOMEM;
12071209
goto err_free_kfifo;
12081210
}
1211+
controller->svc = svc;
12091212

12101213
svc->stratix10_svc_rsu = platform_device_alloc(STRATIX10_RSU, 0);
12111214
if (!svc->stratix10_svc_rsu) {
@@ -1237,8 +1240,6 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12371240
if (ret)
12381241
goto err_unregister_fcs_dev;
12391242

1240-
dev_set_drvdata(dev, svc);
1241-
12421243
pr_info("Intel Service Layer Driver Initialized\n");
12431244

12441245
return 0;
@@ -1256,8 +1257,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12561257

12571258
static void stratix10_svc_drv_remove(struct platform_device *pdev)
12581259
{
1259-
struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
12601260
struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
1261+
struct stratix10_svc *svc = ctrl->svc;
12611262

12621263
of_platform_depopulate(ctrl->dev);
12631264

drivers/iio/accel/adxl355_core.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
#define ADXL355_POWER_CTL_DRDY_MSK BIT(2)
5757
#define ADXL355_SELF_TEST_REG 0x2E
5858
#define ADXL355_RESET_REG 0x2F
59+
#define ADXL355_BASE_ADDR_SHADOW_REG 0x50
60+
#define ADXL355_SHADOW_REG_COUNT 5
5961

6062
#define ADXL355_DEVID_AD_VAL 0xAD
6163
#define ADXL355_DEVID_MST_VAL 0x1D
@@ -294,7 +296,12 @@ static void adxl355_fill_3db_frequency_table(struct adxl355_data *data)
294296
static int adxl355_setup(struct adxl355_data *data)
295297
{
296298
unsigned int regval;
299+
int retries = 5; /* the number is chosen based on empirical reasons */
297300
int ret;
301+
u8 *shadow_regs __free(kfree) = kzalloc(ADXL355_SHADOW_REG_COUNT, GFP_KERNEL);
302+
303+
if (!shadow_regs)
304+
return -ENOMEM;
298305

299306
ret = regmap_read(data->regmap, ADXL355_DEVID_AD_REG, &regval);
300307
if (ret)
@@ -321,14 +328,41 @@ static int adxl355_setup(struct adxl355_data *data)
321328
if (regval != ADXL355_PARTID_VAL)
322329
dev_warn(data->dev, "Invalid DEV ID 0x%02x\n", regval);
323330

324-
/*
325-
* Perform a software reset to make sure the device is in a consistent
326-
* state after start-up.
327-
*/
328-
ret = regmap_write(data->regmap, ADXL355_RESET_REG, ADXL355_RESET_CODE);
331+
/* Read shadow registers to be compared after reset */
332+
ret = regmap_bulk_read(data->regmap,
333+
ADXL355_BASE_ADDR_SHADOW_REG,
334+
shadow_regs, ADXL355_SHADOW_REG_COUNT);
329335
if (ret)
330336
return ret;
331337

338+
do {
339+
if (--retries == 0) {
340+
dev_err(data->dev, "Shadow registers mismatch\n");
341+
return -EIO;
342+
}
343+
344+
/*
345+
* Perform a software reset to make sure the device is in a consistent
346+
* state after start-up.
347+
*/
348+
ret = regmap_write(data->regmap, ADXL355_RESET_REG,
349+
ADXL355_RESET_CODE);
350+
if (ret)
351+
return ret;
352+
353+
/* Wait at least 5ms after software reset */
354+
usleep_range(5000, 10000);
355+
356+
/* Read shadow registers for comparison */
357+
ret = regmap_bulk_read(data->regmap,
358+
ADXL355_BASE_ADDR_SHADOW_REG,
359+
data->buffer.buf,
360+
ADXL355_SHADOW_REG_COUNT);
361+
if (ret)
362+
return ret;
363+
} while (memcmp(shadow_regs, data->buffer.buf,
364+
ADXL355_SHADOW_REG_COUNT));
365+
332366
ret = regmap_update_bits(data->regmap, ADXL355_POWER_CTL_REG,
333367
ADXL355_POWER_CTL_DRDY_MSK,
334368
FIELD_PREP(ADXL355_POWER_CTL_DRDY_MSK, 1));

drivers/iio/accel/bmc150-accel-core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i,
523523
const struct bmc150_accel_interrupt_info *info = intr->info;
524524
int ret;
525525

526+
/* We do not always have an IRQ */
527+
if (data->irq <= 0)
528+
return 0;
529+
526530
if (state) {
527531
if (atomic_inc_return(&intr->users) > 1)
528532
return 0;
@@ -1696,6 +1700,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
16961700
}
16971701

16981702
if (irq > 0) {
1703+
data->irq = irq;
16991704
ret = devm_request_threaded_irq(dev, irq,
17001705
bmc150_accel_irq_handler,
17011706
bmc150_accel_irq_thread_handler,

drivers/iio/accel/bmc150-accel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ enum bmc150_accel_trigger_id {
5858

5959
struct bmc150_accel_data {
6060
struct regmap *regmap;
61+
int irq;
6162
struct regulator_bulk_data regulators[2];
6263
struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
6364
struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];

drivers/iio/adc/ad4030.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static int ad4030_get_chan_scale(struct iio_dev *indio_dev,
385385
struct ad4030_state *st = iio_priv(indio_dev);
386386
const struct iio_scan_type *scan_type;
387387

388-
scan_type = iio_get_current_scan_type(indio_dev, st->chip->channels);
388+
scan_type = iio_get_current_scan_type(indio_dev, chan);
389389
if (IS_ERR(scan_type))
390390
return PTR_ERR(scan_type);
391391

drivers/iio/adc/ad7124.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,10 +1525,6 @@ static int __ad7124_calibrate_all(struct ad7124_state *st, struct iio_dev *indio
15251525
int ret, i;
15261526

15271527
for (i = 0; i < st->num_channels; i++) {
1528-
1529-
if (indio_dev->channels[i].type != IIO_VOLTAGE)
1530-
continue;
1531-
15321528
/*
15331529
* For calibration the OFFSET register should hold its reset default
15341530
* value. For the GAIN register there is no such requirement but
@@ -1538,6 +1534,14 @@ static int __ad7124_calibrate_all(struct ad7124_state *st, struct iio_dev *indio
15381534
st->channels[i].cfg.calibration_offset = 0x800000;
15391535
st->channels[i].cfg.calibration_gain = st->gain_default;
15401536

1537+
/*
1538+
* Only the main voltage input channels are important enough
1539+
* to be automatically calibrated here. For everything else,
1540+
* just use the default values set above.
1541+
*/
1542+
if (indio_dev->channels[i].type != IIO_VOLTAGE)
1543+
continue;
1544+
15411545
/*
15421546
* Full-scale calibration isn't supported at gain 1, so skip in
15431547
* that case. Note that untypically full-scale calibration has

drivers/iio/adc/ad7280a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static ssize_t ad7280_store_balance_timer(struct iio_dev *indio_dev,
541541
int val, val2;
542542
int ret;
543543

544-
ret = iio_str_to_fixpoint(buf, 1000, &val, &val2);
544+
ret = iio_str_to_fixpoint(buf, 100, &val, &val2);
545545
if (ret)
546546
return ret;
547547

drivers/iio/adc/ad7380.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,14 @@ static int ad7380_offload_buffer_postenable(struct iio_dev *indio_dev)
12271227
if (ret)
12281228
return ret;
12291229

1230+
/*
1231+
* When the sequencer is required to read all channels, we need to
1232+
* trigger twice per sample period in order to read one complete set
1233+
* of samples.
1234+
*/
1235+
if (st->seq)
1236+
config.periodic.frequency_hz *= 2;
1237+
12301238
ret = spi_offload_trigger_enable(st->offload, st->offload_trigger, &config);
12311239
if (ret)
12321240
spi_unoptimize_message(&st->offload_msg);

drivers/iio/adc/rtq6056.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static int rtq6056_adc_read_channel(struct rtq6056_priv *priv,
300300
return IIO_VAL_INT;
301301
case RTQ6056_REG_SHUNTVOLT:
302302
case RTQ6056_REG_CURRENT:
303-
*val = sign_extend32(regval, 16);
303+
*val = sign_extend32(regval, 15);
304304
return IIO_VAL_INT;
305305
default:
306306
return -EINVAL;

0 commit comments

Comments
 (0)