mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
IIO: 1st set of fixes for the 6.19 cycle
The usual mixed bag of fixes for ancient problems plus some more recent ones. adi,ad7280a - Check for errors from spi_setup(). adi,ad3552r - Fix potential buffer overflow when setting to use the internal ramp. adi,ax5695r - Fill in the data for this device in the chip info table. adi,ad7606 - Don't store a negative error in an unsigned int. adi,ad9467 - Fix incorrect register mask value. adi,adxl380 - Fix inverted condition for whether INT1 interrupt present in dt. atmel,at91-sama5d2 - Cancel work on remove to avoid a potential use-after-free invensense,icm45600 - Fix temperature scaling. samsung,eynos_adc - Use of_platform_depolulate() to correctly clear up such that child devices are created correctly if the driver is rebound. sensiron,scd4x - Fix incorrect endianness reported to user-space. st,accel - Fix gain reported for the iis329dq. st,lsm6dsx - Hide event related interfaces on parts that don't support events. ti,pac1934 - Ensure output of clamp() is used rather than unclamped value. -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmlnV/8RHGppYzIzQGtl cm5lbC5vcmcACgkQVIU0mcT0FojZRQ/8D2xa4+dqIgYt/vofm0HwTgmAF7hGC0an QyCovICaHPGuwILwqb31KfUmrWdrNr8ZKQMfDt/E+dPvoamxRHGTVSkxljb+qGZb WGtjX+bG6HozpnW9wurYpzb9+ANtCX9JejV2YhR8WwbKd9DnHE/rxdiRgbcTAvs0 FDBWh1Kb5xhrKG9QXbNc6Rw8Vs6a7d85Ch3AFPNQhNaWbhqfKG7WrvEUKjt2BlWw W5o31b12QtqiN1zLt38D7XZYUWrpW8KyXWnuF1EhjM2iAEZrEM/bSDTKJULF9w5z 2enuHdef/YM8K5L3CjOVXXzHKpnb1P+9OVh/zIR4gTQTRPij2FYcUmIMXgtGRZLD 82EWi3LuSRgpGCPV+wNJgbICxRk495AXbiyXmGUvbJokTw8Qw3rvtB1KwLsvpQNB M3X5xNbm+Uv3wVePv/lFHN2XsaS+wr4ZDBRyUaTMjxJiXxOxtrLQlE957QfJhjjX 2QjJWCtlstdOgTzYixxhQu63Ysil0WhoziQStWyHppNPHPB4Lqt+cKVu+zgYGcye wScoT4d0eKCOb2fpAX6VahaJBU99Z6BfoHcqp6ciP3hU3EMHoKq1BpqzzwA2X4N8 xstRokij1lVQGi5onMYp7RZpeRLDh/t5WYRTAZ/dyRCq+tOMuj/14SxqV7JoW8aB beIHLX2dnOw= =MjIs -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-6.19a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus Jonathan writes: IIO: 1st set of fixes for the 6.19 cycle The usual mixed bag of fixes for ancient problems plus some more recent ones. adi,ad7280a - Check for errors from spi_setup(). adi,ad3552r - Fix potential buffer overflow when setting to use the internal ramp. adi,ax5695r - Fill in the data for this device in the chip info table. adi,ad7606 - Don't store a negative error in an unsigned int. adi,ad9467 - Fix incorrect register mask value. adi,adxl380 - Fix inverted condition for whether INT1 interrupt present in dt. atmel,at91-sama5d2 - Cancel work on remove to avoid a potential use-after-free invensense,icm45600 - Fix temperature scaling. samsung,eynos_adc - Use of_platform_depolulate() to correctly clear up such that child devices are created correctly if the driver is rebound. sensiron,scd4x - Fix incorrect endianness reported to user-space. st,accel - Fix gain reported for the iis329dq. st,lsm6dsx - Hide event related interfaces on parts that don't support events. ti,pac1934 - Ensure output of clamp() is used rather than unclamped value. * tag 'iio-fixes-for-6.19a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: dac: ad3552r-hs: fix out-of-bound write in ad3552r_hs_write_data_source iio: accel: iis328dq: fix gain values iio: core: add separate lockdep class for info_exist_lock iio: chemical: scd4x: fix reported channel endianness iio: imu: inv_icm45600: fix temperature offset reporting iio: adc: exynos_adc: fix OF populate on driver rebind iio: dac: ad5686: add AD5695R to ad5686_chip_info_tbl iio: accel: adxl380: fix handling of unavailable "INT1" interrupt iio: imu: st_lsm6dsx: fix iio_chan_spec for sensors without event detection iio: adc: pac1934: Fix clamped value in pac1934_reg_snapshot iio: adc: ad9467: fix ad9434 vref mask iio: adc: ad7606: Fix incorrect type for error return variable iio: adc: ad7280a: handle spi_setup() errors in probe() iio: adc: at91-sama5d2_adc: Fix potential use-after-free in sama5d2_adc driver
This commit is contained in:
commit
36a70608a3
|
|
@ -1784,9 +1784,9 @@ static int adxl380_config_irq(struct iio_dev *indio_dev)
|
|||
st->int_map[1] = ADXL380_INT0_MAP1_REG;
|
||||
} else {
|
||||
st->irq = fwnode_irq_get_byname(dev_fwnode(st->dev), "INT1");
|
||||
if (st->irq > 0)
|
||||
return dev_err_probe(st->dev, -ENODEV,
|
||||
"no interrupt name specified");
|
||||
if (st->irq < 0)
|
||||
return dev_err_probe(st->dev, st->irq,
|
||||
"no interrupt name specified\n");
|
||||
st->int_map[0] = ADXL380_INT1_MAP0_REG;
|
||||
st->int_map[1] = ADXL380_INT1_MAP1_REG;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,7 +517,6 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
|
|||
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
|
||||
.sensors_supported = {
|
||||
[0] = H3LIS331DL_ACCEL_DEV_NAME,
|
||||
[1] = IIS328DQ_ACCEL_DEV_NAME,
|
||||
},
|
||||
.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
|
||||
.odr = {
|
||||
|
|
@ -584,6 +583,77 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
|
|||
.multi_read_bit = true,
|
||||
.bootime = 2,
|
||||
},
|
||||
{
|
||||
.wai = 0x32,
|
||||
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
|
||||
.sensors_supported = {
|
||||
[0] = IIS328DQ_ACCEL_DEV_NAME,
|
||||
},
|
||||
.ch = (struct iio_chan_spec *)st_accel_12bit_channels,
|
||||
.odr = {
|
||||
.addr = 0x20,
|
||||
.mask = 0x18,
|
||||
.odr_avl = {
|
||||
{ .hz = 50, .value = 0x00, },
|
||||
{ .hz = 100, .value = 0x01, },
|
||||
{ .hz = 400, .value = 0x02, },
|
||||
{ .hz = 1000, .value = 0x03, },
|
||||
},
|
||||
},
|
||||
.pw = {
|
||||
.addr = 0x20,
|
||||
.mask = 0x20,
|
||||
.value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
|
||||
.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
|
||||
},
|
||||
.enable_axis = {
|
||||
.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
|
||||
.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
|
||||
},
|
||||
.fs = {
|
||||
.addr = 0x23,
|
||||
.mask = 0x30,
|
||||
.fs_avl = {
|
||||
[0] = {
|
||||
.num = ST_ACCEL_FS_AVL_100G,
|
||||
.value = 0x00,
|
||||
.gain = IIO_G_TO_M_S_2(980),
|
||||
},
|
||||
[1] = {
|
||||
.num = ST_ACCEL_FS_AVL_200G,
|
||||
.value = 0x01,
|
||||
.gain = IIO_G_TO_M_S_2(1950),
|
||||
},
|
||||
[2] = {
|
||||
.num = ST_ACCEL_FS_AVL_400G,
|
||||
.value = 0x03,
|
||||
.gain = IIO_G_TO_M_S_2(3910),
|
||||
},
|
||||
},
|
||||
},
|
||||
.bdu = {
|
||||
.addr = 0x23,
|
||||
.mask = 0x80,
|
||||
},
|
||||
.drdy_irq = {
|
||||
.int1 = {
|
||||
.addr = 0x22,
|
||||
.mask = 0x02,
|
||||
},
|
||||
.int2 = {
|
||||
.addr = 0x22,
|
||||
.mask = 0x10,
|
||||
},
|
||||
.addr_ihl = 0x22,
|
||||
.mask_ihl = 0x80,
|
||||
},
|
||||
.sim = {
|
||||
.addr = 0x23,
|
||||
.value = BIT(0),
|
||||
},
|
||||
.multi_read_bit = true,
|
||||
.bootime = 2,
|
||||
},
|
||||
{
|
||||
/* No WAI register present */
|
||||
.sensors_supported = {
|
||||
|
|
|
|||
|
|
@ -1024,7 +1024,9 @@ static int ad7280_probe(struct spi_device *spi)
|
|||
|
||||
st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_HZ;
|
||||
st->spi->mode = SPI_MODE_1;
|
||||
spi_setup(st->spi);
|
||||
ret = spi_setup(st->spi);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
st->ctrl_lb = FIELD_PREP(AD7280A_CTRL_LB_ACQ_TIME_MSK, st->acquisition_time) |
|
||||
FIELD_PREP(AD7280A_CTRL_LB_THERMISTOR_MSK, st->thermistor_term_en);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ static int ad7606_par_bus_setup_iio_backend(struct device *dev,
|
|||
struct iio_dev *indio_dev)
|
||||
{
|
||||
struct ad7606_state *st = iio_priv(indio_dev);
|
||||
unsigned int ret, c;
|
||||
unsigned int c;
|
||||
int ret;
|
||||
struct iio_backend_data_fmt data = {
|
||||
.sign_extend = true,
|
||||
.enable = true,
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
|
||||
#define CHIPID_AD9434 0x6A
|
||||
#define AD9434_DEF_OUTPUT_MODE 0x00
|
||||
#define AD9434_REG_VREF_MASK 0xC0
|
||||
#define AD9434_REG_VREF_MASK GENMASK(4, 0)
|
||||
|
||||
/*
|
||||
* Analog Devices AD9467 16-Bit, 200/250 MSPS ADC
|
||||
|
|
|
|||
|
|
@ -2481,6 +2481,7 @@ static void at91_adc_remove(struct platform_device *pdev)
|
|||
struct at91_adc_state *st = iio_priv(indio_dev);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
cancel_work_sync(&st->touch_st.workq);
|
||||
|
||||
at91_adc_dma_disable(st);
|
||||
|
||||
|
|
|
|||
|
|
@ -540,15 +540,6 @@ static const struct iio_chan_spec exynos_adc_iio_channels[] = {
|
|||
ADC_CHANNEL(9, "adc9"),
|
||||
};
|
||||
|
||||
static int exynos_adc_remove_devices(struct device *dev, void *c)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
|
||||
platform_device_unregister(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int exynos_adc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct exynos_adc *info = NULL;
|
||||
|
|
@ -660,8 +651,7 @@ static int exynos_adc_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
err_of_populate:
|
||||
device_for_each_child(&indio_dev->dev, NULL,
|
||||
exynos_adc_remove_devices);
|
||||
of_platform_depopulate(&indio_dev->dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
err_irq:
|
||||
free_irq(info->irq, info);
|
||||
|
|
@ -681,8 +671,7 @@ static void exynos_adc_remove(struct platform_device *pdev)
|
|||
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
|
||||
struct exynos_adc *info = iio_priv(indio_dev);
|
||||
|
||||
device_for_each_child(&indio_dev->dev, NULL,
|
||||
exynos_adc_remove_devices);
|
||||
of_platform_depopulate(&indio_dev->dev);
|
||||
iio_device_unregister(indio_dev);
|
||||
free_irq(info->irq, info);
|
||||
if (info->data->exit_hw)
|
||||
|
|
|
|||
|
|
@ -665,9 +665,9 @@ static int pac1934_reg_snapshot(struct pac1934_chip_info *info,
|
|||
/* add the power_acc field */
|
||||
curr_energy += inc;
|
||||
|
||||
clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC);
|
||||
|
||||
reg_data->energy_sec_acc[cnt] = curr_energy;
|
||||
reg_data->energy_sec_acc[cnt] = clamp(curr_energy,
|
||||
PAC_193X_MIN_POWER_ACC,
|
||||
PAC_193X_MAX_POWER_ACC);
|
||||
}
|
||||
|
||||
offset_reg_data_p += PAC1934_VPOWER_ACC_REG_LEN;
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
|
|||
.sign = 'u',
|
||||
.realbits = 16,
|
||||
.storagebits = 16,
|
||||
.endianness = IIO_BE,
|
||||
.endianness = IIO_CPU,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -599,7 +599,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
|
|||
.sign = 'u',
|
||||
.realbits = 16,
|
||||
.storagebits = 16,
|
||||
.endianness = IIO_BE,
|
||||
.endianness = IIO_CPU,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -612,7 +612,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
|
|||
.sign = 'u',
|
||||
.realbits = 16,
|
||||
.storagebits = 16,
|
||||
.endianness = IIO_BE,
|
||||
.endianness = IIO_CPU,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -549,12 +549,15 @@ static ssize_t ad3552r_hs_write_data_source(struct file *f,
|
|||
|
||||
guard(mutex)(&st->lock);
|
||||
|
||||
if (count >= sizeof(buf))
|
||||
return -ENOSPC;
|
||||
|
||||
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf,
|
||||
count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
buf[count] = '\0';
|
||||
buf[ret] = '\0';
|
||||
|
||||
ret = match_string(dbgfs_attr_source, ARRAY_SIZE(dbgfs_attr_source),
|
||||
buf);
|
||||
|
|
|
|||
|
|
@ -434,6 +434,12 @@ static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
|
|||
.num_channels = 4,
|
||||
.regmap_type = AD5686_REGMAP,
|
||||
},
|
||||
[ID_AD5695R] = {
|
||||
.channels = ad5685r_channels,
|
||||
.int_vref_mv = 2500,
|
||||
.num_channels = 4,
|
||||
.regmap_type = AD5686_REGMAP,
|
||||
},
|
||||
[ID_AD5696] = {
|
||||
.channels = ad5686_channels,
|
||||
.num_channels = 4,
|
||||
|
|
|
|||
|
|
@ -960,16 +960,17 @@ int inv_icm45600_temp_read_raw(struct iio_dev *indio_dev,
|
|||
return IIO_VAL_INT;
|
||||
/*
|
||||
* T°C = (temp / 128) + 25
|
||||
* Tm°C = 1000 * ((temp * 100 / 12800) + 25)
|
||||
* scale: 100000 / 13248 = 7.8125
|
||||
* offset: 25000
|
||||
* Tm°C = ((temp + 25 * 128) / 128)) * 1000
|
||||
* Tm°C = (temp + 3200) * (1000 / 128)
|
||||
* scale: 1000 / 128 = 7.8125
|
||||
* offset: 3200
|
||||
*/
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
*val = 7;
|
||||
*val2 = 812500;
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
*val = 25000;
|
||||
*val = 3200;
|
||||
return IIO_VAL_INT;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,13 @@ static const struct iio_chan_spec st_lsm6dsx_acc_channels[] = {
|
|||
IIO_CHAN_SOFT_TIMESTAMP(3),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec st_lsm6ds0_acc_channels[] = {
|
||||
ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x28, IIO_MOD_X, 0),
|
||||
ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2a, IIO_MOD_Y, 1),
|
||||
ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2c, IIO_MOD_Z, 2),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(3),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec st_lsm6dsx_gyro_channels[] = {
|
||||
ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x22, IIO_MOD_X, 0),
|
||||
ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x24, IIO_MOD_Y, 1),
|
||||
|
|
@ -142,8 +149,8 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
|||
},
|
||||
.channels = {
|
||||
[ST_LSM6DSX_ID_ACC] = {
|
||||
.chan = st_lsm6dsx_acc_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6dsx_acc_channels),
|
||||
.chan = st_lsm6ds0_acc_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6ds0_acc_channels),
|
||||
},
|
||||
[ST_LSM6DSX_ID_GYRO] = {
|
||||
.chan = st_lsm6ds0_gyro_channels,
|
||||
|
|
@ -1449,8 +1456,8 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
|||
},
|
||||
.channels = {
|
||||
[ST_LSM6DSX_ID_ACC] = {
|
||||
.chan = st_lsm6dsx_acc_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6dsx_acc_channels),
|
||||
.chan = st_lsm6ds0_acc_channels,
|
||||
.len = ARRAY_SIZE(st_lsm6ds0_acc_channels),
|
||||
},
|
||||
[ST_LSM6DSX_ID_GYRO] = {
|
||||
.chan = st_lsm6dsx_gyro_channels,
|
||||
|
|
|
|||
|
|
@ -1657,6 +1657,7 @@ static void iio_dev_release(struct device *device)
|
|||
mutex_destroy(&iio_dev_opaque->info_exist_lock);
|
||||
mutex_destroy(&iio_dev_opaque->mlock);
|
||||
|
||||
lockdep_unregister_key(&iio_dev_opaque->info_exist_key);
|
||||
lockdep_unregister_key(&iio_dev_opaque->mlock_key);
|
||||
|
||||
ida_free(&iio_ida, iio_dev_opaque->id);
|
||||
|
|
@ -1717,9 +1718,10 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
|
|||
INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers);
|
||||
|
||||
lockdep_register_key(&iio_dev_opaque->mlock_key);
|
||||
lockdep_register_key(&iio_dev_opaque->info_exist_key);
|
||||
|
||||
mutex_init_with_key(&iio_dev_opaque->mlock, &iio_dev_opaque->mlock_key);
|
||||
mutex_init(&iio_dev_opaque->info_exist_lock);
|
||||
mutex_init_with_key(&iio_dev_opaque->info_exist_lock, &iio_dev_opaque->info_exist_key);
|
||||
|
||||
indio_dev->dev.parent = parent;
|
||||
indio_dev->dev.type = &iio_device_type;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
* @mlock: lock used to prevent simultaneous device state changes
|
||||
* @mlock_key: lockdep class for iio_dev lock
|
||||
* @info_exist_lock: lock to prevent use during removal
|
||||
* @info_exist_key: lockdep class for info_exist lock
|
||||
* @trig_readonly: mark the current trigger immutable
|
||||
* @event_interface: event chrdevs associated with interrupt lines
|
||||
* @attached_buffers: array of buffers statically attached by the driver
|
||||
|
|
@ -47,6 +48,7 @@ struct iio_dev_opaque {
|
|||
struct mutex mlock;
|
||||
struct lock_class_key mlock_key;
|
||||
struct mutex info_exist_lock;
|
||||
struct lock_class_key info_exist_key;
|
||||
bool trig_readonly;
|
||||
struct iio_event_interface *event_interface;
|
||||
struct iio_buffer **attached_buffers;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user