Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp280077rdb; Thu, 22 Feb 2024 03:39:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWyQuk5DRkZwStsYRIL6LpKIQgW9bAkj2wqOBqLzZ3L4YPdf2CrE5mSEOOI9HiYQQuN2sdZC/R3Bre6BMr7vMayrrUczwDFvjl+XWH0Tw== X-Google-Smtp-Source: AGHT+IGjSzbAIeOSDlzCj5BC+l0NIoueWFMSEfbUHX405AcKmFQBISzGGstiYyumYC0KsjXIIjgO X-Received: by 2002:a05:622a:1445:b0:42c:65cb:7bb4 with SMTP id v5-20020a05622a144500b0042c65cb7bb4mr26985971qtx.29.1708601947667; Thu, 22 Feb 2024 03:39:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601947; cv=pass; d=google.com; s=arc-20160816; b=d76KtCEeztl/nuJdyaGoQb/19oWFfSXTt73YT3O5R55OBXSTCxQxu3JrAKlHn4ipI8 8FTE2D5Su+8MePk/HD2nkD9GvsvuPHnQ7gzQl9EKxHb+0anpX1xHbqqyknYsLGy2akDd CpbXRn72TnKjubmH3ESk1qXyri7DlEQLET8BXgaQaKULO/vG9mdo+ebM/5SdFKVOrfFn Yew9bPtwEs8LmQxfpgXdkd4+5+itKuGVPCIuntXiEX8MRQiyp+jIDz6K9jQ1/473IoSC RsqpGf0irmHfymnGuHxp/jH5ENjU39EpkDDD9zPvUSJkirlETD59EDY5kgkgCMYTBsHz 8rHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=h4Cf3SOkx3K5Auy7bEc25EsHCsaRMY7o1BWV1atNTG4=; fh=7Ze5xPQXuwRxFNHD2ILqwMPZ5wjg3PcSuREjIh8VhDo=; b=xaCoknkyMbwz2Fyujd8RXPlQdqFUiy73/CG7rnEU0IY3sP3NrrMKCAgFeNtwOMrdOD u6gym9jlh0dxYdPwKstRyhgZyRU47yssy/J4+9koMH95VXs5zm9uyhJQr4IlA4cVdGA9 kxhYNlhdJAwiwi1hiim2C/4poUaNvgxc4vnxTc8i50xGC1z/JZZKVrl12kH7cNLNHNci suOXZ0LCXZf9G9Cx3io06oxDjmIdmrsLdgNTXsVtW2Vw5lrqj+4WT52lfirs/oLNRVlj rb00GRe5EAfYWRUp8L2Njcy7rPkYLUloQECiIpifgoizt5cCcwCWmHqQBY/gptpbL9++ vjUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kMqR/1EM"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o13-20020ac8554d000000b0042c33cae5b5si11458345qtr.239.2024.02.22.03.39.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:39:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="kMqR/1EM"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76433-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BDD91C2255F for ; Thu, 22 Feb 2024 11:39:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C470756B79; Thu, 22 Feb 2024 11:33:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="kMqR/1EM" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4395F5646A; Thu, 22 Feb 2024 11:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601638; cv=none; b=mi1Ve1womNP0/LtDzgpY36zaFLUNCIIYNpkttnSxTxLSgYAJ4HqqaqimsJCGbFpI/gAezr4pDlEuGzy2GR2DbXixu0sqhvym8uRtSBxQuNuLlXcBP4YIPNxUK/6ovL48pXCmrjXf96KBP0HLsqlC0V/YTowPwQG2TRncRKypm3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601638; c=relaxed/simple; bh=UHhcmDEpCe+fIBZF6t/hU6vqn9E2M2zqDvurAxx6H4c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ZcutceKj2MWJSVaO8An4H6IykPmEZbK5yDFsAjWYN8TBh++qO7D2+yS91TFoHgwU9WocHpV70J+NILSeXEA23VQtjipdGUh+VyQGw9tzjDZ/8ihvpdw43keKmcd4mHcJP+zZtP1DZk2MKvrVS9WLHgJFw/Qp0BME4KgxVhHcAkw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=kMqR/1EM; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXif6027847; Thu, 22 Feb 2024 05:33:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708601624; bh=h4Cf3SOkx3K5Auy7bEc25EsHCsaRMY7o1BWV1atNTG4=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=kMqR/1EMKXtPJF73iXF9EFR+Y8migT5oWQly0ShGGHk1tNyazg2dN9pf3i90iyyyq MlNY9Nxjw8/m/6Nfw8hCpWTvBVNgdY1Dzl43o5c2/Q4ASpnH9U7E3wUdrkOPm4+hJE +8Vp404BBqusysKBxjmaXPvmjJI0syFNGZby7PWU= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41MBXiVH014442 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2024 05:33:44 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 22 Feb 2024 05:33:44 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 22 Feb 2024 05:33:44 -0600 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.217]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXhGP091587; Thu, 22 Feb 2024 05:33:43 -0600 From: Jai Luthra Date: Thu, 22 Feb 2024 17:01:36 +0530 Subject: [PATCH RFC 20/21] SQUASH: media: ti: j721e-csi2rx: Assert pixel reset before stopping last stream Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240222-multistream-v1-20-1837ed916eeb@ti.com> References: <20240222-multistream-v1-0-1837ed916eeb@ti.com> In-Reply-To: <20240222-multistream-v1-0-1837ed916eeb@ti.com> To: Tomi Valkeinen , Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Vaishnav Achath , Maxime Ripard , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , Vignesh Raghavendra , Aradhya Bhatia , Devarsh Thakkar , Changhuang Liang , Jack Zhu , Julien Massot , Jayshri Pawar , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1832; i=j-luthra@ti.com; h=from:subject:message-id; bh=UHhcmDEpCe+fIBZF6t/hU6vqn9E2M2zqDvurAxx6H4c=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBl1zDtxulJ5vwh1hk7rUtv04y9hAoMjlAfOaM/I 946Exq1leuJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZdcw7QAKCRBD3pH5JJpx RXT2EADGCihGFKE4jnCo389SggQfrAJRxINhD00hY+I8PSgr5Q8Dphg/C/Wjb8E0bPcqoebJLhs EWC+WB2CDiGO/GxMyeZiMxOHqVWOJeRXDEBaZzkaOzu0wCg8tb31WopXSrBvz9e7IcsTM6ilVSV mp7hlpiXzCofr/F/lAY3TWkKzkzgF3Ix8j6lZiO9l4JiMzduDQT4FlRcP1sV3Ay+mq5gxsbJnjQ fSpo9m3cO+YgY9p4+qhhekjagSAD/NG4QZ6TTdeYCnC0CBgb/6qRaznGv0EEIhilw6MCpkqGgME m/oBtaHC+lEViiolUOvsTOjv4Pm5aKRNhUC7YMMyET0H00qy8lSBbnd5bvib4W6icXUJd0Lz2TX Vlo/d0mx7s68KFtd+0E3uN77ni1AyR+uBZzW3qTZOq2Hf4pt/s9RBKG2DS59+cI0kMHmThgbUZZ T7iRcIKMgAHoA38iBktZToF+UC8VmAN6pqY9qVcQWLtGVNWz0BI24ZtuVkCL2DjEzpRcNY38jmn l1Xp0bhXL0dEwm3RwfvQbWYxYINVSalySZt4zFTmy0eVw6kNaly2Xfdw3FF3H6GVUJ3adN8hp17 9iFu2Z1XJgwv2Vr6xwCxqOa5T5LbU8Q37F79vnGJ/rztw/v8PbUycns2T8lQiYQm9HUYqjsjqje eMNosTG92fZifng== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 --- 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