From: Daniel Golle <daniel@makrotopia.org>
To: Mehdi Djait <mehdi.djait@linux.intel.com>,
Michael Riesch <michael.riesch@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] media: rockchip: rkcif: mask MIPI interrupts when powered
Date: Tue, 3 Nov 2026 10:45:23 +0000 [thread overview]
Message-ID: <24332831989fde000959b3d3037333f511b95ece.1793702189.git.daniel@makrotopia.org> (raw)
In-Reply-To: <cover.1793702189.git.daniel@makrotopia.org>
The MIPI interrupt enable register comes out of every reset with all
27 sources enabled. Of those only the frame end bits are handled, so
the line stays asserted at about a thousand interrupts per second
while the block is powered. The kernel then reports the interrupt as
unhandled and disables it, after which frame completion only happens
from the spurious interrupt poll. The poll can also call the handler
while the block is clock gated.
Clear the enable register and the status bits after the block has been
reset and clocked, and after the reset in runtime suspend. Treat any
status bit that the handler has read and cleared as handled.
Assisted-by: LLM
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../rockchip/rkcif/rkcif-capture-mipi.c | 19 +++++++++++++++++++
.../rockchip/rkcif/rkcif-capture-mipi.h | 2 ++
.../media/platform/rockchip/rkcif/rkcif-dev.c | 3 +++
3 files changed, 24 insertions(+)
diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
index bc9518f8db507..686b995525b9b 100644
--- a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
@@ -810,6 +810,23 @@ static void rkcif_mipi_set_crop(struct rkcif_stream *stream, u16 left, u16 top)
rkcif_mipi_stream_write(stream, RKCIF_MIPI_CROP_START, val);
}
+void rkcif_mipi_irq_mask(struct rkcif_device *rkcif)
+{
+ if (!rkcif->match_data->mipi)
+ return;
+
+ for (unsigned int i = 0; i < rkcif->match_data->mipi->mipi_num; i++) {
+ struct rkcif_interface *interface =
+ &rkcif->interfaces[RKCIF_MIPI_BASE + i];
+
+ if (!interface->rkcif)
+ continue;
+
+ rkcif_mipi_write(interface, RKCIF_MIPI_INTEN, 0);
+ rkcif_mipi_write(interface, RKCIF_MIPI_INTSTAT, ~0);
+ }
+}
+
irqreturn_t rkcif_mipi_isr(int irq, void *ctx)
{
struct device *dev = ctx;
@@ -823,6 +840,8 @@ irqreturn_t rkcif_mipi_isr(int irq, void *ctx)
intstat = rkcif_mipi_read(interface, RKCIF_MIPI_INTSTAT);
rkcif_mipi_write(interface, RKCIF_MIPI_INTSTAT, intstat);
+ if (intstat)
+ ret = IRQ_HANDLED;
for (unsigned int j = 0; j < interface->streams_num; j++) {
struct rkcif_stream *stream = &interface->streams[j];
diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.h b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.h
index 7edaca44f653c..167b43756929b 100644
--- a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.h
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.h
@@ -21,4 +21,6 @@ void rkcif_mipi_unregister(struct rkcif_device *rkcif);
irqreturn_t rkcif_mipi_isr(int irq, void *ctx);
+void rkcif_mipi_irq_mask(struct rkcif_device *rkcif);
+
#endif
diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-dev.c b/drivers/media/platform/rockchip/rkcif/rkcif-dev.c
index be3a174b9aab0..fbc8ed78d99ea 100644
--- a/drivers/media/platform/rockchip/rkcif/rkcif-dev.c
+++ b/drivers/media/platform/rockchip/rkcif/rkcif-dev.c
@@ -281,6 +281,7 @@ static int rkcif_runtime_suspend(struct device *dev)
reset_control_assert(rkcif->reset);
udelay(5);
reset_control_deassert(rkcif->reset);
+ rkcif_mipi_irq_mask(rkcif);
clk_bulk_disable_unprepare(rkcif->clks_num, rkcif->clks);
@@ -298,6 +299,8 @@ static int rkcif_runtime_resume(struct device *dev)
return ret;
}
+ rkcif_mipi_irq_mask(rkcif);
+
return 0;
}
--
2.56.0
next prev parent reply other threads:[~2026-11-03 10:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:45 [PATCH 0/6] media: rockchip: rkcif: recover from a lost MIPI line Daniel Golle
2026-11-03 10:45 ` Daniel Golle [this message]
2026-11-03 13:04 ` [PATCH 1/6] media: rockchip: rkcif: mask MIPI interrupts when powered Michael Riesch
2026-11-03 10:45 ` [PATCH 2/6] media: rockchip: rkcif: fix the MIPI stop path locking Daniel Golle
2026-11-03 10:45 ` [PATCH 3/6] media: rockchip: rkcif: count the MIPI capture errors Daniel Golle
2026-11-03 10:45 ` [PATCH 4/6] media: rockchip: rkcif: restart the MIPI DMA when it slips Daniel Golle
2026-11-03 10:45 ` [PATCH 5/6] media: rockchip: rkcif: raise the MIPI DMA write priority Daniel Golle
2026-11-03 10:45 ` [PATCH 6/6] media: synopsys: csi2rx: handle the error interrupts Daniel Golle
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=24332831989fde000959b3d3037333f511b95ece.1793702189.git.daniel@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=bryan.odonoghue@linaro.org \
--cc=heiko@sntech.de \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@linux.intel.com \
--cc=michael.riesch@collabora.com \
--cc=sakari.ailus@linux.intel.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
all inboxes | Powered by JetHome®