Commit 4bffd2c7 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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

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

Jonathan writes:

1st set of IIO fixes for 6.3

Usual mixed bag:

- core - output buffers
  Fix return of bytes written when only some succeed.
  Fix O_NONBLOCK handling to not block.

- adi,ad7791
  Fix IRQ type.  Not confirmed to have any impact but good to correct it anyway

- adi,adis16400
  Missing CONFIG_CRC32

- capella,cm32181
  Unregister 2nd I2C client if one is used.

- cio-dac
  Fix bitdepth for range check on write.

- linear,ltc2497
  Fix a wrong shift of the LSB introduced when switching to be24 handling.

- maxim,max11410
  Fix handling of return code in read_poll_timeout()

- qcom,spmi-adc
  Fix an accidental change of channel name to include the reg value from OF.

- ti,palmas
  Fix a null dereference on remove due to wrong function used to get the
  drvdata.

- ti,ads7950
  Mark GPIO as can sleep.

* tag 'iio-fixes-for-6.3a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip
  iio: adc: palmas_gpadc: fix NULL dereference on rmmod
  iio: adc: max11410: fix read_poll_timeout() usage
  iio: dac: cio-dac: Fix max DAC write value check for 12-bit
  iio: light: cm32181: Unregister second I2C client if present
  iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler
  iio: adc: ad7791: fix IRQ flags
  iio: buffer: make sure O_NONBLOCK is respected
  iio: buffer: correctly return bytes written in output buffers
  iio: light: vcnl4000: Fix WARN_ON on uninitialized lock
  iio: adis16480: select CONFIG_CRC32
  drivers: iio: adc: ltc2497: fix LSB shift
  iio: adc: qcom-spmi-adc5: Fix the channel name
parents 4dd52392 363c7dc7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
	if (ret < 0)
		goto err_read;

	iio_push_to_buffers_with_timestamp(idev, data->buffer, pf->timestamp);
	iio_push_to_buffers_with_timestamp(idev, data->buffer, data->timestamp);
err_read:
	iio_trigger_notify_done(idev->trig);

+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ static const struct ad_sigma_delta_info ad7791_sigma_delta_info = {
	.has_registers = true,
	.addr_shift = 4,
	.read_mask = BIT(3),
	.irq_flags = IRQF_TRIGGER_LOW,
	.irq_flags = IRQF_TRIGGER_FALLING,
};

static int ad7791_read_raw(struct iio_dev *indio_dev,
+2 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ struct ltc2497_driverdata {
	struct ltc2497core_driverdata common_ddata;
	struct i2c_client *client;
	u32 recv_size;
	u32 sub_lsb;
	/*
	 * DMA (thus cache coherency maintenance) may require the
	 * transfer buffers to live in their own cache lines.
@@ -65,10 +64,10 @@ static int ltc2497_result_and_measure(struct ltc2497core_driverdata *ddata,
		 * equivalent to a sign extension.
		 */
		if (st->recv_size == 3) {
			*val = (get_unaligned_be24(st->data.d8) >> st->sub_lsb)
			*val = (get_unaligned_be24(st->data.d8) >> 6)
				- BIT(ddata->chip_info->resolution + 1);
		} else {
			*val = (be32_to_cpu(st->data.d32) >> st->sub_lsb)
			*val = (be32_to_cpu(st->data.d32) >> 6)
				- BIT(ddata->chip_info->resolution + 1);
		}

@@ -122,7 +121,6 @@ static int ltc2497_probe(struct i2c_client *client)
	st->common_ddata.chip_info = chip_info;

	resolution = chip_info->resolution;
	st->sub_lsb = 31 - (resolution + 1);
	st->recv_size = BITS_TO_BYTES(resolution) + 1;

	return ltc2497core_probe(dev, indio_dev);
+15 −7
Original line number Diff line number Diff line
@@ -414,13 +414,17 @@ static int max11410_sample(struct max11410_state *st, int *sample_raw,
		if (!ret)
			return -ETIMEDOUT;
	} else {
		int ret2;

		/* Wait for status register Conversion Ready flag */
		ret = read_poll_timeout(max11410_read_reg, ret,
					ret || (val & MAX11410_STATUS_CONV_READY_BIT),
		ret = read_poll_timeout(max11410_read_reg, ret2,
					ret2 || (val & MAX11410_STATUS_CONV_READY_BIT),
					5000, MAX11410_CONVERSION_TIMEOUT_MS * 1000,
					true, st, MAX11410_REG_STATUS, &val);
		if (ret)
			return ret;
		if (ret2)
			return ret2;
	}

	/* Read ADC Data */
@@ -851,17 +855,21 @@ static int max11410_init_vref(struct device *dev,

static int max11410_calibrate(struct max11410_state *st, u32 cal_type)
{
	int ret, val;
	int ret, ret2, val;

	ret = max11410_write_reg(st, MAX11410_REG_CAL_START, cal_type);
	if (ret)
		return ret;

	/* Wait for status register Calibration Ready flag */
	return read_poll_timeout(max11410_read_reg, ret,
				 ret || (val & MAX11410_STATUS_CAL_READY_BIT),
	ret = read_poll_timeout(max11410_read_reg, ret2,
				ret2 || (val & MAX11410_STATUS_CAL_READY_BIT),
				50000, MAX11410_CALIB_TIMEOUT_MS * 1000, true,
				st, MAX11410_REG_STATUS, &val);
	if (ret)
		return ret;

	return ret2;
}

static int max11410_self_calibrate(struct max11410_state *st)
+1 −1
Original line number Diff line number Diff line
@@ -639,7 +639,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev)

static int palmas_gpadc_remove(struct platform_device *pdev)
{
	struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev);
	struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev);
	struct palmas_gpadc *adc = iio_priv(indio_dev);

	if (adc->wakeup1_enable || adc->wakeup2_enable)
Loading