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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmMD0KwRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohKBg/9HCTi2Ei+FOCbkVVMtP6PaV54gEVDJH5J
 nZLCSLiI1VfCgbS/yFysawE0mLAIdW7fPu0TwSRH3RR9/idUqIlmX4myGgcYt+gf
 y+v6HEYOnhJgKvYvQJDmJ6XRfYADOK4wBoGNkUwJaw7rwSHknJr8ZL7NfPcogwWl
 xXJTQwBTjpQlGvsLxSHboL4yY/X+IrDm3c4mTbBJBjhq6z8mxn5NiIbpsUzU1+lt
 b4CQuR923yT4omtkIrkfzeQ3iALus6ymgMbgf4bM0Tz+QHauE0CQo6gz1uIrpheQ
 MVMl9jKTwUUWvPy4yMfl4CUNZf7PVMQCXm8A0Vigfgi4pLAY7hLJfpSl6ukFkCf6
 XTqkzNwyCbXhjKcu3g/85YL+z+X5UT1jadxXtBYrkaYNXxFE042Szasso0LPRabn
 YuuDAY6T8yWcjQ06AcmTrnyU6Rli6bi7HeAjSgOPbsbbQhQd1E6bNgZb36oFFaN8
 XGfmGrwMxWF3JmCyGypyGfE20BMjsQOPhjyy2fOfNHGCPyTKR4+epP6eGFBO/9bd
 +4zpRAmEUCyI5slqBiZLlAwoP6GKp9KX5K6/MsZDJG2IcvMPvs1oGTCjQAQ7mfpg
 6gvu5/QLkOMI1VLKiKXN3ncOjt/59el+ctL3lBIdMyvO9mg0E7P9ytQ3tOGMiYMi
 oGUbYS7OHRM=
 =Bw1q
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Greg Kroah-Hartman 2022-08-23 10:42:19 +02:00
commit a582123d6f
5 changed files with 30 additions and 12 deletions

View File

@ -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

View File

@ -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)

View File

@ -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,7 +217,14 @@ static int mcp3911_config(struct mcp3911 *adc)
u32 configreg;
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) {
dev_err(&adc->spi->dev,
"invalid device address (%i). Must be in range 0-3.\n",

View File

@ -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" },

View File

@ -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);