mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Detlev Casanova <detlev.casanova@collabora.com>,
	 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Heiko Stuebner <heiko@sntech.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	 Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	 Alex Kazinsky <a.kazinsky@ideco.ru>,
	stable@vger.kernel.org,  Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v2 2/2] media: rkvdec: Stop the VDPU383 core on timeout
Date: Tue, 01 Dec 2026 10:30:54 +0000	[thread overview]
Message-ID: <20261201-rkvdec-wdt-stop-v2-2-0f2662ea15e8@gmail.com> (raw)
In-Reply-To: <20261201-rkvdec-wdt-stop-v2-0-0f2662ea15e8@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

The watchdog's RK3399 register write does not stop a VDPU383 core
either. Use the IP reset, as the Rockchip BSP does, then reprogram the
IOMMU, which the reset leaves in bypass. No reset line pulse: on RK3576
the DT lines are the BIU resets.

Compile-tested only.

Fixes: fde24907570d ("media: rkvdec: Add H264 support for the VDPU383 variant")
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 .../platform/rockchip/rkvdec/rkvdec-vdpu383-regs.h   |  4 ++++
 drivers/media/platform/rockchip/rkvdec/rkvdec.c      | 20 +++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-regs.h b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-regs.h
index da46f8601fcce..bd742af9d6f38 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-regs.h
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-regs.h
@@ -33,6 +33,9 @@
 #define VDPU383_LINK_DEC_ENABLE		0x40
 #define VDPU383_DEC_E_BIT		BIT(0)
 
+#define VDPU383_LINK_IP_RESET		0x044
+#define VDPU383_IP_RESET_EN		BIT(0)
+
 #define VDPU383_LINK_INT_EN		0x048
 #define VDPU383_INT_EN_IRQ		BIT(0)
 #define VDPU383_INT_EN_LINE_IRQ		BIT(1)
@@ -40,6 +43,7 @@
 #define VDPU383_LINK_STA_INT		0x04c
 #define VDPU383_STA_INT_DEC_RDY_STA	BIT(0)
 #define VDPU383_STA_INT_SOFTRESET_RDY	(BIT(10) | BIT(11))
+#define VDPU383_STA_INT_IP_RESET_RDY	BIT(11)
 #define VDPU383_STA_INT_ALL		0x3ff
 
 /* Reference read cache, in the "cache" register region */
diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
index 3d40f5f059c33..d6cc88a79f70c 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
@@ -1667,6 +1667,24 @@ static void vdpu381_stop(struct rkvdec_dev *rkvdec)
 	rkvdec_iommu_restore(rkvdec);
 }
 
+static void vdpu383_stop(struct rkvdec_dev *rkvdec)
+{
+	void __iomem *link = rkvdec->link;
+	u32 status;
+
+	writel(FIELD_PREP_WM16(VDPU383_INT_EN_IRQ | VDPU383_INT_EN_LINE_IRQ, 0),
+	       link + VDPU383_LINK_INT_EN);
+	writel(VDPU383_IP_RESET_EN, link + VDPU383_LINK_IP_RESET);
+	if (readl_poll_timeout_atomic(link + VDPU383_LINK_STA_INT, status,
+				      status & VDPU383_STA_INT_IP_RESET_RDY,
+				      1, 200))
+		dev_warn(rkvdec->dev, "IP reset failed\n");
+	writel(FIELD_PREP_WM16(VDPU383_STA_INT_ALL | VDPU383_STA_INT_SOFTRESET_RDY, 0),
+	       link + VDPU383_LINK_STA_INT);
+
+	rkvdec_iommu_restore(rkvdec);
+}
+
 static void rkvdec_watchdog_func(struct work_struct *work)
 {
 	struct rkvdec_dev *rkvdec;
@@ -1802,7 +1820,7 @@ static const struct rcb_size_info vdpu383_rcb_sizes[] = {
 
 static const struct rkvdec_variant_ops vdpu383_variant_ops = {
 	.irq_handler = vdpu383_irq_handler,
-	.stop = rk3399_stop,
+	.stop = vdpu383_stop,
 	.colmv_size = vdpu383_colmv_size,
 	.flatten_matrices = vdpu383_flatten_matrices,
 	.config_cache = rkvdec_vdpu383_config_cache,

-- 
2.55.0



      parent reply	other threads:[~2026-12-01 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 10:30 [PATCH v2 0/2] media: rkvdec: Stop VDPU381 and VDPU383 cores " Arun Iyengar via B4 Relay
2026-12-01 10:30 ` [PATCH v2 1/2] media: rkvdec: Stop the VDPU381 core " Arun Iyengar via B4 Relay
2026-12-01 10:30 ` Arun Iyengar via B4 Relay [this message]

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=20261201-rkvdec-wdt-stop-v2-2-0f2662ea15e8@gmail.com \
    --to=devnull+aiyengar1990.gmail.com@kernel.org \
    --cc=a.kazinsky@ideco.ru \
    --cc=aiyengar1990@gmail.com \
    --cc=detlev.casanova@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --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=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=stable@vger.kernel.org \
    /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®