Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp278162rdb; Thu, 22 Feb 2024 03:34:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZIXZRzf5jtf7wUwVJm/U8dDvQvGVeqGDmT1lYwBn4/fLAFX6fZv4vjxmylS0bU7DkNZaHiFBhSvede+QeGzbn+wh+C5+dixrNMtgaog== X-Google-Smtp-Source: AGHT+IF9hdj4MaUtqlJvipw3AsSzHRh3VbVmnJhCdM2U+75TV+CJZNJbDaUXY9I1E3nCQ/fyAr7H X-Received: by 2002:a05:620a:575:b0:787:7604:9450 with SMTP id p21-20020a05620a057500b0078776049450mr7496328qkp.2.1708601674600; Thu, 22 Feb 2024 03:34:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601674; cv=pass; d=google.com; s=arc-20160816; b=lTa4BACi3bV/yB0j5SQrBgHslVcAlMi6Z7Lf0Mk3YbrDjZL1NknVfU0wYUlkvlN2Lm aZhBL4XP66QLRhsV5AtaM6Nd+1+ttuF5OD6QqIa7L9S/kPYnHMskGM/gKVm3psjoBBKo I/hB/VOSv5b3/omYohSaJ+ycILUo+pWXOAAXyYknagT9D/+Hh2HQxTOnJ65Li5m6G6Pr CzRynsszFcAKQ23BbictbFH4weXrdfiUKQ39UB/wkxt8QnRHnamJZW2aXjdJqa+6rS7A mIh0bFBWaPspmGh/W45PkAwwWZotpxmPL4YVtvB+UkMDcE7JHnsPk6A1RLJwemfOSEJK WTGw== 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=2cNr2W9c0uUvSVuROSL/j2Uzf+2G2fP0MYHF6MQhS7M=; fh=7Ze5xPQXuwRxFNHD2ILqwMPZ5wjg3PcSuREjIh8VhDo=; b=CCdHCc+CQZQGG6p+TY/kWqCAmNpD3CUseggkcLe8qgbrCHVW6yU70udOHlGwa+uyRL +vDZ6aE1cVk2rxBPvdnRm609URBf4m/Aojc6hwEVpC8uvV3wgswFYd14AW06OcY3mvhq TMsr6CEUyQZPznh9xYGs5XxKtBBDf+0Is3YSP7uyWX+FNMI9nIZiCdUKoqPkp4XxrZzb 6GFZctXczQl2T0I8DS1h8fiIe38WueeyXIt4r2K3DeHZZUN16O+Nt6QnV4kQhHtktfnL yXkicMvV1Rwu+eJckZgCNQJrcGQCGpjxJ1JxewLiiAhRxihCrCUjtgh7IW0LIouahydV Zh8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=lvGKYUpE; 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-76417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76417-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 vq27-20020a05620a559b00b00785d9a6c77dsi13046502qkn.450.2024.02.22.03.34.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:34:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76417-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=lvGKYUpE; 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-76417-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76417-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 4BA411C23571 for ; Thu, 22 Feb 2024 11:34:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3691482EB; Thu, 22 Feb 2024 11:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lvGKYUpE" 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 28627482CA; Thu, 22 Feb 2024 11:33:33 +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=1708601616; cv=none; b=lIMjL3hXVYmAQCSzjlF/0ufgyIDHPqxdI7Kwhz5lPoKzdWCJjhbm1Txkg9mUKNPsIGevdb5I2IcCopFKp3E4fXy9E29AeCl9mvorRZ/qZXN6Lm3ENIvqUyIc9I2xLMa5QOKC2kX/n+qIVecOiT2RdDUTMlX+5nl9A5IPiBc1Ax0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601616; c=relaxed/simple; bh=im2b3XkRWHVDjENKTL39XO+OkPYZPgPa/EbqRfvqcr0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PpwVN5MzlCXdiWnwADMWD/m42kCOKTD0nt355blESfANp+GAJTATsDv2/ex+0NiEx9L2i+ZDaHLOyLyCNfwYMkVCJAA4YRp65VdEMEZ+R4q/UcX3hvpgrCd/VjIeNeq7rvDZFxWZWXsWeLqQVEISLSA0EiAOJpT0qpCX82Gl2eQ= 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=lvGKYUpE; 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 fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41MBX9F7027774; Thu, 22 Feb 2024 05:33:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708601589; bh=2cNr2W9c0uUvSVuROSL/j2Uzf+2G2fP0MYHF6MQhS7M=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=lvGKYUpEXvpx56rZAYJarKRBpUBbwsk1qJxq1DIN8Ff3429hAGiH/yLakW7P42Qyz lmmilnJFYmGLsGxME6UtDoim/rt5023qnMToheBTu2ur8Ugt30fSQX53jBGVsK/X3G JDZkKp+ZE+NxU1rpSDMVCdRqNx9V7ZaIo7IfWnNc= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41MBX9he056994 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2024 05:33:09 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE115.ent.ti.com (157.170.170.26) 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:08 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE115.ent.ti.com (157.170.170.26) 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:08 -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 41MBX7Zi090935; Thu, 22 Feb 2024 05:33:07 -0600 From: Jai Luthra Date: Thu, 22 Feb 2024 17:01:18 +0530 Subject: [PATCH RFC 02/21] media: cadence: csi2rx: configure DPHY before starting source 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-2-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=2426; i=j-luthra@ti.com; h=from:subject:message-id; bh=PdPEqazmXTfXDrKucBNAcGZRh84r972NesVdYj6Urnc=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBl1zDb6Btyd3l4s3XpQ/yhAgO7WB8o/94UBxhg+ XZYNViZIxWJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZdcw2wAKCRBD3pH5JJpx RVpsD/wIaFvgYeOJgz5+wO05LNXrzihOfqTYOxNbgEkhoLL6v3JEki/UwYlZeSMoOf69WgModFv hcb5p3UWzSb7LAMOpYW2Bu2xl3i6xYuDW8SKgMuIqHNoI2J3whJcCbLyjkiVGTZFh/ZcgZkio8M jCuNGH+FkFvBRwKhFYx70Hzbdj6rP8B8o5cOR3C3PtLAGUBNoNnB6mKF6cAhnYdQJJGRCYQPeLm 8x6RfzUwiTyD1spj7gD89t6Omp4MtX5hnoEubWqzyBFpM5Sc88CjtoOF+mSyxL9wlXZ+KkKlesj g/Nq50PR9i9GKE1Pr/LVBcsFrYdrS+pjQzK1HL1MNmu/WDFHYSNembITaVxlS57amJXjzAoBF5G h8p2swwvmerLrnfoETDGP5huLmknB8KuA1ZbXyrd09NTgEcsWG9MQ6DOTWh1Sfxj4Fe40x3zezf Pqslw41+wN7dcd98yCOzlE309H3eZXPTwPlBDotOnDsHZGTV/F4w3vjtW9smURa/krS9p8UVKof frq1G4NfQlmFaPCCFcHrHb3kZQnwMUeIlQJ9ExL/ejJi02kqmHbFTLIVdKf3IxT0aaDTOocsg7N 61To7EuKBHPpaI3JPySWycPeejbzLZ7SnOxvx7wKj8QBdb4SYzd9wl0E3jxqJdXT0pfoXDFFIh1 YKIMsDs2rR+HTVA== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 From: Pratyush Yadav When the source device is operating above 1.5 Gbps per lane, it needs to send the Skew Calibration Sequence before sending any HS data. If the DPHY is initialized after the source stream is started, then it might miss the sequence and not be able to receive data properly. Move the start of source subdev to the end of the sequence to make sure everything is ready to receive data before the source starts streaming. Signed-off-by: Pratyush Yadav Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 70b7f8a9e4f2..75e602c1d762 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -243,10 +243,6 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) writel(reg, csi2rx->base + CSI2RX_STATIC_CFG_REG); - ret = v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, true); - if (ret) - goto err_disable_pclk; - /* Enable DPHY clk and data lanes. */ if (csi2rx->dphy) { reg = CSI2RX_DPHY_CL_EN | CSI2RX_DPHY_CL_RST; @@ -256,6 +252,13 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) } writel(reg, csi2rx->base + CSI2RX_DPHY_LANE_CTRL_REG); + + ret = csi2rx_configure_ext_dphy(csi2rx); + if (ret) { + dev_err(csi2rx->dev, + "Failed to configure external DPHY: %d\n", ret); + goto err_disable_pclk; + } } /* @@ -295,14 +298,9 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) reset_control_deassert(csi2rx->sys_rst); - if (csi2rx->dphy) { - ret = csi2rx_configure_ext_dphy(csi2rx); - if (ret) { - dev_err(csi2rx->dev, - "Failed to configure external DPHY: %d\n", ret); - goto err_disable_sysclk; - } - } + ret = v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, true); + if (ret) + goto err_disable_sysclk; clk_disable_unprepare(csi2rx->p_clk); @@ -316,6 +314,10 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) clk_disable_unprepare(csi2rx->pixel_clk[i - 1]); } + if (csi2rx->dphy) { + writel(0, csi2rx->base + CSI2RX_DPHY_LANE_CTRL_REG); + phy_power_off(csi2rx->dphy); + } err_disable_pclk: clk_disable_unprepare(csi2rx->p_clk); -- 2.43.0