lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 22 Feb 2024 17:01:36 +0530
From: Jai Luthra <j-luthra@...com>
To: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
        Mauro Carvalho Chehab
	<mchehab@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Hans
 Verkuil <hverkuil-cisco@...all.nl>,
        Vaishnav Achath <vaishnav.a@...com>,
        Maxime Ripard <mripard@...nel.org>, Rob Herring <robh@...nel.org>,
        Krzysztof
 Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley
	<conor+dt@...nel.org>
CC: <linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <devicetree@...r.kernel.org>, Vignesh Raghavendra <vigneshr@...com>,
        Aradhya
 Bhatia <a-bhatia1@...com>, Devarsh Thakkar <devarsht@...com>,
        Changhuang
 Liang <changhuang.liang@...rfivetech.com>,
        Jack Zhu
	<jack.zhu@...rfivetech.com>,
        Julien Massot <julien.massot@...labora.com>,
        Jayshri Pawar <jpawar@...ence.com>, Jai Luthra <j-luthra@...com>
Subject: [PATCH RFC 20/21] SQUASH: media: ti: j721e-csi2rx: Assert pixel
 reset before stopping last stream

With multi-stream support, make sure pixel reset is only asserted when
last-stream is stopped.

We assert this before stopping the stream to prevent issues with module
unload/reload. As the device's power domain cannot be cleanly switched
off by the firmware if stale data is present on the PSI-L endpoint,
which can happen if source was streaming but we pulling data out through
DMA.

Signed-off-by: Jai Luthra <j-luthra@...com>
---
 drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index c2d47507b3a7..0b9e0852da9f 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -560,8 +560,10 @@ static void ti_csi2rx_setup_shim(struct ti_csi2rx_ctx *ctx)
 	fmt = find_format_by_fourcc(ctx->v_fmt.fmt.pix.pixelformat);
 
 	/* De-assert the pixel interface reset. */
-	reg = SHIM_CNTL_PIX_RST;
-	writel(reg, csi->shim + SHIM_CNTL);
+	if (!csi->enable_count) {
+		reg = SHIM_CNTL_PIX_RST;
+		writel(reg, csi->shim + SHIM_CNTL);
+	}
 
 	reg = SHIM_DMACNTX_EN;
 	reg |= FIELD_PREP(SHIM_DMACNTX_FMT, fmt->csi_dt);
@@ -1008,9 +1010,11 @@ static void ti_csi2rx_stop_streaming(struct vb2_queue *vq)
 	struct ti_csi2rx_dev *csi = ctx->csi;
 	int ret;
 
-	video_device_pipeline_stop(&ctx->vdev);
+	/* assert pixel reset to prevent stale data on stopping last stream */
+	if (csi->enable_count == 1)
+		writel(0, csi->shim + SHIM_CNTL);
 
-	writel(0, csi->shim + SHIM_CNTL);
+	video_device_pipeline_stop(&ctx->vdev);
 	writel(0, csi->shim + SHIM_DMACNTX(ctx->idx));
 
 	ret = v4l2_subdev_disable_streams(&csi->subdev,

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