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

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
...@@ -24,8 +24,10 @@ properties: ...@@ -24,8 +24,10 @@ properties:
interrupts: interrupts:
minItems: 1 minItems: 1
maxItems: 2
description: description:
Should be configured with type IRQ_TYPE_EDGE_RISING. Should be configured with type IRQ_TYPE_EDGE_RISING.
If two interrupts are provided, expected order is INT1 and INT2.
required: required:
- compatible - compatible
......
...@@ -287,10 +287,8 @@ static int ad7292_probe(struct spi_device *spi) ...@@ -287,10 +287,8 @@ static int ad7292_probe(struct spi_device *spi)
ret = devm_add_action_or_reset(&spi->dev, ret = devm_add_action_or_reset(&spi->dev,
ad7292_regulator_disable, st); ad7292_regulator_disable, st);
if (ret) { if (ret)
regulator_disable(st->reg);
return ret; return ret;
}
ret = regulator_get_voltage(st->reg); ret = regulator_get_voltage(st->reg);
if (ret < 0) if (ret < 0)
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#define MCP3911_CHANNEL(x) (MCP3911_REG_CHANNEL0 + x * 3) #define MCP3911_CHANNEL(x) (MCP3911_REG_CHANNEL0 + x * 3)
#define MCP3911_OFFCAL(x) (MCP3911_REG_OFFCAL_CH0 + x * 6) #define MCP3911_OFFCAL(x) (MCP3911_REG_OFFCAL_CH0 + x * 6)
/* Internal voltage reference in uV */ /* Internal voltage reference in mV */
#define MCP3911_INT_VREF_UV 1200000 #define MCP3911_INT_VREF_MV 1200
#define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff) #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) #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, ...@@ -113,6 +113,8 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
if (ret) if (ret)
goto out; goto out;
*val = sign_extend32(*val, 23);
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
...@@ -137,11 +139,18 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev, ...@@ -137,11 +139,18 @@ static int mcp3911_read_raw(struct iio_dev *indio_dev,
*val = ret / 1000; *val = ret / 1000;
} else { } 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; break;
} }
...@@ -208,7 +217,14 @@ static int mcp3911_config(struct mcp3911 *adc) ...@@ -208,7 +217,14 @@ static int mcp3911_config(struct mcp3911 *adc)
u32 configreg; u32 configreg;
int ret; int ret;
device_property_read_u32(dev, "device-addr", &adc->dev_addr); 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) { if (adc->dev_addr > 3) {
dev_err(&adc->spi->dev, dev_err(&adc->spi->dev,
"invalid device address (%i). Must be in range 0-3.\n", "invalid device address (%i). Must be in range 0-3.\n",
......
...@@ -505,7 +505,7 @@ static int cm32181_resume(struct device *dev) ...@@ -505,7 +505,7 @@ static int cm32181_resume(struct device *dev)
cm32181->conf_regs[CM32181_REG_ADDR_CMD]); 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[] = { static const struct of_device_id cm32181_of_match[] = {
{ .compatible = "capella,cm3218" }, { .compatible = "capella,cm3218" },
......
...@@ -226,8 +226,10 @@ static int cm3605_probe(struct platform_device *pdev) ...@@ -226,8 +226,10 @@ static int cm3605_probe(struct platform_device *pdev)
} }
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0) {
return dev_err_probe(dev, irq, "failed to get irq\n"); 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, ret = devm_request_threaded_irq(dev, irq, cm3605_prox_irq,
NULL, 0, "cm3605", indio_dev); NULL, 0, "cm3605", indio_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment