The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sergey Khimich <serghox@gmail.com>
To: linux-media@vger.kernel.org
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-kernel@vger.kernel.org,
	Vladimir Yakovlev <vovchkir@gmail.com>,
	Maksim Turok <turok.m7@gmail.com>
Subject: [PATCH 07/18] media: coda: Add fake IRQ check
Date: Fri, 14 Mar 2025 18:29:28 +0300	[thread overview]
Message-ID: <20250314152939.2759573-8-serghox@gmail.com> (raw)
In-Reply-To: <20250314152939.2759573-1-serghox@gmail.com>

From: Sergey Khimich <serghox@gmail.com>

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

Signed-off-by: Sergey Khimich <serghox@gmail.com>
---
 .../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


  parent reply	other threads:[~2025-03-14 15:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 15:29 [PATCH 00/18] coda988 video codec support Sergey Khimich
2025-03-14 15:29 ` [PATCH 01/18] media: coda: Add print if irq isn't present Sergey Khimich
2025-05-23 23:40   ` Nicolas Dufresne
2025-05-23 23:43     ` Nicolas Dufresne
2025-03-14 15:29 ` [PATCH 02/18] media: coda: Use get_array to work use multiple reset Sergey Khimich
2025-03-16 11:44   ` Krzysztof Kozlowski
2025-03-14 15:29 ` [PATCH 03/18] dt-bindings: media: coda: Fix resets count Sergey Khimich
2025-03-16 11:42   ` Krzysztof Kozlowski
     [not found]     ` <CABd6DqVZiW4ybyfBi4qgkP7RjRLpaAc4G1n+nBJzTW8fLh3sVQ@mail.gmail.com>
2025-03-24 13:52       ` Krzysztof Kozlowski
2025-03-14 15:29 ` [PATCH 04/18] media: coda: Add check result after reset Sergey Khimich
2025-03-14 15:29 ` [PATCH 05/18] media: coda: using threaded_irq for 0 (bit) interrupt Sergey Khimich
2025-05-23 23:49   ` Nicolas Dufresne
2025-03-14 15:29 ` [PATCH 06/18] media: coda: Add reset device before getting interrupt Sergey Khimich
2025-03-14 15:29 ` Sergey Khimich [this message]
2025-05-23 23:57   ` [PATCH 07/18] media: coda: Add fake IRQ check Nicolas Dufresne
2025-03-14 15:29 ` [PATCH 08/18] media: coda: Add log to finish_encode if buffer is too small Sergey Khimich
2025-05-24  0:03   ` Nicolas Dufresne
2025-03-14 15:29 ` [PATCH 09/18] media: coda: Fix max h.264 level for CODA_DX6 Sergey Khimich
2025-05-24  0:07   ` Nicolas Dufresne
2025-03-14 15:29 ` [PATCH 10/18] media: coda: Remove double setting of stop flag Sergey Khimich
2025-03-14 15:29 ` [PATCH 11/18] media: coda: Print size of encoded buff in other place Sergey Khimich
2025-03-14 15:29 ` [PATCH 12/18] media: coda: Fix loglevel for seq mismatch print Sergey Khimich
2025-03-14 15:29 ` [PATCH 13/18] media: coda: Fix support for all mpeg4 levels Sergey Khimich
2025-03-14 15:29 ` [PATCH 14/18] media: coda: Fix handling wrong format in coda_try_fmt Sergey Khimich
2025-03-14 15:29 ` [PATCH 15/18] media: coda: Use v4l2_ctrl to set gamma for h264enc Sergey Khimich
2025-03-14 15:29 ` [PATCH 16/18] media: coda: Update default velues of QP for mpeg4 I/P Sergey Khimich
2025-03-14 15:29 ` [PATCH 17/18] media: coda: Use preferred usleep_range than udelay Sergey Khimich
2025-03-14 15:29 ` [PATCH 18/18] media: coda: add support coda988 enc and dec Sergey Khimich
2025-03-17  0:12 ` [PATCH 00/18] coda988 video codec support jackson.lee
2025-03-25  1:44   ` jackson.lee
2025-04-08 18:41 ` Nicolas Dufresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250314152939.2759573-8-serghox@gmail.com \
    --to=serghox@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=turok.m7@gmail.com \
    --cc=vovchkir@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox