From nobody Sat Feb 7 07:25:51 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B58EE258ED1; Wed, 22 Oct 2025 10:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128559; cv=none; b=pAgTvn67tr45vY+MYHvLutRsH3YZaCZMottGu5pUpDLsJxNP9PoUD8BksdrlWJwUZUg9LcfamN3en7aMScnUtAKz7t3EQvnkGYf77iKbYfh6z8eWHxi6osSWBB8zjGOaUQaAwf2Uw5ZgPluPJ9352wxNoLUhG4f2kSeFqFNqrNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128559; c=relaxed/simple; bh=Snr3gpZ7+iGBKLCS7AvL2UYxmpcLXIBEkGrG9qyjAbA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sUYg3edwy1S8yuouTKEGQqFX0K4mhU9R/DxHZGyYRWfj/s936Mv5Rf9brgl+jNin3/gnIKGJ3YuCSgboGrMDFuqeBXGLkhF59IQ+tJgrYeAE0sVusZ5CxdAXfn17sOolox3H3d7R3QrlshqTA27MqEwE9jcHkm1u0PkZdiHnUkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=qluBMNrA; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qluBMNrA" Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3AF8C8FA; Wed, 22 Oct 2025 12:20:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761128451; bh=Snr3gpZ7+iGBKLCS7AvL2UYxmpcLXIBEkGrG9qyjAbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qluBMNrAEWD4GTaCR5h+4JCrn7OCRdtwCHPbVa/lr23RVBmDuj/mwIfP/IQSjESQn Y0E/Mfz/qtSlVx9L669LIXwJMPjcrzsxSTDNH8NEKZTA1NRtLRuYatWDNorpSBtcCQ 4bThNWWYnm5xhtQHJx77QMCYcu7KKP/DoCjuJExQ= From: Isaac Scott To: mchehab@kernel.org Cc: rmfrfs@gmail.com, laurent.pinchart@ideasonboard.com, martink@posteo.de, kernel@puri.sm, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank.Li@nxp.com, Isaac Scott Subject: [PATCH v5 1/4] media: v4l: Add helper to get number of active lanes via a pad Date: Wed, 22 Oct 2025 11:22:25 +0100 Message-ID: <20251022102228.275627-2-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022102228.275627-1-isaac.scott@ideasonboard.com> References: <20251022102228.275627-1-isaac.scott@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Sometimes, users will not use all of the MIPI CSI 2 lanes available when connecting to the MIPI CSI receiver of their device. Add a helper function that checks the mbus_config for the device driver to allow users to define the number of active data lanes through the get_mbus_config op. If the driver does not implement this op, fall back to using the maximum number of lanes available. Reviewed-by: Frank Li Reviewed-by: Laurent Pinchart Signed-off-by: Isaac Scott --- drivers/media/v4l2-core/v4l2-common.c | 29 +++++++++++++++++++++++++++ include/media/v4l2-common.h | 20 ++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-cor= e/v4l2-common.c index b367d479d6b3..2b4cec25e751 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -573,6 +573,35 @@ s64 v4l2_get_link_freq(const struct media_pad *pad, un= signed int mul, return v4l2_get_link_freq_ctrl(sd->ctrl_handler, mul, div); } EXPORT_SYMBOL_GPL(v4l2_get_link_freq); + +unsigned int v4l2_get_active_data_lanes(const struct media_pad *pad, + unsigned int max_data_lanes) +{ + struct v4l2_mbus_config mbus_config =3D {}; + struct v4l2_subdev *sd; + unsigned int lanes; + int ret; + + sd =3D media_entity_to_v4l2_subdev(pad->entity); + ret =3D v4l2_subdev_call(sd, pad, get_mbus_config, pad->index, + &mbus_config); + if (ret < 0 && ret !=3D -ENOIOCTLCMD) + return ret; + + /* This relies on the mbus_config being zeroed at init time */ + lanes =3D mbus_config.bus.mipi_csi2.num_data_lanes; + if (!lanes) + return max_data_lanes; + + if (lanes > max_data_lanes) { + dev_dbg(sd->dev, "Active data lanes (%u) exceeds max (%u)\n", + lanes, max_data_lanes); + return -EINVAL; + } + + return lanes; +} +EXPORT_SYMBOL_GPL(v4l2_get_active_data_lanes); #endif =20 /* diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 5c0a7f6b5bb6..950df46cb27a 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -581,6 +581,26 @@ int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane = *pixfmt, u32 pixelformat, #ifdef CONFIG_MEDIA_CONTROLLER s64 v4l2_get_link_freq(const struct media_pad *pad, unsigned int mul, unsigned int div); + +/** + * v4l2_get_active_data_lanes - Get number of active data lanes from driver + * + * @pad: The transmitter's media pad. + * @max_data_lanes: The maximum number of active data lanes supported by + * the MIPI CSI link in hardware. + * + * This function is intended for obtaining the number of data lanes that a= re + * actively being used by the driver for a MIPI CSI-2 device on a given me= dia pad. + * This information is derived from a mbus_config fetched from a device dr= iver + * using the get_mbus_config v4l2_subdev pad op. + * + * Return: + * * >0: Number of active data lanes + * * %-EINVAL: Number of active data lanes is invalid, as it exceeds the m= aximum + * supported data lanes. + */ +unsigned int v4l2_get_active_data_lanes(const struct media_pad *pad, + unsigned int max_data_lanes); #endif =20 void v4l2_simplify_fraction(u32 *numerator, u32 *denominator, --=20 2.43.0 From nobody Sat Feb 7 07:25:51 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 DB836321441; Wed, 22 Oct 2025 10:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128561; cv=none; b=DlhnMstptaQqwC0/3c6RoUwnxrgYb3tM71Wz4gFqv1cBWPVGheAitswEGEQS5nF4uo9a6Tff5IMAuSXYOqpb7OQRbtTv2qKXheFxdl356J39akOb14pgLpUpDcHF5wd9I2sfa4ZKTzL8ZKoxJyV9m7ZA0CjVg/KA/DEaokUmuVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128561; c=relaxed/simple; bh=VxO5Aj0CaA/Xh87egtihuudIrRwyIJF9QzHLMV50RiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HbwJcY3d3HG+5sW7Be9RJ/MeFH0kTfSgwkkTRwRD6oG1DYWMIcu4c2BT6DEimn/Gk8/O+Tf0SJ3cFByeaAfI6ini71+hum+yk3q9GYU+rUmZlz925eew04GP0NElB4Y/fTIXoyDK2ywIShd4sq/0R1xZDQutdpGdyddt23SbDLw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=cFL95oC+; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cFL95oC+" Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E2F2B13E2; Wed, 22 Oct 2025 12:20:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761128453; bh=VxO5Aj0CaA/Xh87egtihuudIrRwyIJF9QzHLMV50RiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFL95oC+tTdBZATzozukND6oxsVTvmemEO3wxGXEpqNtAjf7CQqCDMHyaNmLKVJG0 xJ9P7X8B5UltcgO2uLMZW1MKB3UBRxkVSZLgUla9jF7jU2enJRc5nR+0ufmrDk90Kk 06DpB/G6sai9TuzroadQB8CxGLR+OLkT2x4lojZI= From: Isaac Scott To: mchehab@kernel.org Cc: rmfrfs@gmail.com, laurent.pinchart@ideasonboard.com, martink@posteo.de, kernel@puri.sm, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank.Li@nxp.com, Isaac Scott Subject: [PATCH v5 2/4] media: imx-mipi-csis: Move redundant debug print in probe Date: Wed, 22 Oct 2025 11:22:26 +0100 Message-ID: <20251022102228.275627-3-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022102228.275627-1-isaac.scott@ideasonboard.com> References: <20251022102228.275627-1-isaac.scott@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The number of data lanes is already printed as part of mipi_csis_async_register(), making the first part of this print redundant. Remove the redundant print, and move the debug print for clock frequency to mipi_csis_parse_dt(). Reviewed-by: Frank Li Signed-off-by: Isaac Scott Reviewed-by: Laurent Pinchart --- drivers/media/platform/nxp/imx-mipi-csis.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/pla= tform/nxp/imx-mipi-csis.c index d5de7854f579..7c2a679dca2e 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -1481,6 +1481,7 @@ static int mipi_csis_parse_dt(struct mipi_csis_device= *csis) struct device_node *node =3D csis->dev->of_node; =20 of_property_read_u32(node, "clock-frequency", &csis->clk_frequency); + dev_dbg(csis->dev, "clock frequency: %u\n", csis->clk_frequency); =20 csis->num_channels =3D 1; of_property_read_u32(node, "fsl,num-channels", &csis->num_channels); @@ -1566,9 +1567,6 @@ static int mipi_csis_probe(struct platform_device *pd= ev) goto err_unregister_all; } =20 - dev_info(dev, "lanes: %d, freq: %u\n", - csis->bus.num_data_lanes, csis->clk_frequency); - return 0; =20 err_unregister_all: --=20 2.43.0 From nobody Sat Feb 7 07:25:51 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 57E9D320A14; Wed, 22 Oct 2025 10:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128562; cv=none; b=Ke13PLSL7l2dJvcCg3dHk2I+CElUIeS26h05zv7cSRja7ih7RfWmU2DsE1HERbzzEK+loZVds4D4GpxcrblS89TVWvA2Et8bLYBC1JU9uPilrNzUueb8Xj0neCs2zl+wdrobrPUM+YddbOcenUxRKYGUIxVQITRFDtfhdxJBvxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128562; c=relaxed/simple; bh=eU7+9lvn1wXXDAWFpo385VYn8UrQoBf/4gTT0jovtdY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iaJUDIztKL+63W1vpEBBWYPo/YjgiJxTLsKGI6bJc9sYXKiwXt5RREpQrkuI9wCXjYbtFbRdNsYWSBZOUVsovG9+3WtXqBlmHZT0OE3DvrMaC/6Y2AEgqhUKlf80z6MT2uHrxM/9QjyH6Cch5uLs5sEjryQqwWwhAtEo8XhHhgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=RcJclDkd; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RcJclDkd" Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C9FC1772; Wed, 22 Oct 2025 12:20:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761128455; bh=eU7+9lvn1wXXDAWFpo385VYn8UrQoBf/4gTT0jovtdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RcJclDkdnzACQGsF7LeKPtXLbSdVZQfyJnWuqryb/9rCTg97RN+Hk4ARIc2D/JL8q jvsDPRFnciW2HR+ifbFJbRYYVVUV/BjC+CxTD9NqBudlK5F4FH85088L/lDHqIt6ck KaGlnQuDNNs/0fXrNiNUYlQoZkEHIEEFdWmVXKCI= From: Isaac Scott To: mchehab@kernel.org Cc: rmfrfs@gmail.com, laurent.pinchart@ideasonboard.com, martink@posteo.de, kernel@puri.sm, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank.Li@nxp.com, Isaac Scott Subject: [PATCH v5 3/4] media: imx-mipi-csis: Add num_data_lanes to mipi_csis_device Date: Wed, 22 Oct 2025 11:22:27 +0100 Message-ID: <20251022102228.275627-4-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022102228.275627-1-isaac.scott@ideasonboard.com> References: <20251022102228.275627-1-isaac.scott@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add the num_data_lanes field to the mipi_csis_device struct, and set it equal to csis->bus.num_data_lanes. This is in preparation to support cases when the data lanes actively used differs from the maximum supported data lanes. No functional changes intended by this commit. Signed-off-by: Isaac Scott Reviewed-by: Frank Li Reviewed-by: Laurent Pinchart --- drivers/media/platform/nxp/imx-mipi-csis.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/pla= tform/nxp/imx-mipi-csis.c index 7c2a679dca2e..838a1ad123b5 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -351,6 +351,8 @@ struct mipi_csis_device { u32 hs_settle; u32 clk_settle; =20 + unsigned int num_data_lanes; + spinlock_t slock; /* Protect events */ struct mipi_csis_event events[MIPI_CSIS_NUM_EVENTS]; struct dentry *debugfs_root; @@ -573,7 +575,7 @@ static void mipi_csis_system_enable(struct mipi_csis_de= vice *csis, int on) val =3D mipi_csis_read(csis, MIPI_CSIS_DPHY_CMN_CTRL); val &=3D ~MIPI_CSIS_DPHY_CMN_CTRL_ENABLE; if (on) { - mask =3D (1 << (csis->bus.num_data_lanes + 1)) - 1; + mask =3D (1 << (csis->num_data_lanes + 1)) - 1; val |=3D (mask & MIPI_CSIS_DPHY_CMN_CTRL_ENABLE); } mipi_csis_write(csis, MIPI_CSIS_DPHY_CMN_CTRL, val); @@ -623,7 +625,7 @@ static int mipi_csis_calculate_params(struct mipi_csis_= device *csis, =20 /* Calculate the line rate from the pixel rate. */ link_freq =3D v4l2_get_link_freq(csis->source.pad, csis_fmt->width, - csis->bus.num_data_lanes * 2); + csis->num_data_lanes * 2); if (link_freq < 0) { dev_err(csis->dev, "Unable to obtain link frequency: %d\n", (int)link_freq); @@ -668,7 +670,7 @@ static void mipi_csis_set_params(struct mipi_csis_devic= e *csis, const struct v4l2_mbus_framefmt *format, const struct csis_pix_format *csis_fmt) { - int lanes =3D csis->bus.num_data_lanes; + int lanes =3D csis->num_data_lanes; u32 val; =20 val =3D mipi_csis_read(csis, MIPI_CSIS_CMN_CTRL); @@ -1366,8 +1368,9 @@ static int mipi_csis_async_register(struct mipi_csis_= device *csis) } =20 csis->bus =3D vep.bus.mipi_csi2; + csis->num_data_lanes =3D csis->bus.num_data_lanes; =20 - dev_dbg(csis->dev, "data lanes: %d\n", csis->bus.num_data_lanes); + dev_dbg(csis->dev, "max data lanes: %d\n", csis->bus.num_data_lanes); dev_dbg(csis->dev, "flags: 0x%08x\n", csis->bus.flags); =20 asd =3D v4l2_async_nf_add_fwnode_remote(&csis->notifier, ep, --=20 2.43.0 From nobody Sat Feb 7 07:25:51 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 E74FC328625; Wed, 22 Oct 2025 10:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128564; cv=none; b=gurHCb5zD+FcBUxgZtJ5mXK0OUyozt00nTKLNUM7d+AfUqho3NPNUugsqqIPTYhCW5sAJG51E5WzUgnV9+7ISvNFkvrP4vYhcZsnfTa1PT7HCicdPr5U0UDkh9CCYmRBnoXzvO2xBcwDwcFhdycXIKAysmlHVkFS3qpaGeM/4aM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761128564; c=relaxed/simple; bh=YxLHFykL3sVDstB6QqAhE2alQAOsXneyIHwU8PQ/9I4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=InBtjnMbC0zxiWRqZYDC5V0D1FKa7V31UCNXAfoaw3fxdh+8qr/mtma5XVpn9CcmkiO33q1dMOA0E//5tdCT1i+uBAlB3wEYXqe6gBtKs7pSqNDeNEWvFOpugVDDBbUk1kcBzqc4idOcK5kDLXyY4u/1y2B2pI7Mc42nJJJWbD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=IvJHQBfv; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IvJHQBfv" Received: from isaac-ThinkPad-T16-Gen-2.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C0E1A178A; Wed, 22 Oct 2025 12:20:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761128456; bh=YxLHFykL3sVDstB6QqAhE2alQAOsXneyIHwU8PQ/9I4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IvJHQBfv/w/CGAJCH6/+bepYpYHaqLpWXCLP+k/jTb1hrZYqrwQhIvczOXGuwrKQq FabTU3iNazT54Cyyj6Kj7Zwn4qr/yzFmqoAgTDHJPNUbvbMn3014sZp3Strl6tMY8o rroe0T+M6A6MBZgxTCey+Ei24RzPyG/DZtIQpZi0= From: Isaac Scott To: mchehab@kernel.org Cc: rmfrfs@gmail.com, laurent.pinchart@ideasonboard.com, martink@posteo.de, kernel@puri.sm, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Frank.Li@nxp.com, Isaac Scott Subject: [PATCH v5 4/4] media: imx-mipi-csis: Support active data lanes differing from maximum Date: Wed, 22 Oct 2025 11:22:28 +0100 Message-ID: <20251022102228.275627-5-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251022102228.275627-1-isaac.scott@ideasonboard.com> References: <20251022102228.275627-1-isaac.scott@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Call on v4l2_get_active_data_lanes() to check if the driver reports that the number of lanes actively used by the MIPI CSI transmitter differs to the maximum defined in device tree. If the number of active data lanes reported by the driver is invalid, or the operation is not supported, fall back to the number of allowed data lanes. Signed-off-by: Isaac Scott Reviewed-by: Frank Li --- 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/pla= tform/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 =3D v4l2_subdev_state_get_format(state, CSIS_PAD_SINK); csis_fmt =3D find_csis_format(format->code); =20 + ret =3D v4l2_get_active_data_lanes(csis->source.pad, + csis->bus.num_data_lanes); + csis->num_data_lanes =3D ret < 0 ? csis->bus.num_data_lanes : ret; + ret =3D mipi_csis_calculate_params(csis, csis_fmt); if (ret < 0) goto err_unlock; --=20 2.43.0