Skip to content

Commit a0652eb

Browse files
committed
Merge tag 'char-misc-6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc driver fixes from Greg KH: "Here are a small number of various driver fixes for 6.7-rc7 that normally come through the char-misc tree, and one debugfs fix as well. Included in here are: - iio and hid sensor driver fixes for a number of small things - interconnect driver fixes - brcm_nvmem driver fixes - debugfs fix for previous fix - guard() definition in device.h so that many subsystems can start using it for 6.8-rc1 (requested by Dan Williams to make future merges easier) All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-6.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits) debugfs: initialize cancellations earlier Revert "iio: hid-sensor-als: Add light color temperature support" Revert "iio: hid-sensor-als: Add light chromaticity support" nvmem: brcm_nvram: store a copy of NVRAM content dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp driver core: Add a guard() definition for the device_lock() interconnect: qcom: icc-rpm: Fix peak rate calculation iio: adc: MCP3564: fix hardware identification logic iio: adc: MCP3564: fix calib_bias and calib_scale range checks iio: adc: meson: add separate config for axg SoC family iio: adc: imx93: add four channels for imx93 adc iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() interconnect: qcom: sm8250: Enable sync_state iio: triggered-buffer: prevent possible freeing of wrong buffer iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw iio: imu: adis16475: use bit numbers in assign_bit() iio: imu: adis16475: add spi_device_id table iio: tmag5273: fix temperature offset interconnect: Treat xlate() returning NULL node as an error iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table ...
2 parents fa655ab + 159f5bd commit a0652eb

File tree

19 files changed

+254
-218
lines changed

19 files changed

+254
-218
lines changed

Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ allOf:
1515

1616
properties:
1717
compatible:
18-
enum:
19-
- fsl,imx23-ocotp
20-
- fsl,imx28-ocotp
18+
items:
19+
- enum:
20+
- fsl,imx23-ocotp
21+
- fsl,imx28-ocotp
22+
- const: fsl,ocotp
2123

