From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91108CAC5A7 for ; Thu, 25 Sep 2025 15:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3dAhM4kxmLGcTcm+Rq218XXlog9lMH2TW9M9tQ7guK8=; b=joaTagOXlvEyaURMbq1KRb3CJ2 /i84OXhDxCdjppxVqN+ld/UKOzLm+2FsHeqZ4lS0I5lIkR7LVhY+kXpBE8rwHBIMiOugyTdGnrYf7 yjNA6sY69Z7kh7H05LYXVxBa+NJu32ICxCU196mPv1EsxrnwgHJsop0x3nfksH55Pmy744KzkgUVT ZD8fUhqTyyWbyXK3eRGE8qtm7+au+YDB3hAkcmOJJdw3JPUDaXA6yaZWWov/Zi1/dG9yjKCVRVNTf m7wJJJvfPPqtFrUfev5RR8i3yvBN8qk7ukARW8T7lN04eMp+idonzXswvXooqIr62Zi3Hx7xVnpAw CrPoWbVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v1oJx-0000000Asyr-3oE3; Thu, 25 Sep 2025 15:55:49 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v1oJg-0000000Asc1-0Vd4 for linux-arm-kernel@lists.infradead.org; Thu, 25 Sep 2025 15:55:33 +0000 Received: from [127.0.1.1] (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8760AD0; Thu, 25 Sep 2025 17:54:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758815644; bh=/lYx9HajpxPlfcmmhJX0reUWRFqHU9LFR9AeyxwXFvs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kPzyiha4JC5Hq+Csjvya3qKr/yrHn0ySD9dej4E3Z14t/3SUAjucOnnZeWwSY9Dpk r2MdDMzyvk5zcf29zim9/bqMAXX1kLBzovOzdeFq/biX9/51ojTqd2EiViTF6CEFJV zXRUSdQO+EAAfyCREfn7dMuXFmsThJVj+6LfMCto= From: Isaac Scott Date: Thu, 25 Sep 2025 16:54:29 +0100 Subject: [PATCH v4 4/4] media: imx-mipi-csis: Get number of active lanes via mbus_config MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250925-active-data-lanes-v4-4-8b54e3d5af6c@ideasonboard.com> References: <20250925-active-data-lanes-v4-0-8b54e3d5af6c@ideasonboard.com> In-Reply-To: <20250925-active-data-lanes-v4-0-8b54e3d5af6c@ideasonboard.com> To: Mauro Carvalho Chehab , Rui Miguel Silva , Laurent Pinchart , Martin Kepplinger , Purism Kernel Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Sakari Ailus Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Isaac Scott X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250925_085532_313488_3AF5EB5B X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The number of lanes actively used by a MIPI CSI transmitter may differ from that which is defined in device tree, due to the source device not using all of the connected data lanes on the board. As such, call on v4l2_get_active_data_lanes() to check if the driver reports a differing number of lanes to the maximum, and use that number of active lanes. If the number of active data lanes is invalid, or the op is not supported, use the maximum number of allowed data lanes. Signed-off-by: Isaac Scott --- drivers/media/platform/nxp/imx-mipi-csis.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c index 838a1ad123b5..637ef6e614fa 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -1034,6 +1034,10 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable) format = v4l2_subdev_state_get_format(state, CSIS_PAD_SINK); csis_fmt = find_csis_format(format->code); + ret = v4l2_get_active_data_lanes(csis->source.pad, + csis->bus.num_data_lanes); + csis->num_data_lanes = ret < 0 ? csis->bus.num_data_lanes : ret; + ret = mipi_csis_calculate_params(csis, csis_fmt); if (ret < 0) goto err_unlock; -- 2.43.0