mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 0/6] media: rockchip: rkcif: recover from a lost MIPI line
Date: Tue, 3 Nov 2026 10:45:12 +0000	[thread overview]
Message-ID: <cover.1793702189.git.daniel@makrotopia.org> (raw)

The VICAP MIPI DMA ends a frame after the configured number of lines
and the sensor frame start does not reset that count. A line dropped on
the CSI-2 link therefore leaves every later buffer composed of the tail
of one frame and the head of the next, with the Bayer phase flipped
when the offset is odd, until the capture is restarted. This was seen
on an RV1126 (same VICAP MIPI block as the RK3568) with an IMX415 after
a night of streaming, and it can be provoked at will by shortening the
D-PHY settle time for a second.

The series makes the capture notice the slip and recover, and makes
the two blocks involved report what they see:

- patch 1 masks the MIPI interrupt sources that come out of reset
  enabled, which otherwise keep the line asserted until the kernel
  disables the interrupt;
- patch 2 replaces the subdev state mutex taken on the stop path, which
  the interrupt handler calls, with a spinlock around the shared
  interrupt registers;
- patch 3 enables and counts the VICAP error interrupts in debugfs;
- patch 4 reads the line counter at every frame start and restarts the
  stream through the existing stop and start paths once two frames in
  a row show an offset, as the runtime suspend in between is what
  resets the counter;
- patch 5 programs the DMA write priority the vendor driver uses;
- patch 6 lets the Synopsys CSI-2 receiver request its err1 and err2
  interrupts and count the error classes in debugfs.

Tested on an RV1126 board (vendor DT, rkcif and dw-mipi-csi2rx with
local RV1126 compatibles) with the fault injection described in patch
4; the RK3568 and RK3588 register layouts for the error bits and the
line counter come from the vendor kernel and are untested here.

Daniel Golle (6):
  media: rockchip: rkcif: mask MIPI interrupts when powered
  media: rockchip: rkcif: fix the MIPI stop path locking
  media: rockchip: rkcif: count the MIPI capture errors
  media: rockchip: rkcif: restart the MIPI DMA when it slips
  media: rockchip: rkcif: raise the MIPI DMA write priority
  media: synopsys: csi2rx: handle the error interrupts

 .../rockchip/rkcif/rkcif-capture-mipi.c       | 210 ++++++++++++++++--
 .../rockchip/rkcif/rkcif-capture-mipi.h       |   2 +
 .../platform/rockchip/rkcif/rkcif-common.h    |  23 ++
 .../media/platform/rockchip/rkcif/rkcif-dev.c |   8 +
 .../platform/rockchip/rkcif/rkcif-regs.h      |   2 +
 .../platform/rockchip/rkcif/rkcif-stream.c    |  64 ++++++
 .../platform/rockchip/rkcif/rkcif-stream.h    |   2 +
 .../media/platform/synopsys/dw-mipi-csi2rx.c  | 125 ++++++++++-
 8 files changed, 409 insertions(+), 27 deletions(-)


base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
-- 
2.56.0

             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 Daniel Golle [this message]
2026-11-03 10:45 ` [PATCH 1/6] media: rockchip: rkcif: mask MIPI interrupts when powered Daniel Golle
2026-11-03 13:04   ` 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=cover.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®