[PATCH 07/18] media: coda: Add fake IRQ check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sergey Khimich <serghox@xxxxxxxxx>

Sometimes we receive fake interrupts. It's better to check
status register and trace fake irq if occurred.

Signed-off-by: Sergey Khimich <serghox@xxxxxxxxx>
---
 .../media/platform/chips-media/coda/coda-bit.c   | 16 +++++++++++++++-
 drivers/media/platform/chips-media/coda/trace.h  | 16 ++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/chips-media/coda/coda-bit.c b/drivers/media/platform/chips-media/coda/coda-bit.c
index 84ded154adfe..3e3bb3d64ec9 100644
--- a/drivers/media/platform/chips-media/coda/coda-bit.c
+++ b/drivers/media/platform/chips-media/coda/coda-bit.c
@@ -2635,9 +2635,23 @@ irqreturn_t coda_irq_handler(int irq, void *data)
 {
 	struct coda_dev *dev = data;
 	struct coda_ctx *ctx;
+	u32 status;
 
 	/* read status register to attend the IRQ */
-	coda_read(dev, CODA_REG_BIT_INT_STATUS);
+	status = coda_read(dev, CODA_REG_BIT_INT_STATUS);
+	if (!status) {
+		/*
+		 * Sometimes we received wrong interrupts
+		 * That's why we check status
+		 * and if one of it is zero - wait next interrupts
+		 * You need check your HW configuration
+		 */
+		dev_warn_ratelimited(dev->dev, "Fake irq status=0x%X\n",
+				     status);
+		trace_coda_wrong_irq(dev);
+		return IRQ_HANDLED;
+	}
+
 	coda_write(dev, 0, CODA_REG_BIT_INT_REASON);
 	coda_write(dev, CODA_REG_BIT_INT_CLEAR_SET,
 		      CODA_REG_BIT_INT_CLEAR);
diff --git a/drivers/media/platform/chips-media/coda/trace.h b/drivers/media/platform/chips-media/coda/trace.h
index abc6a01a74e9..15a96bab10ad 100644
--- a/drivers/media/platform/chips-media/coda/trace.h
+++ b/drivers/media/platform/chips-media/coda/trace.h
@@ -10,6 +10,22 @@
 
 #include "coda.h"
 
+TRACE_EVENT(coda_wrong_irq,
+	TP_PROTO(struct coda_dev *dev),
+
+	TP_ARGS(dev),
+
+	TP_STRUCT__entry(
+		__field(struct coda_dev *, dev)
+	),
+
+	TP_fast_assign(
+		__entry->dev = dev;
+	),
+
+	TP_printk(" dev = 0x%p", __entry->dev)
+);
+
 TRACE_EVENT(coda_bit_run,
 	TP_PROTO(struct coda_ctx *ctx, int cmd),
 
-- 
2.30.2





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux