mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
iio: adc: ade9000: request interrupts after powering the device
The IRQ handlers do SPI register accesses, but the interrupts were
requested before the vdd regulator was enabled. An interrupt arriving
while the chip is unpowered runs a handler against a dead chip, causing
SPI errors or garbage reads.
Request the interrupts after enabling the regulator. This keeps irq1
registered before ade9000_reset(), which waits on it, and lets devm free
the interrupts before the regulator is disabled.
Fixes: 81de7b4619 ("iio: adc: add ade9000 support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
549b71ce05
commit
88fda1ed51
|
|
@ -1705,18 +1705,6 @@ static int ade9000_probe(struct spi_device *spi)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* External CMOS clock input (optional - crystal can be used instead) */
|
||||
st->clkin = devm_clk_get_optional_enabled(dev, NULL);
|
||||
if (IS_ERR(st->clkin))
|
||||
|
|
@ -1736,6 +1724,19 @@ static int ade9000_probe(struct spi_device *spi)
|
|||
return dev_err_probe(&spi->dev, ret,
|
||||
"Failed to get and enable vdd regulator\n");
|
||||
|
||||
/* Request IRQs only after powering the chip; the handlers do SPI access. */
|
||||
ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
indio_dev->channels = ade9000_channels;
|
||||
indio_dev->num_channels = ARRAY_SIZE(ade9000_channels);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user