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

Merge tag 'iio-fixes-for-6.15b' of...

Merge tag 'iio-fixes-for-6.15b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 2nd set of fixes for 6.15 (or 6.16 merge window)

Usual mixed bag.

adi,ad4851
- Avoid a buffer overrun due to bug in pointer arithmetic.
adi,ad7173
- Fix compiling if gpiolib is not enabled
adi,ad7606
- Fix raw reads for 18-bit chips by ensuring we mask out upper bits
  as some SPI controllers do not do so for 18bit words.
- Fix wrong masking for register writes.
adi,ad7944
- Mask high bits for raw reads.
adi,axi-adc
- Add check on whether the busy flag has cleared before first access.
invensense,icm42600
- Fix the temperature offset to take scale into account.
nxp,fxls8962af
- Fix temperature to be in milli degrees Celsius not degrees.
- Fix sign of temperature channel.

* tag 'iio-fixes-for-6.15b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: accel: fxls8962af: Fix temperature scan element sign
  iio: accel: fxls8962af: Fix temperature calculation
  iio: adc: ad7944: mask high bits on direct read
  iio: adc: ad4851: fix ad4858 chan pointer handling
  iio: imu: inv_icm42600: Fix temperature calculation
  iio: dac: adi-axi-dac: fix bus read
  iio: adc: ad7606_spi: fix reg write value mask
  iio: adc: ad7606: fix raw read for 18-bit chips
  iio: adc: ad7173: fix compiling without gpiolib
parents 3ab31128 9c78317b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/regulator/consumer.h>
#include <linux/regmap.h>
#include <linux/types.h>
#include <linux/units.h>

#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
@@ -439,8 +440,16 @@ static int fxls8962af_read_raw(struct iio_dev *indio_dev,
		*val = FXLS8962AF_TEMP_CENTER_VAL;
		return IIO_VAL_INT;
	case IIO_CHAN_INFO_SCALE:
		switch (chan->type) {
		case IIO_TEMP:
			*val = MILLIDEGREE_PER_DEGREE;
			return IIO_VAL_INT;
		case IIO_ACCEL:
			*val = 0;
			return fxls8962af_read_full_scale(data, val2);
		default:
			return -EINVAL;
		}
	case IIO_CHAN_INFO_SAMP_FREQ:
		return fxls8962af_read_samp_freq(data, val, val2);
	default:
@@ -736,9 +745,11 @@ static const struct iio_event_spec fxls8962af_event[] = {
	.type = IIO_TEMP, \
	.address = FXLS8962AF_TEMP_OUT, \
	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
			      BIT(IIO_CHAN_INFO_SCALE) | \
			      BIT(IIO_CHAN_INFO_OFFSET),\
	.scan_index = -1, \
	.scan_type = { \
		.sign = 's', \
		.realbits = 8, \
		.storagebits = 8, \
	}, \
+3 −2
Original line number Diff line number Diff line
@@ -129,8 +129,9 @@ config AD7173
	tristate "Analog Devices AD7173 driver"
	depends on SPI_MASTER
	select AD_SIGMA_DELTA
	select GPIO_REGMAP if GPIOLIB
	select REGMAP_SPI if GPIOLIB
	select GPIOLIB
	select GPIO_REGMAP
	select REGMAP_SPI
	help
	  Say yes here to build support for Analog Devices AD7173 and similar ADC
	  Currently supported models:
+7 −7
Original line number Diff line number Diff line
@@ -1034,7 +1034,7 @@ static int ad4858_parse_channels(struct iio_dev *indio_dev)
	struct device *dev = &st->spi->dev;
	struct iio_chan_spec *ad4851_channels;
	const struct iio_chan_spec ad4851_chan = AD4858_IIO_CHANNEL;
	int ret;
	int ret, i = 0;

	ret = ad4851_parse_channels_common(indio_dev, &ad4851_channels,
					   ad4851_chan);
@@ -1042,15 +1042,15 @@ static int ad4858_parse_channels(struct iio_dev *indio_dev)
		return ret;

	device_for_each_child_node_scoped(dev, child) {
		ad4851_channels->has_ext_scan_type = 1;
		ad4851_channels[i].has_ext_scan_type = 1;
		if (fwnode_property_read_bool(child, "bipolar")) {
			ad4851_channels->ext_scan_type = ad4851_scan_type_20_b;
			ad4851_channels->num_ext_scan_type = ARRAY_SIZE(ad4851_scan_type_20_b);
			ad4851_channels[i].ext_scan_type = ad4851_scan_type_20_b;
			ad4851_channels[i].num_ext_scan_type = ARRAY_SIZE(ad4851_scan_type_20_b);
		} else {
			ad4851_channels->ext_scan_type = ad4851_scan_type_20_u;
			ad4851_channels->num_ext_scan_type = ARRAY_SIZE(ad4851_scan_type_20_u);
			ad4851_channels[i].ext_scan_type = ad4851_scan_type_20_u;
			ad4851_channels[i].num_ext_scan_type = ARRAY_SIZE(ad4851_scan_type_20_u);
		}
		ad4851_channels++;
		i++;
	}

	indio_dev->channels = ad4851_channels;
+1 −14
Original line number Diff line number Diff line
@@ -230,10 +230,8 @@ struct ad7173_state {
	unsigned long long *config_cnts;
	struct clk *ext_clk;
	struct clk_hw int_clk_hw;
#if IS_ENABLED(CONFIG_GPIOLIB)
	struct regmap *reg_gpiocon_regmap;
	struct gpio_regmap *gpio_regmap;
#endif
};

static unsigned int ad4115_sinc5_data_rates[] = {
@@ -288,8 +286,6 @@ static const char *const ad7173_clk_sel[] = {
	"ext-clk", "xtal"
};

#if IS_ENABLED(CONFIG_GPIOLIB)

static const struct regmap_range ad7173_range_gpio[] = {
	regmap_reg_range(AD7173_REG_GPIO, AD7173_REG_GPIO),
};
@@ -543,12 +539,6 @@ static int ad7173_gpio_init(struct ad7173_state *st)

	return 0;
}
#else
static int ad7173_gpio_init(struct ad7173_state *st)
{
	return 0;
}
#endif /* CONFIG_GPIOLIB */

static struct ad7173_state *ad_sigma_delta_to_ad7173(struct ad_sigma_delta *sd)
{
@@ -1797,10 +1787,7 @@ static int ad7173_probe(struct spi_device *spi)
	if (ret)
		return ret;

	if (IS_ENABLED(CONFIG_GPIOLIB))
	return ad7173_gpio_init(st);

	return 0;
}

static const struct of_device_id ad7173_of_match[] = {
+10 −11
Original line number Diff line number Diff line
@@ -727,17 +727,16 @@ static int ad7606_scan_direct(struct iio_dev *indio_dev, unsigned int ch,
		goto error_ret;

	chan = &indio_dev->channels[ch + 1];
	if (chan->scan_type.sign == 'u') {

	if (realbits > 16)
		*val = st->data.buf32[ch];
	else
		*val = st->data.buf16[ch];
	} else {
		if (realbits > 16)
			*val = sign_extend32(st->data.buf32[ch], realbits - 1);
		else
			*val = sign_extend32(st->data.buf16[ch], realbits - 1);
	}

	*val &= GENMASK(realbits - 1, 0);

	if (chan->scan_type.sign == 's')
		*val = sign_extend32(*val, realbits - 1);

error_ret:
	if (!st->gpio_convst) {
Loading