From nobody Sun Dec 14 11:17:53 2025 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 2FF8E35504E; Wed, 29 Oct 2025 18:03:50 +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=1761761036; cv=none; b=ULGaJ9vczsB+CGDFvypXvj1Mgh/LoTUbrvUwxMfD+c+vrtLH62AWHeNBzqm5fTw/cuqk/JsR91zxjnwVuYouBWTbf19CdnP1fdEpOtjGZdJUesC5Sqsm3OIltMp0q0Uz9uW9Cre9DiFIp0epjcVcLfE9gnWGuxVGwTvCSz2YwSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761761036; c=relaxed/simple; bh=CWqCphu9YThhCAKc1L7OQXGwf+2/Kb6MzN6fUWPJKCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f+Uttd8iiYG4UuNsTigKIoeociDo9SSw+Dw4DNP8tI1yyaA3sL4DyCuHpJPsUIJeCno7H4ylv2TjCLls/5ifBrsmn4h6vygBgczOT18u9U4/5XOkbWq/9O9lVu7apwYHS6awVOGSgK8dZ4rN5PgJnEwrZKIV5l5vprkSMpqSyy0= 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=nR7eGQaH; 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="nR7eGQaH" 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 7B4BA4E52; Wed, 29 Oct 2025 19:01:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761760918; bh=CWqCphu9YThhCAKc1L7OQXGwf+2/Kb6MzN6fUWPJKCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nR7eGQaHScn4ubQtmpbhmKW9C45Hh7Tl0HyXftvXTn2vHsXw2FuqfzyTujyV9IRZZ iZPb1mCHDYQKXalNWqp1ijmaX5bnjHTX90+8fMIJl3xHwfhX4oc16UYOhtA8SSagKT IBQmukAKlLf2hXORr57KGboZkeyT6Cthy6NEElE0= 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 v6 1/4] media: v4l: Add helper to get number of active lanes via a pad Date: Wed, 29 Oct 2025 18:03:18 +0000 Message-ID: <20251029180321.153680-2-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251029180321.153680-1-isaac.scott@ideasonboard.com> References: <20251029180321.153680-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..554c591e1113 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); + +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..f8b1faced79c 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. + */ +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 Sun Dec 14 11:17:53 2025 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 D4C5F3546FF; Wed, 29 Oct 2025 18:03:55 +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=1761761038; cv=none; b=ElR2KFxTMe6VILNyfTYK1bhWXblsAYbKcADP6yMEL/5XxLcEwfl2UdhggN45xz2XgItDqVVsxDVJ4pWLAd6bgDNm0m1YLh61mEiV3JHS72Vggi/UiYWPAN7IhJ2RpFTt/nVonrFhV6KO8z30LfrkIQyDlQrj2Rk+5iNZxgiodT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761761038; c=relaxed/simple; bh=C/Cbo20GJtUaPO+g6V4e4dxzNswEm9oCubEV2G/4xwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pkJ7PGqSnomfy8k8G39ah8aiD071+PD2hfqTHAd8CHkzUzDcUiNL3B1apk8KM7cvlwBFQZJwrZcC/jKJfIxwUD9yDkKTlPdtj5SUWOd3Y+B44HMCukj2xjX6I8JiG9G/LvA8EXHWywHpDf1K0+hYfgR6exHWMqVwbCaWQYBarcY= 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=Og+bquE3; 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="Og+bquE3" 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 C66FF4E45; Wed, 29 Oct 2025 19:01:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761760919; bh=C/Cbo20GJtUaPO+g6V4e4dxzNswEm9oCubEV2G/4xwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Og+bquE36VrebpPyoAcH64sRciI0I38y1kbpS/xCbXGCwEweP22GOH5Itv0wh1rXk BA8/hy00VVkEYegc0/K2+OpeiAz3RPTIAqXBgkkfplM7qu3JH2JNsLRb0v0wGf9Zbz kQ2ndFbrlToMfRzMAa9qFjHFns4a5LtjaJuhYtU8= 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 v6 2/4] media: imx-mipi-csis: Move redundant debug print in probe Date: Wed, 29 Oct 2025 18:03:19 +0000 Message-ID: <20251029180321.153680-3-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251029180321.153680-1-isaac.scott@ideasonboard.com> References: <20251029180321.153680-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 Reviewed-by: Laurent Pinchart Signed-off-by: Isaac Scott --- 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 Sun Dec 14 11:17:53 2025 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 DDC5A33B95C; Wed, 29 Oct 2025 18:03:58 +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=1761761042; cv=none; b=C61XrP1p3jKdu1S1pFkfGYVq5K0QSIZmsUWtS5rXrGxxyDgE8Q5RR7XdAmYprJiTh5XEOjoiRNLYV4xS3medITgjRO8F5BHjca1oewIONPu7bTwN3W9SZtn0u+k87Hzfbp94pRYr/XkmYJA60msaltJ/EenMvCeNLk+2Cq6lb4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761761042; c=relaxed/simple; bh=PlXU6jKiiXna7dvuaZgrh1DWHRm2LRbE5QQUIXHQgb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eR4YHSNBgvBG8ETTECzvIGRgXByGeuXceudMG6EB/dNsgcEFa1A/2H4QiEs8CCLmGiDQNncSJz2Sbgf/QKJ2fBfPoe859O7On5HjCokQ1t7Fc5gKpZHAG6QwDZAAb/DmxqU/unQCBURzKtDVxamfwU/O+8uCh/acx3Uu57zXP5U= 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=QsvL08kY; 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="QsvL08kY" 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 107884E53; Wed, 29 Oct 2025 19:02:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761760920; bh=PlXU6jKiiXna7dvuaZgrh1DWHRm2LRbE5QQUIXHQgb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsvL08kYhF71izk4rGh/o1zPw2Js3NIrTaNJ0FMCUooGVvWV+bGgBIbXHYxFqhlTm 9GK5VT/aTYknKIV9jMMJAQdAH+hMTNB3EnviaC4ZXR8xdlB8aDtI88p5ENJqqhA0Ru WcO/SCBmFV0H9Bvea7GeeRUSSUmiKVtH8i0GMeRA= 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 v6 3/4] media: imx-mipi-csis: Add num_data_lanes to mipi_csis_device Date: Wed, 29 Oct 2025 18:03:20 +0000 Message-ID: <20251029180321.153680-4-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251029180321.153680-1-isaac.scott@ideasonboard.com> References: <20251029180321.153680-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. Reviewed-by: Frank Li Reviewed-by: Laurent Pinchart Signed-off-by: Isaac Scott --- 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 Sun Dec 14 11:17:53 2025 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 15DAE3559C9; Wed, 29 Oct 2025 18:04:00 +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=1761761045; cv=none; b=duTvWCTsApCzgPMX32kfftQTXx6a0dEj9CauRYSS8n1j+CN6r4HAarMMXj1HjCzNu7FDxCZxF7uUg90cvU62AZzQqZ0BsB0tZbW0X9u7nWwn8kyvtIo8RQ6BWrMSHqcFQ5YMifpilMlX73gTSMa//nA3GfV9+8G2dRZbYcbm7E8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761761045; c=relaxed/simple; bh=eY/oR6gIBneCiyv1U57xLJ4h9FoVnMvAOPH0It6RWj4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=joFdDg1/WUOz5AxqJuDn1oklTascahOy1rqPwe6RlFRxhL4rTGi9PjL+q0IdnSF+8aXeVre+KlaX66VuAiTmrn+adkdST8PKbhGqNqqGHUfC+cq1TFKbyUh29RLxlHTqOdzZkhCqADKsoxVXVSZFVdaop7rBIugBOARuXWK6Nd0= 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=l4XNVpdg; 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="l4XNVpdg" 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 E28794EE1; Wed, 29 Oct 2025 19:02:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761760922; bh=eY/oR6gIBneCiyv1U57xLJ4h9FoVnMvAOPH0It6RWj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4XNVpdgcKPaIF7GwHLThY9iMTK5s4n9KB6+6dGhPmHrvNmzZFyA6zNy1U8lfFjyc m76vHEJqWHAZCMSuid3In3EoHG9551FwW9TLAUXQidm+5L6WuZ4RvTEyi0V1FXZdOM z5IGxTTO22ARunLtV4WqwGeO6uYXkhRIWMbM+uI0= 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 v6 4/4] media: imx-mipi-csis: Support active data lanes differing from maximum Date: Wed, 29 Oct 2025 18:03:21 +0000 Message-ID: <20251029180321.153680-5-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251029180321.153680-1-isaac.scott@ideasonboard.com> References: <20251029180321.153680-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, catch and return the error. If the operation is not supported, fall back to the number of allowed data lanes. Signed-off-by: Isaac Scott --- drivers/media/platform/nxp/imx-mipi-csis.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/pla= tform/nxp/imx-mipi-csis.c index 838a1ad123b5..4224ea2d80b6 100644 --- a/drivers/media/platform/nxp/imx-mipi-csis.c +++ b/drivers/media/platform/nxp/imx-mipi-csis.c @@ -1034,6 +1034,12 @@ 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_l= anes); + if (ret < 0) + goto err_unlock; + + csis->num_data_lanes =3D ret; + ret =3D mipi_csis_calculate_params(csis, csis_fmt); if (ret < 0) goto err_unlock; --=20 2.43.0