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

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

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

Jonathan writes:

IIO: 2nd set of fixes for the 7.0 cycle

Usual mixed bag of fixes for recent code and much older issues that have
surfaced. Biggest group are continued resolution of IRQF_ONE_SHOT
being used incorrectly (which now triggers a warning)

adi,ad4062
- Replace IRQF_ONESHOT (as no threaded handler) with IRQF_NO_THREAD as
  the caller makes use of iio_trigger_poll() which cannot run from a
  thread.
adi,ade9000
- Move mutex_init() earlier to ensure it is available if spurious IRQ
  occurs.
adi,adis16550
- Fix swapped gyro and accel filter functions.
adi,adxl3380
- Fix some bit manipulation that was always resulting in 0.
- Fix incorrect register map for calibbias on the active power channel.
- Fix returning IRQF_HANDLED from a function that should return 0 or
  -ERRNO.
aspeed,adc
- Clear a reference voltage bit that might be set prior to driver load.
bosch,bno055
- Off by one channel buffer sizing. Benine due to padding prior to the
  subsequent timestamp.
hid-sensors
- A more complex fix to IRQF_ONESHOT warning as this driver had a trigger
  that was never actually used but the ABI that exposed had to be
  maintained to avoid regressions.
hid-sensors-rotation
- An obscure buffer alignment case that applies to quaternions only was
  recently broken resulting in writes beyond the end of the channel buffer.
  Add a new core macro and apply it in this driver to make it very clear
  what was going on.
honeywell,abp2030pa
- Remove meaningless IRQF_ONESHOT from a non threaded IRQ handler.
  Warning fix only.
invense,mpu3050
- Fix token passed to free_irq() to match the one used at setup.
- Fix an irq resource leak in error path.
- Reorder probe so that userspace interfaces are exposed only after
  everything else has finished.
- Reorder remove slightly to cleanup the buffer only after irq removed
  ensuring reverse of probe sequence.
microchip,mcp47feb02
- Fix use of mutex before it was initialized by not performing unnecessary
  lock that was early enough in probe that all code was serial.
st,lsm6dsx
- Ensure that FIFO ODR is only controllable for accel and gyro channels
  avoiding incorrect register accesses.
- Restrict separation of buffer sampling from main sampling rate to
  accelerometer. It is only useful for running event detection faster
  than the fifo and the only events are on the accelerometer.
ti,ads1018
- Fix overflow of u8 which wasn't big enough to store max data rate value.
ti,ads1119:
- Fix unbalanced pm in an error path.
- IRQF_ONESHOT (as no threaded handler) replaced with IRQF_NO_THREAD
  (needed for iio_trigger_poll()).
- Ensure complete reinitialized before reuse. Previously it would have
  completed immediate after the first time.
ti,ads7950
- Fix return value of gpio_get() to be 0 or 1.
- Avoid accidental overwrite of state resulting in gpio_get() only
  returning 0 or -ERRNO but never 1.

* tag 'iio-fixes-for-7.0b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (25 commits)
  iio: imu: adis16550: fix swapped gyro/accel filter functions
  iio: adc: aspeed: clear reference voltage bits before configuring vref
  iio: adc: ti-ads1119: Reinit completion before wait_for_completion_timeout()
  iio: adc: ti-ads1018: fix type overflow for data rate
  iio: adc: ti-ads7950: do not clobber gpio state in ti_ads7950_get()
  iio: adc: ti-ads7950: normalize return value of gpio_get
  iio: orientation: hid-sensor-rotation: fix quaternion alignment
  iio: add IIO_DECLARE_QUATERNION() macro
  iio: adc: ti-ads1119: Replace IRQF_ONESHOT with IRQF_NO_THREAD
  iio: imu: bno055: fix BNO055_SCAN_CH_COUNT off by one
  iio: hid-sensors: Use software trigger
  iio: adc: ad4062: Replace IRQF_ONESHOT with IRQF_NO_THREAD
  iio: gyro: mpu3050: Fix out-of-sequence free_irq()
  iio: gyro: mpu3050: Move iio_device_register() to correct location
  iio: gyro: mpu3050: Fix irq resource leak
  iio: gyro: mpu3050: Fix incorrect free_irq() variable
  iio: imu: st_lsm6dsx: Set buffer sampling frequency for accelerometer only
  iio: imu: st_lsm6dsx: Set FIFO ODR for accelerometer and gyroscope only
  iio: dac: mcp47feb02: Fix mutex used before initialization
  iio: adc: ade9000: fix wrong return type in streaming push
  ...