2224
reg:
2325
maxItems: 1
@@ -35,7 +37,7 @@ unevaluatedProperties: false
3537
examples:
3638
- |
3739
ocotp: efuse@8002c000 {
38-
compatible = "fsl,imx28-ocotp";
40+
compatible = "fsl,imx28-ocotp", "fsl,ocotp";
3941
#address-cells = <1>;
4042
#size-cells = <1>;
4143
reg = <0x8002c000 0x2000>;

drivers/iio/accel/kionix-kx022a.c

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -393,17 +393,17 @@ static const unsigned int kx022a_odrs[] = {
393393
* (range / 2^bits) * g = (range / 2^bits) * 9.80665 m/s^2
394394
* => KX022A uses 16 bit (HiRes mode - assume the low 8 bits are zeroed
395395
* in low-power mode(?) )
396-
* => +/-2G => 4 / 2^16 * 9,80665 * 10^6 (to scale to micro)
397-
* => +/-2G - 598.550415
398-
* +/-4G - 1197.10083
399-
* +/-8G - 2394.20166
400-
* +/-16G - 4788.40332
396+
* => +/-2G => 4 / 2^16 * 9,80665
397+
* => +/-2G - 0.000598550415
398+
* +/-4G - 0.00119710083
399+
* +/-8G - 0.00239420166
400+
* +/-16G - 0.00478840332
401401
*/
402402
static const int kx022a_scale_table[][2] = {
403-
{ 598, 550415 },
404-
{ 1197, 100830 },
405-
{ 2394, 201660 },
406-
{ 4788, 403320 },
403+
{ 0, 598550 },
404+
{ 0, 1197101 },
405+
{ 0, 2394202 },
406+
{ 0, 4788403 },
407407
};
408408

409409
static int kx022a_read_avail(struct iio_dev *indio_dev,
@@ -422,7 +422,7 @@ static int kx022a_read_avail(struct iio_dev *indio_dev,
422422
*vals = (const int *)kx022a_scale_table;
423423
*length = ARRAY_SIZE(kx022a_scale_table) *
424424
ARRAY_SIZE(kx022a_scale_table[0]);
425-
*type = IIO_VAL_INT_PLUS_MICRO;
425+
*type = IIO_VAL_INT_PLUS_NANO;
426426
return IIO_AVAIL_LIST;
427427
default:
428428
return -EINVAL;
@@ -485,6 +485,20 @@ static int kx022a_turn_on_unlock(struct kx022a_data *data)
485485
return ret;
486486
}
487487

488+
static int kx022a_write_raw_get_fmt(struct iio_dev *idev,
489+
struct iio_chan_spec const *chan,
490+
long mask)
491+
{
492+
switch (mask) {
493+
case IIO_CHAN_INFO_SCALE:
494+
return IIO_VAL_INT_PLUS_NANO;
495+
case IIO_CHAN_INFO_SAMP_FREQ:
496+
return IIO_VAL_INT_PLUS_MICRO;
497+
default:
498+
return -EINVAL;
499+
}
500+
}
501+
488502
static int kx022a_write_raw(struct iio_dev *idev,
489503
struct iio_chan_spec const *chan,
490504
int val, int val2, long mask)
@@ -629,7 +643,7 @@ static int kx022a_read_raw(struct iio_dev *idev,
629643

630644
kx022a_reg2scale(regval, val, val2);
631645

632-
return IIO_VAL_INT_PLUS_MICRO;
646+
return IIO_VAL_INT_PLUS_NANO;
633647
}
634648

635649
return -EINVAL;
@@ -856,6 +870,7 @@ static int kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples)
856870
static const struct iio_info kx022a_info = {
857871
.read_raw = &kx022a_read_raw,
858872
.write_raw = &kx022a_write_raw,
873+
.write_raw_get_fmt = &kx022a_write_raw_get_fmt,
859874
.read_avail = &kx022a_read_avail,
860875

861876
.validate_trigger = iio_validate_own_trigger,

drivers/iio/adc/imx93_adc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ static const struct iio_chan_spec imx93_adc_iio_channels[] = {
9393
IMX93_ADC_CHAN(1),
9494
IMX93_ADC_CHAN(2),
9595
IMX93_ADC_CHAN(3),
96+
IMX93_ADC_CHAN(4),
97+
IMX93_ADC_CHAN(5),
98+
IMX93_ADC_CHAN(6),
99+
IMX93_ADC_CHAN(7),
96100
};
97101

98102
static void imx93_adc_power_down(struct imx93_adc *adc)

drivers/iio/adc/mcp3564.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ static int mcp3564_write_raw(struct iio_dev *indio_dev,
918918
mutex_unlock(&adc->lock);
919919
return ret;
920920
case IIO_CHAN_INFO_CALIBBIAS:
921-
if (val < mcp3564_calib_bias[0] && val > mcp3564_calib_bias[2])
921+
if (val < mcp3564_calib_bias[0] || val > mcp3564_calib_bias[2])
922922
return -EINVAL;
923923

924924
mutex_lock(&adc->lock);
@@ -928,7 +928,7 @@ static int mcp3564_write_raw(struct iio_dev *indio_dev,
928928
mutex_unlock(&adc->lock);
929929
return ret;
930930
case IIO_CHAN_INFO_CALIBSCALE:
931-
if (val < mcp3564_calib_scale[0] && val > mcp3564_calib_scale[2])
931+
if (val < mcp3564_calib_scale[0] || val > mcp3564_calib_scale[2])
932932
return -EINVAL;
933933

934934
if (adc->calib_scale == val)
@@ -1122,7 +1122,7 @@ static int mcp3564_config(struct iio_dev *indio_dev)
11221122
enum mcp3564_ids ids;
11231123
int ret = 0;
11241124
unsigned int tmp = 0x01;
1125-
bool err = true;
1125+
bool err = false;
11261126

11271127
/*
11281128
* The address is set on a per-device basis by fuses in the factory,
@@ -1509,5 +1509,5 @@ static struct spi_driver mcp3564_driver = {
15091509
module_spi_driver(mcp3564_driver);
15101510

15111511
MODULE_AUTHOR("Marius Cristea <marius.cristea@microchip.com>");
1512-
MODULE_DESCRIPTION("Microchip MCP346x/MCP346xR and MCP356x/MCP346xR ADCs");
1512+
MODULE_DESCRIPTION("Microchip MCP346x/MCP346xR and MCP356x/MCP356xR ADCs");
15131513
MODULE_LICENSE("GPL v2");

drivers/iio/adc/meson_saradc.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,20 @@ static const struct meson_sar_adc_param meson_sar_adc_gxl_param = {
12411241
.cmv_select = 1,
12421242
};
12431243

1244+
static const struct meson_sar_adc_param meson_sar_adc_axg_param = {
1245+
.has_bl30_integration = true,
1246+
.clock_rate = 1200000,
1247+
.bandgap_reg = MESON_SAR_ADC_REG11,
1248+
.regmap_config = &meson_sar_adc_regmap_config_gxbb,
1249+
.resolution = 12,
1250+
.disable_ring_counter = 1,
1251+
.has_reg11 = true,
1252+
.vref_volatge = 1,
1253+
.has_vref_select = true,
1254+
.vref_select = VREF_VDDA,
1255+
.cmv_select = 1,
1256+
};
1257+
12441258
static const struct meson_sar_adc_param meson_sar_adc_g12a_param = {
12451259
.has_bl30_integration = false,
12461260
.clock_rate = 1200000,
@@ -1285,7 +1299,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxm_data = {
12851299
};
12861300

12871301
static const struct meson_sar_adc_data meson_sar_adc_axg_data = {
1288-
.param = &meson_sar_adc_gxl_param,
1302+
.param = &meson_sar_adc_axg_param,
12891303
.name = "meson-axg-saradc",
12901304
};
12911305

drivers/iio/adc/ti_am335x_adc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,10 @@ static int tiadc_probe(struct platform_device *pdev)
670670
platform_set_drvdata(pdev, indio_dev);
671671

672672
err = tiadc_request_dma(pdev, adc_dev);
673-
if (err && err == -EPROBE_DEFER)
673+
if (err && err != -ENODEV) {
674+
dev_err_probe(&pdev->dev, err, "DMA request failed\n");
674675
goto err_dma;
676+
}
675677

676678
return 0;
677679

drivers/iio/buffer/industrialio-triggered-buffer.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev,
4646
struct iio_buffer *buffer;
4747
int ret;
4848

49+
/*
50+
* iio_triggered_buffer_cleanup() assumes that the buffer allocated here
51+
* is assigned to indio_dev->buffer but this is only the case if this
52+
* function is the first caller to iio_device_attach_buffer(). If
53+
* indio_dev->buffer is already set then we can't proceed otherwise the
54+
* cleanup function will try to free a buffer that was not allocated here.
55+
*/
56+
if (indio_dev->buffer)
57+
return -EADDRINUSE;
58+
4959
buffer = iio_kfifo_allocate();
5060
if (!buffer) {
5161
ret = -ENOMEM;

drivers/iio/common/ms_sensors/ms_sensors_i2c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
/* Conversion times in us */
1616
static const u16 ms_sensors_ht_t_conversion_time[] = { 50000, 25000,
1717
13000, 7000 };
18-
static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 3000,
19-
5000, 8000 };
18+
static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 5000,
19+
3000, 8000 };
2020
static const u16 ms_sensors_tp_conversion_time[] = { 500, 1100, 2100,
2121
4100, 8220, 16440 };
2222

drivers/iio/imu/adis16475.c

Lines changed: 74 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
#define ADIS16475_MAX_SCAN_DATA 20
7171
/* spi max speed in brust mode */
7272
#define ADIS16475_BURST_MAX_SPEED 1000000
73-
#define ADIS16475_LSB_DEC_MASK BIT(0)
74-
#define ADIS16475_LSB_FIR_MASK BIT(1)
73+
#define ADIS16475_LSB_DEC_MASK 0
74+
#define ADIS16475_LSB_FIR_MASK 1
7575
#define ADIS16500_BURST_DATA_SEL_0_CHN_MASK GENMASK(5, 0)
7676
#define ADIS16500_BURST_DATA_SEL_1_CHN_MASK GENMASK(12, 7)
7777

@@ -1406,50 +1406,6 @@ static int adis16475_config_irq_pin(struct adis16475 *st)
14061406
return 0;
14071407
}
14081408

1409-
static const struct of_device_id adis16475_of_match[] = {
1410-
{ .compatible = "adi,adis16470",
1411-
.data = &adis16475_chip_info[ADIS16470] },
1412-
{ .compatible = "adi,adis16475-1",
1413-
.data = &adis16475_chip_info[ADIS16475_1] },
1414-
{ .compatible = "adi,adis16475-2",
1415-
.data = &adis16475_chip_info[ADIS16475_2] },
1416-
{ .compatible = "adi,adis16475-3",
1417-
.data = &adis16475_chip_info[ADIS16475_3] },
1418-
{ .compatible = "adi,adis16477-1",
1419-
.data = &adis16475_chip_info[ADIS16477_1] },
1420-
{ .compatible = "adi,adis16477-2",
1421-
.data = &adis16475_chip_info[ADIS16477_2] },
1422-
{ .compatible = "adi,adis16477-3",
1423-
.data = &adis16475_chip_info[ADIS16477_3] },
1424-
{ .compatible = "adi,adis16465-1",
1425-
.data = &adis16475_chip_info[ADIS16465_1] },
1426-
{ .compatible = "adi,adis16465-2",
1427-
.data = &adis16475_chip_info[ADIS16465_2] },
1428-
{ .compatible = "adi,adis16465-3",
1429-
.data = &adis16475_chip_info[ADIS16465_3] },
1430-
{ .compatible = "adi,adis16467-1",
1431-
.data = &adis16475_chip_info[ADIS16467_1] },
1432-
{ .compatible = "adi,adis16467-2",
1433-
.data = &adis16475_chip_info[ADIS16467_2] },
1434-
{ .compatible = "adi,adis16467-3",
1435-
.data = &adis16475_chip_info[ADIS16467_3] },
1436-
{ .compatible = "adi,adis16500",
1437-
.data = &adis16475_chip_info[ADIS16500] },
1438-
{ .compatible = "adi,adis16505-1",
1439-
.data = &adis16475_chip_info[ADIS16505_1] },
1440-
{ .compatible = "adi,adis16505-2",
1441-
.data = &adis16475_chip_info[ADIS16505_2] },
1442-
{ .compatible = "adi,adis16505-3",
1443-
.data = &adis16475_chip_info[ADIS16505_3] },
1444-
{ .compatible = "adi,adis16507-1",
1445-
.data = &adis16475_chip_info[ADIS16507_1] },
1446-
{ .compatible = "adi,adis16507-2",
1447-
.data = &adis16475_chip_info[ADIS16507_2] },
1448-
{ .compatible = "adi,adis16507-3",
1449-
.data = &adis16475_chip_info[ADIS16507_3] },
1450-
{ },
1451-
};
1452-
MODULE_DEVICE_TABLE(of, adis16475_of_match);
14531409

14541410
static int adis16475_probe(struct spi_device *spi)
14551411
{
@@ -1463,7 +1419,7 @@ static int adis16475_probe(struct spi_device *spi)
14631419

14641420
st = iio_priv(indio_dev);
14651421

1466-
st->info = device_get_match_data(&spi->dev);
1422+
st->info = spi_get_device_match_data(spi);
14671423
if (!st->info)
14681424
return -EINVAL;
14691425

@@ -1503,12 +1459,83 @@ static int adis16475_probe(struct spi_device *spi)
15031459
return 0;
15041460
}
15051461

1462+
static const struct of_device_id adis16475_of_match[] = {
1463+
{ .compatible = "adi,adis16470",
1464+
.data = &adis16475_chip_info[ADIS16470] },
1465+
{ .compatible = "adi,adis16475-1",
1466+
.data = &adis16475_chip_info[ADIS16475_1] },
1467+
{ .compatible = "adi,adis16475-2",
1468+
.data = &adis16475_chip_info[ADIS16475_2] },
1469+
{ .compatible = "adi,adis16475-3",
1470+
.data = &adis16475_chip_info[ADIS16475_3] },
1471+
{ .compatible = "adi,adis16477-1",
1472+
.data = &adis16475_chip_info[ADIS16477_1] },
1473+
{ .compatible = "adi,adis16477-2",
1474+
.data = &adis16475_chip_info[ADIS16477_2] },
1475+
{ .compatible = "adi,adis16477-3",
1476+
.data = &adis16475_chip_info[ADIS16477_3] },
1477+
{ .compatible = "adi,adis16465-1",
1478+
.data = &adis16475_chip_info[ADIS16465_1] },
1479+
{ .compatible = "adi,adis16465-2",
1480+
.data = &adis16475_chip_info[ADIS16465_2] },
1481+
{ .compatible = "adi,adis16465-3",
1482+
.data = &adis16475_chip_info[ADIS16465_3] },
1483+
{ .compatible = "adi,adis16467-1",
1484+
.data = &adis16475_chip_info[ADIS16467_1] },
1485+
{ .compatible = "adi,adis16467-2",
1486+
.data = &adis16475_chip_info[ADIS16467_2] },
1487+
{ .compatible = "adi,adis16467-3",
1488+
.data = &adis16475_chip_info[ADIS16467_3] },
1489+
{ .compatible = "adi,adis16500",
1490+
.data = &adis16475_chip_info[ADIS16500] },
1491+
{ .compatible = "adi,adis16505-1",
1492+
.data = &adis16475_chip_info[ADIS16505_1] },
1493+
{ .compatible = "adi,adis16505-2",
1494+
.data = &adis16475_chip_info[ADIS16505_2] },
1495+
{ .compatible = "adi,adis16505-3",
1496+
.data = &adis16475_chip_info[ADIS16505_3] },
1497+
{ .compatible = "adi,adis16507-1",
1498+
.data = &adis16475_chip_info[ADIS16507_1] },
1499+
{ .compatible = "adi,adis16507-2",
1500+
.data = &adis16475_chip_info[ADIS16507_2] },
1501+
{ .compatible = "adi,adis16507-3",
1502+
.data = &adis16475_chip_info[ADIS16507_3] },
1503+
{ },
1504+
};
1505+
MODULE_DEVICE_TABLE(of, adis16475_of_match);
1506+
1507+
static const struct spi_device_id adis16475_ids[] = {
1508+
{ "adis16470", (kernel_ulong_t)&adis16475_chip_info[ADIS16470] },
1509+
{ "adis16475-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_1] },
1510+
{ "adis16475-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_2] },
1511+
{ "adis16475-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_3] },
1512+
{ "adis16477-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_1] },
1513+
{ "adis16477-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_2] },
1514+
{ "adis16477-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_3] },
1515+
{ "adis16465-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_1] },
1516+
{ "adis16465-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_2] },
1517+
{ "adis16465-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_3] },
1518+
{ "adis16467-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_1] },
1519+
{ "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] },
1520+
{ "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] },
1521+
{ "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] },
1522+
{ "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] },
1523+
{ "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] },
1524+
{ "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] },
1525+
{ "adis16507-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_1] },
1526+
{ "adis16507-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_2] },
1527+
{ "adis16507-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_3] },
1528+
{ }
1529+
};
1530+
MODULE_DEVICE_TABLE(spi, adis16475_ids);
1531+
15061532
static struct spi_driver adis16475_driver = {
15071533
.driver = {
15081534
.name = "adis16475",
15091535
.of_match_table = adis16475_of_match,
15101536
},
15111537
.probe = adis16475_probe,
1538+
.id_table = adis16475_ids,
15121539
};
15131540
module_spi_driver(adis16475_driver);
15141541

drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
750750
ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
751751
chan->channel2, val);
752752
mutex_unlock(&st->lock);
753-
return IIO_VAL_INT;
753+
return ret;
754754
case IIO_ACCEL:
755755
mutex_lock(&st->lock);
756756
ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
757757
chan->channel2, val);
758758
mutex_unlock(&st->lock);
759-
return IIO_VAL_INT;
759+
return ret;
760760

761761
default:
762762
return -EINVAL;

0 commit comments

Comments
 (0)