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

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

Merge tag 'iio-fixes-for-6.0a' 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.0-rc1

   adi,ad7292
    - Prevent duplicate disable of regulator in error path.

   bosch,bmg160
    - Correct dt-binding to allow for 2 interrupt pins.

   capella,cm3605
    - Fix missing error cleanup due to premature return.

   capella,cm32181
    - Fix missing static on local symbol.

   microchip,mcp33911
    - Correctly handle sign bit.
    - Fix mismatch between driver and DT binding, including fallback to old
      driver behavior.
    - Use correct formula for voltage calculation."

* tag 'iio-fixes-for-6.0a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: light: cm32181: make cm32181_pm_ops static
  iio: ad7292: Prevent regulator double disable
  dt-bindings: iio: gyroscope: bosch,bmg160: correct number of pins
  iio: adc: mcp3911: use correct formula for AD conversion
  iio: adc: mcp3911: correct "microchip,device-addr" property
  iio: light: cm3605: Fix an error handling path in cm3605_probe()
  iio: adc: mcp3911: make use of the sign bit
parents db7e5c10 0096fc87
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@ properties:

  interrupts:
    minItems: 1
    maxItems: 2
    description:
      Should be configured with type IRQ_TYPE_EDGE_RISING.
      If two interrupts are provided, expected order is INT1 and INT2.

required:
  - compatible
+1 −3
Original line number Diff line number Diff line
@@ -287,10 +287,8 @@ static int ad7292_probe(struct spi_device *spi)

		ret = devm_add_action_or_reset(&spi->dev,
					       ad7292_regulator_disable, st);
		if (ret) {
			regulator_disable(st->reg);
		if (ret)
			return ret;
		}

		ret = regulator_get_voltage(st->reg);
		if (ret < 0)
+22 −6
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@
#define MCP3911_CHANNEL(x)		(MCP3911_REG_CHANNEL0 + x * 3)
#define MCP3911_OFFCAL(x)		(MCP3911_REG_OFFCAL_CH0 + x * 6)

/* Internal voltage reference in uV */
#define MCP3911_INT_VREF_UV		1200000
/* Internal voltage reference in mV */
#define MCP3911_INT_VREF_MV		1200

#define MCP3911_REG_READ(reg, id)	((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff)
#define MCP3911_REG_WRITE(reg, id)	((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff)
@@ -113,6 +113,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
		if (ret)
			goto out;

		*val = sign_extend32(*val, 23);

		ret = IIO_VAL_INT;
		break;

@@ -137,11 +139,18 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,

			*val = ret / 1000;
		} else {
			*val = MCP3911_INT_VREF_UV;
			*val = MCP3911_INT_VREF_MV;
		}

		*val2 = 24;
		ret = IIO_VAL_FRACTIONAL_LOG2;
		/*
		 * For 24bit Conversion
		 * Raw = ((Voltage)/(Vref) * 2^23 * Gain * 1.5
		 * Voltage = Raw * (Vref)/(2^23 * Gain * 1.5)
		 */

		/* val2 = (2^23 * 1.5) */
		*val2 = 12582912;
		ret = IIO_VAL_FRACTIONAL;
		break;
	}

@@ -208,6 +217,13 @@ static int mcp3911_config(struct mcp3911 *adc)
	u32 configreg;
	int ret;

	ret = device_property_read_u32(dev, "microchip,device-addr", &adc->dev_addr);

	/*
	 * Fallback to "device-addr" due to historical mismatch between
	 * dt-bindings and implementation
	 */
	if (ret)
		device_property_read_u32(dev, "device-addr", &adc->dev_addr);
	if (adc->dev_addr > 3) {
		dev_err(&adc->spi->dev,
+1 −1
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ static int cm32181_resume(struct device *dev)
					 cm32181->conf_regs[CM32181_REG_ADDR_CMD]);
}

DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume);

static const struct of_device_id cm32181_of_match[] = {
	{ .compatible = "capella,cm3218" },
+4 −2
Original line number Diff line number Diff line
@@ -226,8 +226,10 @@ static int cm3605_probe(struct platform_device *pdev)
	}

	irq = platform_get_irq(pdev, 0);
	if (irq < 0)
		return dev_err_probe(dev, irq, "failed to get irq\n");
	if (irq < 0) {
		ret = dev_err_probe(dev, irq, "failed to get irq\n");
		goto out_disable_aset;
	}

	ret = devm_request_threaded_irq(dev, irq, cm3605_prox_irq,
					NULL, 0, "cm3605", indio_dev);