Commit 8d422b8b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-fixes-for-6.18a' of...

Merge tag 'iio-fixes-for-6.18a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

IIO: Fixes for 6.18 (set 1)

The usual mixed back of brand new and ancient bugs.

dmaengine buffer / core
- Add new callback to allow fetching the providing device for a DMA
  channel. Use this to get the right device for the dmaengine buffer
  implementation.
adi,ad4030
- Fix incorrect _scale value for common-mode channels.
adi,ad7124
- Fix gain and offset for temperature channel.
adi,ad7280a
- Fix a factor of 10 error when setting the balance timer.
adi,ad7380
- Fix sampling frequency to account for need to trigger twice per scan
  for some supported chips.
adi,adxl355
- Ensure a long enough wait after SW reset.
bosch,bmc150
- Fix wrong assumption that interrupts are always available.
bosch,bmp280
- Fix the measurement time calculation.
richtek,rtq6056
- Fix wrong sign bit when sign extending.
samsung,ssp
- Fix cleanup of registered mfd devices on error.
st,lsm6dsx
- Fix wrong sized array for register information.
- Fix a wrong time stamp calculation for some devices.
st,stm32-dfsdm
- Update handling of st,adc-alt-channel to reflect binding change as
  part of moving to iio-backend framework.
ti,hdc3020
- Fix wrong units for temperature and humidity. Also the thresholds
  and hysteresis.

* tag 'iio-fixes-for-6.18a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: accel: bmc150: Fix irq assumption regression
  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
  iio: adc: rtq6056: Correct the sign bit index
  iio: adc: ad4030: Fix _scale value for common-mode channels
parents baadf2a5 3aa385a9
Loading
Loading
Loading
Loading
+39 −5
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@
#define  ADXL355_POWER_CTL_DRDY_MSK	BIT(2)
#define ADXL355_SELF_TEST_REG		0x2E
#define ADXL355_RESET_REG		0x2F
#define ADXL355_BASE_ADDR_SHADOW_REG	0x50
#define ADXL355_SHADOW_REG_COUNT	5

#define ADXL355_DEVID_AD_VAL		0xAD
#define ADXL355_DEVID_MST_VAL		0x1D
@@ -294,7 +296,12 @@ static void adxl355_fill_3db_frequency_table(struct adxl355_data *data)
static int adxl355_setup(struct adxl355_data *data)
{
	unsigned int regval;
	int retries = 5; /* the number is chosen based on empirical reasons */
	int ret;
	u8 *shadow_regs __free(kfree) = kzalloc(ADXL355_SHADOW_REG_COUNT, GFP_KERNEL);

	if (!shadow_regs)
		return -ENOMEM;

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

	/* Read shadow registers to be compared after reset */
	ret = regmap_bulk_read(data->regmap,
			       ADXL355_BASE_ADDR_SHADOW_REG,
			       shadow_regs, ADXL355_SHADOW_REG_COUNT);
	if (ret)
		return ret;

	do {
		if (--retries == 0) {
			dev_err(data->dev, "Shadow registers mismatch\n");
			return -EIO;
		}

		/*
		 * Perform a software reset to make sure the device is in a consistent
		 * state after start-up.
		 */
	ret = regmap_write(data->regmap, ADXL355_RESET_REG, ADXL355_RESET_CODE);
		ret = regmap_write(data->regmap, ADXL355_RESET_REG,
				   ADXL355_RESET_CODE);
		if (ret)
			return ret;

		/* Wait at least 5ms after software reset */
		usleep_range(5000, 10000);

		/* Read shadow registers for comparison */
		ret = regmap_bulk_read(data->regmap,
				       ADXL355_BASE_ADDR_SHADOW_REG,
				       data->buffer.buf,
				       ADXL355_SHADOW_REG_COUNT);
		if (ret)
			return ret;
	} while (memcmp(shadow_regs, data->buffer.buf,
			ADXL355_SHADOW_REG_COUNT));

	ret = regmap_update_bits(data->regmap, ADXL355_POWER_CTL_REG,
				 ADXL355_POWER_CTL_DRDY_MSK,
+5 −0
Original line number Diff line number Diff line
@@ -523,6 +523,10 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i,
	const struct bmc150_accel_interrupt_info *info = intr->info;
	int ret;

	/* We do not always have an IRQ */
	if (data->irq <= 0)
		return 0;

	if (state) {
		if (atomic_inc_return(&intr->users) > 1)
			return 0;
@@ -1696,6 +1700,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
	}

	if (irq > 0) {
		data->irq = irq;
		ret = devm_request_threaded_irq(dev, irq,
						bmc150_accel_irq_handler,
						bmc150_accel_irq_thread_handler,
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ enum bmc150_accel_trigger_id {

struct bmc150_accel_data {
	struct regmap *regmap;
	int irq;
	struct regulator_bulk_data regulators[2];
	struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
	struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
+1 −1
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ static int ad4030_get_chan_scale(struct iio_dev *indio_dev,
	struct ad4030_state *st = iio_priv(indio_dev);
	const struct iio_scan_type *scan_type;

	scan_type = iio_get_current_scan_type(indio_dev, st->chip->channels);
	scan_type = iio_get_current_scan_type(indio_dev, chan);
	if (IS_ERR(scan_type))
		return PTR_ERR(scan_type);

+8 −4
Original line number Diff line number Diff line
@@ -1525,10 +1525,6 @@ static int __ad7124_calibrate_all(struct ad7124_state *st, struct iio_dev *indio
	int ret, i;

	for (i = 0; i < st->num_channels; i++) {

		if (indio_dev->channels[i].type != IIO_VOLTAGE)
			continue;

		/*
		 * For calibration the OFFSET register should hold its reset default
		 * 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
		st->channels[i].cfg.calibration_offset = 0x800000;
		st->channels[i].cfg.calibration_gain = st->gain_default;

		/*
		 * Only the main voltage input channels are important enough
		 * to be automatically calibrated here. For everything else,
		 * just use the default values set above.
		 */
		if (indio_dev->channels[i].type != IIO_VOLTAGE)
			continue;

		/*
		 * Full-scale calibration isn't supported at gain 1, so skip in
		 * that case. Note that untypically full-scale calibration has
Loading