Commit fda05730 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files
Pull set of IIO fixes for 5.18 from Jonathan Cameron:
  "1st set of IIO fixes for the 5.18 cycle

  ad3552r:
   - Fix a bug with error codes being stored in unsigned local variable.
   - Fix IS_ERR when value is either NULL or not rather than ERR_PTR
  ad5446
   - Fix shifting of read_raw value.
  ad5592r
   - Fix missing return value being set for a fwnode property read.
  ad7280a
   - Wrong variable being used to set thresholds.
  admv8818
   - Kconfig dependency fix.
  ak8975
   - Missing regulator disable in error path.
  bmi160
   - Disable regulators in an error path.
  dac5571
   - Fix chip id detection for devices with OF bindings.
  inv_icm42600
   - Handle a case of a missing I2C NACK during initially configuration.
  ltc2688
   - Fix voltage scaling where integer part was written twice and
     decimal part not at all.
  scd4x
   - Handle error before using value.
  sx9310
   - Device property parsing against indio_dev->dev.of_node which
     hasn't been set yet.
  sx9324
   - Fix hardware gain related maths.
   - Wrong defaults for precharge internal resistance register."

* tag 'iio-fixes-for-5.18a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: imu: inv_icm42600: Fix I2C init possible nack
  iio: dac: ltc2688: fix voltage scale read
  iio:dac:ad3552r: Fix an IS_ERR() vs NULL check
  iio: sx9324: Fix default precharge internal resistance register
  iio: dac: ad5446: Fix read_raw not returning set value
  iio: magnetometer: ak8975: Fix the error handling in ak8975_power_on()
  iio:proximity:sx9324: Fix hardware gain read/write
  iio:proximity:sx_common: Fix device property parsing on DT systems
  iio: adc: ad7280a: Fix wrong variable used when setting thresholds.
  iio:filter:admv8818: select REGMAP_SPI for ADMV8818
  iio: dac: ad5592r: Fix the missing return value.
  iio: dac: dac5571: Fix chip id detection for OF devices
  iio:imu:bmi160: disable regulator in error path
  iio: scd4x: check return of scd4x_write_and_fetch
  iio: dac: ad3552r: fix signedness bug in ad3552r_reset()
parents 5b47b751 b5d6ba09
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -745,7 +745,7 @@ static int ad7280a_write_thresh(struct iio_dev *indio_dev,
		case IIO_EV_DIR_RISING:
			addr = AD7280A_CELL_OVERVOLTAGE_REG;
			ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
					   1, val);
					   1, value);
			if (ret)
				break;
			st->cell_threshhigh = value;
@@ -753,7 +753,7 @@ static int ad7280a_write_thresh(struct iio_dev *indio_dev,
		case IIO_EV_DIR_FALLING:
			addr = AD7280A_CELL_UNDERVOLTAGE_REG;
			ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
					   1, val);
					   1, value);
			if (ret)
				break;
			st->cell_threshlow = value;
@@ -770,18 +770,18 @@ static int ad7280a_write_thresh(struct iio_dev *indio_dev,
		case IIO_EV_DIR_RISING:
			addr = AD7280A_AUX_ADC_OVERVOLTAGE_REG;
			ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
					   1, val);
					   1, value);
			if (ret)
				break;
			st->aux_threshhigh = val;
			st->aux_threshhigh = value;
			break;
		case IIO_EV_DIR_FALLING:
			addr = AD7280A_AUX_ADC_UNDERVOLTAGE_REG;
			ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
					   1, val);
					   1, value);
			if (ret)
				break;
			st->aux_threshlow = val;
			st->aux_threshlow = value;
			break;
		default:
			ret = -EINVAL;
+4 −1
Original line number Diff line number Diff line
@@ -471,12 +471,15 @@ static ssize_t calibration_forced_value_store(struct device *dev,
	ret = scd4x_write_and_fetch(state, CMD_FRC, arg, &val, sizeof(val));
	mutex_unlock(&state->lock);

	if (ret)
		return ret;

	if (val == 0xff) {
		dev_err(dev, "forced calibration has failed");
		return -EINVAL;
	}

	return ret ?: len;
	return len;
}

static IIO_DEVICE_ATTR_RW(calibration_auto_enable, 0);
+3 −3
Original line number Diff line number Diff line
@@ -656,7 +656,7 @@ static int ad3552r_reset(struct ad3552r_desc *dac)
{
	struct reg_addr_pool addr;
	int ret;
	u16 val;
	int val;

	dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset",
						  GPIOD_OUT_LOW);
@@ -809,10 +809,10 @@ static int ad3552r_configure_custom_gain(struct ad3552r_desc *dac,

	gain_child = fwnode_get_named_child_node(child,
						 "custom-output-range-config");
	if (IS_ERR(gain_child)) {
	if (!gain_child) {
		dev_err(dev,
			"mandatory custom-output-range-config property missing\n");
		return PTR_ERR(gain_child);
		return -EINVAL;
	}

	dac->ch_data[ch].range_override = 1;
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,

	switch (m) {
	case IIO_CHAN_INFO_RAW:
		*val = st->cached_val;
		*val = st->cached_val >> chan->scan_type.shift;
		return IIO_VAL_INT;
	case IIO_CHAN_INFO_SCALE:
		*val = st->vref_mv;
+1 −1
Original line number Diff line number Diff line
@@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct iio_dev *iio_dev)
		if (!ret)
			st->channel_modes[reg] = tmp;

		fwnode_property_read_u32(child, "adi,off-state", &tmp);
		ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
		if (!ret)
			st->channel_offstate[reg] = tmp;
	}
Loading