parents 76dd7c74 ea7e2e43
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ static int adxl380_set_fifo_samples(struct adxl380_state *st)
	ret = regmap_update_bits(st->regmap, ADXL380_FIFO_CONFIG_0_REG,
				 ADXL380_FIFO_SAMPLES_8_MSK,
				 FIELD_PREP(ADXL380_FIFO_SAMPLES_8_MSK,
					    (fifo_samples & BIT(8))));
					    !!(fifo_samples & BIT(8))));
	if (ret)
		return ret;

+3 −5
Original line number Diff line number Diff line
@@ -719,10 +719,8 @@ static int ad4062_request_irq(struct iio_dev *indio_dev)
	}
	st->gpo_irq[1] = true;

	return devm_request_threaded_irq(dev, ret,
					 ad4062_irq_handler_drdy,
					 NULL, IRQF_ONESHOT, indio_dev->name,
					 indio_dev);
	return devm_request_irq(dev, ret, ad4062_irq_handler_drdy,
				IRQF_NO_THREAD, indio_dev->name, indio_dev);
}

static const struct iio_trigger_ops ad4062_trigger_ops = {
@@ -955,7 +953,7 @@ static int ad4062_write_raw_dispatch(struct ad4062_state *st, int val, int val2,
	default:
		return -EINVAL;
	}
};
}

static int ad4062_write_raw(struct iio_dev *indio_dev,
			    struct iio_chan_spec const *chan, int val,
+6 −6
Original line number Diff line number Diff line
@@ -787,7 +787,7 @@ static int ade9000_iio_push_streaming(struct iio_dev *indio_dev)
				   ADE9000_MIDDLE_PAGE_BIT);
		if (ret) {
			dev_err_ratelimited(dev, "IRQ0 WFB write fail");
			return IRQ_HANDLED;
			return ret;
		}

		ade9000_configure_scan(indio_dev, ADE9000_REG_WF_BUFF);
@@ -1123,7 +1123,7 @@ static int ade9000_write_raw(struct iio_dev *indio_dev,
			tmp &= ~ADE9000_PHASE_C_POS_BIT;

			switch (tmp) {
			case ADE9000_REG_AWATTOS:
			case ADE9000_REG_AWATT:
				return regmap_write(st->regmap,
						    ADE9000_ADDR_ADJUST(ADE9000_REG_AWATTOS,
									chan->channel), val);
@@ -1706,19 +1706,19 @@ static int ade9000_probe(struct spi_device *spi)

	init_completion(&st->reset_completion);

	ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
	ret = devm_mutex_init(dev, &st->lock);
	if (ret)
		return ret;

	ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
	ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
	if (ret)
		return ret;

	ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
	ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
	if (ret)
		return ret;

	ret = devm_mutex_init(dev, &st->lock);
	ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
	if (ret)
		return ret;

+1 −0
Original line number Diff line number Diff line
@@ -415,6 +415,7 @@ static int aspeed_adc_vref_config(struct iio_dev *indio_dev)
	}
	adc_engine_control_reg_val =
		readl(data->base + ASPEED_REG_ENGINE_CONTROL);
	adc_engine_control_reg_val &= ~ASPEED_ADC_REF_VOLTAGE;

	ret = devm_regulator_get_enable_read_voltage(data->dev, "vref");
	if (ret < 0 && ret != -ENODEV)
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ static int ads1018_single_shot(struct ads1018 *ads1018,
			       struct iio_chan_spec const *chan, u16 *cnv)
{
	u8 max_drate_mode = ads1018->chip_info->num_data_rate_mode_to_hz - 1;
	u8 drate = ads1018->chip_info->data_rate_mode_to_hz[max_drate_mode];
	u32 drate = ads1018->chip_info->data_rate_mode_to_hz[max_drate_mode];
	u8 pga_mode = ads1018->chan_data[chan->scan_index].pga_mode;
	struct spi_transfer xfer[2] = {
		{
Loading