All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions
@ 2018-09-20 12:40 ` Eugen Hristev
  0 siblings, 0 replies; 26+ messages in thread
From: Eugen Hristev @ 2018-09-20 12:40 UTC (permalink / raw)
  To: jic23, ludovic.desroches, linux-arm-kernel, linux-kernel,
	linux-iio
  Cc: nicolas.ferre, Eugen Hristev, Maxime Ripard, stable

When doing simple conversions, the driver did not acknowledge the DRDY irq.
If this irq is not acked, it will be left pending, and as soon as a trigger
is enabled, the irq handler will be called, it doesn't know why this irq
has occurred because no channel is pending, and then we will have irq loop
and board will hang.

Fixes 0e589d5fb ("ARM: AT91: IIO: Add AT91 ADC driver.")
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/iio/adc/at91_adc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 44b5168..e85f859 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -712,6 +712,11 @@ static int at91_adc_read_raw(struct iio_dev *idev,
 		at91_adc_writel(st, AT91_ADC_CHDR,
 				AT91_ADC_CH(chan->channel));
 		at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel));
+		/*
+		 * we need to ack the DRDY irq, otherwise it will be
+		 * left pending and irq handler will be confused
+		 */
+		at91_adc_readl(st, AT91_ADC_LCDR);
 
 		st->last_value = 0;
 		st->done = false;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-09-29 17:49 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-20 12:40 [PATCH 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions Eugen Hristev
2018-09-20 12:40 ` Eugen Hristev
2018-09-20 12:40 ` [PATCH 2/2] iio: adc: at91: fix wrong channel number in triggered buffer mode Eugen Hristev
2018-09-20 12:40   ` Eugen Hristev
2018-09-21  7:26   ` kbuild test robot
2018-09-21  7:26     ` kbuild test robot
2018-09-22 10:36     ` Jonathan Cameron
2018-09-22 10:36       ` Jonathan Cameron
2018-09-22 11:19       ` Song Qiang
2018-09-22 11:19         ` Song Qiang
2018-09-22 11:48       ` Himanshu Jha
2018-09-22 11:48         ` Himanshu Jha
2018-09-22 12:51         ` Jonathan Cameron
2018-09-22 12:51           ` Jonathan Cameron
2018-09-22 10:31 ` [PATCH 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions Jonathan Cameron
2018-09-22 10:31   ` Jonathan Cameron
2018-09-24  6:19   ` Eugen Hristev
2018-09-24  6:19     ` Eugen Hristev
2018-09-24 20:00     ` Jonathan Cameron
2018-09-24 20:00       ` Jonathan Cameron
2018-09-24 20:27       ` Jonathan Cameron
2018-09-24 20:27         ` Jonathan Cameron
2018-09-25  6:50         ` Eugen Hristev
2018-09-25  6:50           ` Eugen Hristev
2018-09-29 11:20           ` Jonathan Cameron
2018-09-29 11:20             ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.